Vagrant - SSH响应非零退出状态

时间:2017-05-14 21:07:54

标签: vagrant puppet

==> payment: Notice: /Stage[main]/Nginx::Service/Service[nginx]/ensure: ensure changed 'stopped' to 'running'
==> payment: Info: /Stage[main]/Nginx::Service/Service[nginx]: Unscheduling refresh on Service[nginx]
==> payment: Info: Stage[main]: Unscheduling all events on Stage[main]
==> payment: Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
==> payment: Notice: Applied catalog in 219.19 seconds
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

根据上述情况,我无法解决实际失败的问题? Nginx按预期运行。

1 个答案:

答案 0 :(得分:2)

你的情况没有失败。当Puppet成功应用导致系统更改的目录时,返回的退出代码为2。 Vagrant将所有不0的ssh退出代码解释为意外和隐含的失败。 Puppet在此实例中为退出代码返回2,并且Vagrant将其解释为失败。

我建议在使用shell执行echo $?的Puppet执行后添加配置行。这将为Vagrant提供所需的0返回码,同时还允许您查看实际代码是什么,并验证它是2

config.vm.provision 'shell', inline: 'echo $?'

根据需要将config替换为本地Ruby块变量。

https://docs.puppet.com/puppet/latest/man/agent.html#OPTIONS

相关问题