3

My install file is like this:

...
cd /home/work/package/dea_ng
...
bundle install
export PATH=$PATH:/usr/local/go/bin
bundle exec rake dir_server:install

I'm pretty sure that the last command can run successfully on my client machine, but puppet keep reporting " returned 1 instead of one of [0]" error.

So, here is the install manifest:

class dea_ng::install {
  exec { "/bin/bash /home/work/install/dea_ng_install.sh":
    path=>'/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin',
    cwd =>'/home/work/install',
    logoutput => false,
    require =>Class["dea_ng::dea_ngfile"],
    before => Class["dea_ng::service"],
  }
} 

The problem also happens to my start command which also use bundle exec: after puppet finished dea_ng::install and run dea_ng::service, the command below did not work unless I execute it manually on the client machine.

bundle exec rake dir_server:run[config/dea.yml] &

I'm really confused about this, it seems like puppet can not handle bundle exec well in my case. Did I missed some env configuration here?

The output of --debug seems no help:

Debug: Executing '/bin/bash /home/work/install/dea_ng_install.sh'
Error: /bin/bash /home/work/install/dea_ng_install.sh returned 1 instead of one of [0]
Error: /Stage[main]/Dea_ng::Install/Exec[/bin/bash /home/work/install/dea_ng_install.sh]/returns: change from notrun to 0 failed: /bin/bash /home/work/install/dea_ng_install.sh returned 1 instead of one of [0]

And if I remove the bundle exec line, the shell will success.

4

1 回答 1

4

通过添加 output => true 可以找到真正的错误:

couldn't find HOME environment -- expanding `~'

这是 Puppet3 中的一个已知问题,请参阅

https://groups.google.com/forum/#!topic/puppet-users/5sk9mJqe4Z0

所以添加 HOME env 解决了这个问题:

环境=>“家=/根”

于 2013-08-20T07:23:21.137 回答