我尝试从bitbucket下载uru并尝试使用默认登录凭据安装vagrant。我可以下载档案。当我尝试运行脚本时,请看到此错误 - Invalidly-formated env parameter. See documentation.
我能够毫无错误地运行脚本。我在无主模式下使用vagrant在本地运行它。任何帮助都非常感谢。
download_uru:
file.managed:
- name: c:\uru-0.8.3-windows-x86.7z
- source: https://bitbucket.org/jonforums/uru/downloads/uru-0.8.3-windows-x86.7z
- source_hash: sha256=f2a7b4ed8ef6b02613b134da19a31293c7423e8fbbd8e49ec5c1c86c5f3a0815
install_uru:
cmd.run:
- source: salt://ruby/files/install_uru.ps1
- shell: powershell
- env: "-ExecutionPolicy bypass"
- runas: "vagrant"
- password: "vagrant"
- require:
- file: download_uru
$ cat install_uru.ps1
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
sz x -oC: C:\uru-0.8.3-windows-x86.7z -r ;
c:\ salt \ salt-call.bat --version
盐呼叫2016.11.3(碳)答案 0 :(得分:1)
您的问题是由于-env
参数格式错误造成的。如official documentation中所述,它必须是列表,并且您要设置字符串。
修复install_uru
状态,如下面的代码,它将正确运行。
install_uru:
cmd.run:
- source: salt://ruby/install_uru.ps1
- shell: powershell
- env:
- ExecutionPolicy: "bypass"
- runas: "vagrant"
- password: "vagrant"
- require:
- file: download_uru
答案 1 :(得分:0)
这也有效。
download_uru:
file.managed:
- name: c:\uru-0.8.3-windows-x86.7z
- source: https://bitbucket.org/jonforums/uru/downloads/uru-0.8.3-windows-x86.7z
- source_hash: sha256=f2a7b4ed8ef6b02613b134da19a31293c7423e8fbbd8e49ec5c1c86c5f3a0815
salt://ruby/files/install_uru.ps1:
cmd.script:
- shell: powershell
- env:
- ExecutionPolicy: "bypass"
- cwd: C:\