From c04254a0aa9caab42d98b2ee89bf8a842bb1ccdc Mon Sep 17 00:00:00 2001 From: Alessandro Pilotti Date: Sat, 6 Jul 2013 02:23:25 +0300 Subject: [PATCH] Checks for SYSNATIVE folder presence Checks for sysnative folder presence instead of the Powershell subdirectory. Adds some minor refactory as well. --- cloudbaseinit/plugins/windows/userdata.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cloudbaseinit/plugins/windows/userdata.py b/cloudbaseinit/plugins/windows/userdata.py index 8c274232..87907295 100644 --- a/cloudbaseinit/plugins/windows/userdata.py +++ b/cloudbaseinit/plugins/windows/userdata.py @@ -56,20 +56,19 @@ class UserDataPlugin(base.BasePlugin): '-NonInteractive', target_path] shell = False elif re.search(r'^#ps1_sysnative\s', user_data, re.I): - if os.path.isdir(os.path.expandvars("%windir%") - + "\\sysnative\\WindowsPowerShell\\v1.0\\"): + if os.path.isdir(os.path.expandvars('%windir%\\sysnative')): target_path += '.ps1' - args = [os.path.expandvars("%windir%") - + '\\sysnative\\WindowsPowerShell\ - \\v1.0\\powershell.exe', + args = [os.path.expandvars('%windir%\\sysnative\\' + 'WindowsPowerShell\\v1.0\\' + 'powershell.exe'), '-ExecutionPolicy', 'RemoteSigned', '-NonInteractive', target_path] shell = False else: # Unable to validate sysnative presence - LOG.warning('Unable to validate sysnative folder presence.\ - If Target OS is Server 2003, please ensure you have\ - KB942589 installed') + LOG.warning('Unable to validate sysnative folder presence. ' + 'If Target OS is Server 2003, please ensure you ' + 'have KB942589 installed') return (base.PLUGIN_EXECUTION_DONE, False) else: # Unsupported