user-data powershell script fails for unknown reason
Hi Guys,
i am running into a situation that my system is trying to run the script which is provided through the user-data field. i can see that the script is in the log file, and that its beeing placed onto the system.
if i run the script ( which i copied from the cloudinit.log ) locally to a file and then run it, all is fine, no problems what so ever (so the script is fine) but when the cloudinit runs it, it fails every time.
i also believe this is due to the fact that cloudinit-unattended is rebooting the system to set the hostname.
Here is a part of the log (verbose and debug are true)
2019-01-15 10:14:59.827 1844 INFO cloudbaseinit.init [-] Executing plugin 'UserDataPlugin' 2019-01-15 10:14:59.827 1844 DEBUG cloudbaseinit.metadata.services.base [-] Getting metadata from: http://ipaddress/latest/user-data _http_request c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\metadata\services\base.py:255 2019-01-15 10:14:59.842 1844 DEBUG cloudbaseinit.plugins.common.userdata [-] User data content length: 3716 execute c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\userdata.py:49 2019-01-15 10:14:59.842 1844 DEBUG cloudbaseinit.plugins.common.userdata [-] Processing userdata _process_user_data c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\userdata.py:108 2019-01-15 10:14:59.842 1844 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.userdataplugins.parthandler.PartHandlerPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2019-01-15 10:14:59.842 1844 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.userdataplugins.cloudconfig.CloudConfigPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2019-01-15 10:14:59.951 1844 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.userdataplugins.cloudboothook.CloudBootHookPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2019-01-15 10:14:59.967 1844 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.userdataplugins.shellscript.ShellScriptPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2019-01-15 10:14:59.967 1844 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.userdataplugins.multipartmixed.MultipartMixedPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2019-01-15 10:14:59.967 1844 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.userdataplugins.heat.HeatPlugin' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27 2019-01-15 10:14:59.967 1844 DEBUG cloudbaseinit.plugins.common.userdata [-] User data content: Content-Type: multipart/mixed; boundary="MIMEBOUNDARY" MIME-Version: 1.0 --MIMEBOUNDARY Content-Disposition: attachment; filename="cloudinit.ps1" Content-Transfer-Encoding: 7bit Content-Type: text/x-shellscript Mime-Version: 1.0 #ps1_sysnative $chefversion = 'xxx' $chefenvironment = 'xxx' $vaulttoken = 'xxx' $validationcert = 'xxx' $nodename = ($env:COMPUTERNAME).ToLower() Start-Transcript -Path $env:SystemRoot\temp\transscript.log do { Write-Host "waiting..." sleep 3 } until(Test-NetConnection omnitruck.chef.io -Port 443 | ? { $_.TcpTestSucceeded } ) write-output "ik wil lopen" | out-file "c:\bla.txt ...