Chef infra Powershell脚本在引导过程中失败,但在第一次客户端运行后工作

Chef infra Powershell脚本在引导过程中失败,但在第一次客户端运行后工作,chef-infra,chef-recipe,cookbook,Chef Infra,Chef Recipe,Cookbook,我有以下执行power shell命令的配方: powershell_script 'Install' do cwd 'C:\scripts' code <<-EOH powershell C:\\scripts\\pair.ps1 -repo-host #{repohost} -repo-dir #{repodir} -repo-https-port #{repohttpsport} -management-server #{managementserver

我有以下执行power shell命令的配方:

powershell_script 'Install' do
    cwd 'C:\scripts'
    code <<-EOH
    powershell C:\\scripts\\pair.ps1 -repo-host #{repohost} -repo-dir #{repodir} -repo-https-port #{repohttpsport} -management-server #{managementserver} -activation-code #{activationcode} -env #{env} -loc #{loc} -role #{role} -app #{app}; Set-ExecutionPolicy -Scope process undefined -Force;
    EOH
end
一旦引导失败,当我在这个节点上手动运行chef clinet时,这将成功完成

这是一种奇怪的行为,它在引导过程中失败,但在第一次运行chef客户机时使用相同的命令

非常感谢任何关于修复此错误的线索


谢谢

尝试使用类似于
winrm set winrm/config/winrs'@{MaxMemoryPerShellMB=“1024”}的命令在winrm中提升您的
maxmorypershellmb
。for chef已经很老了,但报告了一个类似的问题。

您确定要在那里使用
powershell\u脚本而不是
execute
?这看起来不像powershell代码,它看起来像一个命令。
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     Error executing action `run` on resource 'powershell_script[Insta
ll]'
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     =================================================================
===============
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     **

 - Mixlib::ShellOut::ShellCommandFailed

**
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     ------------------------------------
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     Expected process to exit with [0], but received '1'
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     ---- Begin output of "powershell.exe" -NoLogo -NonInteractive -No
Profile -ExecutionPolicy Bypass -InputFormat None -Command ". 'C:/Users/ADMINI~1/AppData/Local/Temp/chef_powershell_scri
pt-user-code20180502-2840-7o4rwn.ps1'" ----
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     STDOUT:
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     STDERR: Thread failed to start.
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     ---- End output of "powershell.exe" -NoLogo -NonInteractive -NoPr
ofile -ExecutionPolicy Bypass -InputFormat None -Command ". 'C:/Users/ADMINI~1/AppData/Local/Temp/chef_powershell_script
-user-code20180502-2840-7o4rwn.ps1'" ----
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com     Ran "powershell.exe" -NoLogo -NonInteractive -NoProfile -Executio
nPolicy Bypass -InputFormat None -Command ". 'C:/Users/ADMINI~1/AppData/Local/Temp/chef_powershell_script-user-code20180
502-2840-7o4rwn.ps1'" returned 1
ec2-13-232-54-174.ap-south-1.compute.amazonaws.com [2018-05-02T17:49:46+00:00] FATAL: Mixlib::ShellOut::ShellCommandFail
ed: powershell_script[Install] (illumio2::default line 39) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected
process to exit with [0], but received '1'
ERROR: Failed to execute command on ec2-13-232-54-174.ap-south-1.compute.amazonaws.com return code 1
ERROR: Bootstrap command returned 1