我的热模板如下:
windows_instance:
type: OS::Nova::Server
properties:
image: {get_param: imagever }
flavor: m1.large
key_name: test
networks:
- port: { get_resource: publicport }
user_data_format: RAW
user_data:
str_replace:
template: |
#ps1
testps "$srcurl" "$dest" -Verbose
params:
$dest: { get_param: target_location }
$srcurl: { get_param: url_src }
testps: { get_file: test1.ps1 }
test1.ps1:
param([String]$src, [String]$dest)
Write-Host "url is:" + $src
write-host "dest is:" + $dest
但是cloudbase-init.log报告了:executeserdascript C:\Program Files(x86)\cloudbase Solutions\cloudbase init\Python27\lib\site packages\cloudbaseinit\plugins\windows\userdatautils.py:58 2015-04-27 18:40:06.905 1788 DEBUG cloudbaseinit.plugins.winows.userdatautils[-]Userdata stderr:术语"param"未被识别为cmdlet、函数、脚本和的名称
le或可操作程序。检查名称的拼写,或者路径是否包含
ded,请验证路径是否正确,然后重试。
在C:\Users\cloudbase init\appdata\local\temp\6ea2afb5-645b-430c-91a2-a67c3201f
5db.ps1:7字符:7
param <<<< ([String]$src, [String]$dest)
CategoryInfo : ObjectNotFound: (param:String) [], CommandNotFou
ndException
FullyQualifiedErrorId : CommandNotFoundException
那么,使用heat模板将参数传递给powershell脚本的正确方法是什么呢?
我让它根据样本工作:
https://github.com/openstack/heat-templates/tree/master/hot/Windows