parse error for the parameters in powershell script
I have one script which accepts two parameters: param([string] $urlsrc,[string]dest)
But when I try to launch the windows VM using heat template, cloudbase-init.log reported: executeuserdatascript C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\Python27\lib\site-packages\cloudbaseinit\plugins\windows\userdatautils.py:58 2015-04-27 13:53:19.530 1788 DEBUG cloudbaseinit.plugins.windows.userdatautils [-] Userdata stderr: Parameter declarations are a comma-separated list of variable names with option
al initializer expressions.
At line:2 char:10
[String] <<<< ,
- CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordEx
ception
- FullyQualifiedErrorId : InvalidFunctionParameter
executeuserdata_script C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\Python27\lib\site-packages\cloudbaseinit\plugins\windows\userdatautils.py:59 2015-04-27 13:53:19.546 17
I can run the script successfully from powershell command prompt. Could you pls tell me how to fix it? Thanks a lot
Hi. Could you post the part of the Heat template where the actual powershell script is? Also, it seems you are using a really old cloudbase-init version, consider using the latest version.
The script is like: param([String]$urlsrc, [String]$dest) $webclient = New-Object System.Net.webclient $testcode1 = $webclient.downloadstring($urlsrc) -split "\<a\s+" $allsnapshots="$testcode1" |="" select-string="" "\(?<="\">\)(\d+)(.*)SNAPSHOT(?=\/\<)" -allmatches | % { $_.matches } | % { $_.value } |get-unique |sort -descending
I checked and found I am using cloudbase-init 1.0.0.0. is this the latest version?