userdata and powershell script on cloudbase-init
Hi,
We're currently developing powershell scripts to automate our windows server guest deployment but we're facing some issues and therefore, having some questions:
1) Does cloudbase-init support script URL inclusion when specifying userdata ? eg:
#include
http://someurl.com/somescript_here
2) Is there any code parsing issue ? Our code doesn't seem to be running and is causing some exception to be thrown. This is when we're giving the code directly within userdata (-vs- specifying an inclusion as mentioned above).
Please note the code is running just fine when we're executing it directly within the instance.
Please also note that userdata powershell script that only has a few lines with no special character is working fine as well eg:
#ps1
net user blabla pwd123
So here is the cloudbase-init log snippet:
2017-06-28 23:45:51.058 2640 DEBUG cloudbaseinit.plugins.common.userdatautils [-] User_data stderr:
b'At C:\\Users\\cloudbase-init\\AppData\\Local\\Temp\\9d2a38d8-48fe-41fb-b8c1-b09007fadad1.ps1:72 char:31\r\n+ ... abet=$NULL;For ($a=65;$a \x83?"le 90;$a++) {$alphabet+=,[char][byte]$a }\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nUnexpected token \'\x83?"le 90;$a++) {$alphabet+=,[char][byte]$a }\r\n$ascii=$NULL;For ($a=33;$a \x83?"le\' in expression or statement.\r\nAt C:\\Users\\cloudbase-init\\AppData\\Local\\Temp\\9d2a38d8-48fe-41fb-b8c1-b09007fadad1.ps1:73 char:37\r\n+ $ascii=$NULL;For ($a=33;$a \x83?"le 126;$a++) {$ascii+=,[char][byte]$a }\r\n+ ~\r\nMissing closing \')\' after expression in \'for\' statement.\r\nAt C:\\Users\\cloudbase-init\\AppData\\Local\\Temp\\9d2a38d8-48fe-41fb-b8c1-b09007fadad1.ps1:73 char:42\r\n+ $ascii=$NULL;For ($a=33;$a \x83?"le 126;$a++) {$ascii+=,[char][byte]$a }\r\n+ ~\r\nUnexpected token \')\' in expression or statement.\r\nAt C:\\Users\\cloudbase-init\\AppData\\Local\\Temp\\9d2a38d8-48fe-41fb-b8c1-b09007fadad1.ps1:76 char:21\r\n+ For ($loop=1; $loop \x83?"le 9; $loop++) {\r\n+ ~~~~~~~~~~~~~~~~~~~\r\nUnexpected token \'\x83?"le 9; $loop++) {\r\n\t$Username+=($alphabet | GET-RANDOM)\r\n}\r\necho "Username:\' in expression or statement.\r\nAt C:\\Users\\cloudbase-init\\AppData\\Local\\Temp\\9d2a38d8-48fe-41fb-b8c1-b09007fadad1.ps1:83 char:28\r\n+ For ($loop=1; $loop \x83?"le 9; $loop++) {\r\n+ ~\r\nMissing closing \')\' after expression in \'for\' statement.\r\nAt C:\\Users\\cloudbase-init\\AppData\\Local\\Temp\\9d2a38d8-48fe-41fb-b8c1-b09007fadad1.ps1:83 char:37\r\n+ For ($loop=1; $loop \x83?"le 9; $loop++) {\r\n+ ~\r\nUnexpected token \')\' in expression or statement.\r\n + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : UnexpectedToken\r\n \r\n' execute_user_data_script c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\userdatautils.py:94
3) Our windows guests are getting 2 interfaces. The first one is being configured as static ip address while the second one is using DHCP - it is basically matching our neutron subnet configurations. Due to some limitation, we cannot use DHCP on the primary interface / neutron subnet. Is there a way to speed up the static IP configuration process ? DHCP configuration happens within seconds while static network IP configuration takes minutes.
If that is not possible, is there a ...