为什么git pre-receive hook没有检测到puppet-lint?

时间:2015-07-08 03:01:33

标签: git hook bundler githooks rbenv

我正在使用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

1 个答案:

答案 0 :(得分:0)

检查您正在进行的服务器。您正在运行此用户的用户可能没有设置别名,或者路径中有puppet-lint