@@ -1,8 +1,7 @@
# Copy this file to cdkeys.cfg and edit it.
#
# Replace the 'CDKEY' strings with real cdkeys where necessary.
-# Guests that do not require cdkeys by default are commented out.
-# You may uncomment them if necessary.
+# Feel free to add additional guests as required.
RHEL.5.3.i386: cdkey = CDKEY
RHEL.5.3.x86_64: cdkey = CDKEY
@@ -11,7 +10,9 @@ WinXP.32: cdkey = CDKEY
WinXP.64: cdkey = CDKEY
Win2003.32: cdkey = CDKEY
Win2003.64: cdkey = CDKEY
-#WinVista.32: cdkey = CDKEY
-#WinVista.64: cdkey = CDKEY
-#Win2008.32: cdkey = CDKEY
-#Win2008.64: cdkey = CDKEY
+WinVista.32: cdkey = CDKEY
+WinVista.64: cdkey = CDKEY
+Win2008.32: cdkey = CDKEY
+Win2008.64: cdkey = CDKEY
+Win7.32: cdkey = CDKEY
+Win7.64: cdkey = CDKEY
@@ -97,7 +97,22 @@ class UnattendedInstall(object):
dest_fname = "autounattend.xml"
dest = os.path.join(self.floppy_mount, dest_fname)
- shutil.copyfile(self.unattended_file, dest)
+
+ # Replace KVM_TEST_CDKEY (in the unattended file) with the cdkey
+ # provided for this test
+ unattended_contents = open(self.unattended_file).read()
+ dummy_cdkey_re = r'\bKVM_TEST_CDKEY\b'
+ real_cdkey = os.environ.get('KVM_TEST_cdkey')
+ if re.search(dummy_cdkey_re, unattended_contents):
+ if real_cdkey:
+ unattended_contents = re.sub(dummy_cdkey_re, real_cdkey,
+ unattended_contents)
+ else:
+ print ("WARNING: 'cdkey' required but not specified for this "
+ "unattended installation")
+
+ # Write the unattended file contents to 'dest'
+ open(dest, 'w').write(unattended_contents)
if self.finish_program:
dest_fname = os.path.basename(self.finish_program)
@@ -25,7 +25,7 @@ OemSkipWelcome = 1
FullName = "rhqe"
OrgName = "REDHAT"
ComputerName = *
-ProductKey = [replace-with-your-prodkey]
+ProductKey = KVM_TEST_CDKEY
[LicenseFilePrintData]
AutoMode=PerServer
@@ -25,7 +25,7 @@ OemSkipWelcome = 1
FullName = "rhqe"
OrgName = "REDHAT"
ComputerName = *
-ProductKey = [replace-with-your-prodkey]
+ProductKey = KVM_TEST_CDKEY
[LicenseFilePrintData]
AutoMode=PerServer
@@ -53,7 +53,7 @@
</ImageInstall>
<UserData>
<ProductKey>
- <Key>replace-with-your-prodkey</Key>
+ <Key>KVM_TEST_CDKEY</Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
@@ -45,7 +45,7 @@
<UserData>
<ProductKey>
<WillShowUI>OnError</WillShowUI>
- <Key>replace-with-your-prodkey</Key>
+ <Key>KVM_TEST_CDKEY</Key>
</ProductKey>
<AcceptEula>true</AcceptEula>
</UserData>
@@ -45,7 +45,7 @@
<UserData>
<ProductKey>
<WillShowUI>OnError</WillShowUI>
- <Key>replace-with-your-prodkey</Key>
+ <Key>KVM_TEST_CDKEY</Key>
</ProductKey>
<AcceptEula>true</AcceptEula>
</UserData>
@@ -53,7 +53,7 @@
</ImageInstall>
<UserData>
<ProductKey>
- <Key>replace-with-your-prodkey</Key>
+ <Key>KVM_TEST_CDKEY</Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
@@ -45,7 +45,7 @@
<UserData>
<ProductKey>
<WillShowUI>OnError</WillShowUI>
- <Key>replace-with-your-prodkey</Key>
+ <Key>KVM_TEST_CDKEY</Key>
</ProductKey>
<AcceptEula>true</AcceptEula>
</UserData>
@@ -47,7 +47,7 @@
</ImageInstall>
<UserData>
<ProductKey>
- <Key>replace-with-your-prodkey</Key>
+ <Key>KVM_TEST_CDKEY</Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
@@ -39,7 +39,7 @@
<UserData>
<ProductKey>
<WillShowUI>OnError</WillShowUI>
- <Key>replace-with-your-prodkey</Key>
+ <Key>KVM_TEST_CDKEY</Key>
</ProductKey>
<AcceptEula>true</AcceptEula>
</UserData>
@@ -25,7 +25,7 @@
OEMSkipRegional=1
[UserData]
- ProductKey=[replace-with-your-prodkey]
+ ProductKey=KVM_TEST_CDKEY
FullName="Autotest Mindless Drone"
OrgName="Autotest"
ComputerName=*