【发布时间】:2015-07-08 03:01:32
【问题描述】:
我正在使用drwahl/puppet-git-hooks。
我在本地机器上安装了puppet-lint,但是当我执行git push origin puppet_hook 时,我得到以下输出:
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 345 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Checking puppet manifest syntax for manifests/init.pp...
remote: Error: Could not parse for environment production: Syntax error at '}' at manifests/init.pp:3
remote: Error: puppet syntax error in manifests/init.pp (see above)
remote: Error: 1 syntax error(s) found in puppet manifests. Commit will be aborted.
remote: puppet-lint not installed. Skipping puppet-lint tests...
remote: Error: 1 subhooks failed. Declining push.
remote: Hook /var/tmp/hooks/pre-receive.puppet failed with error code 1
如你所见:
remote: puppet-lint not installed. Skipping puppet-lint tests...
当我追踪到预接收脚本(上面提供)时,我发现了以下检查:
#puppet manifest styleguide compliance
if [ "$CHECK_PUPPET_LINT" != "disabled" ] ; then
if type puppet-lint >/dev/null 2>&1; then
if [ $(echo $changedfile | grep -q '\.*.pp$' ; echo $?) -eq 0 ]; then
${subhook_root}/puppet_lint_checks.sh $CHECK_PUPPET_LINT $tmpmodule "${tmptree}/"
RC=$?
if [ "$RC" -ne 0 ]; then
failures=`expr $failures + 1`
fi
fi
else
echo "puppet-lint not installed. Skipping puppet-lint tests..."
fi
fi
似乎失败了:
if type puppet-lint >/dev/null 2>&1; then
当我在本地运行上述命令时,它是成功的。
为什么没有通过预接收脚本检测到puppet-lint?
【问题讨论】:
-
你确定
puppet-lint是一个可以在你的PATH中访问的命令吗? -
which puppet-lint向我展示了以下内容:/Users/aca/.rbenv/shims/puppet-lint但是whereis puppet-lint是空的,所以我创建了一个符号链接:/usr/bin/puppet-lint到/Users/aca/.rbenv/shims/puppet-lint但它仍然不起作用。 -
远程源是在你的机器上还是在远程机器上?
-
@joran:远程服务器。它似乎可以很好地运行语法检查器,所以它肯定会成功。
-
@aspiringCodeArtisan 你能确定 puppet-lint 在远程服务器上可用并且可以由你的远程用户执行(哪个用户取决于你如何克隆 repo)?
标签: git hook bundler githooks rbenv