厨师策略安装失败了(Mixlib :: ShellOut :: ShellCommandFail)

发布于 2025-01-31 09:56:18 字数 1716 浏览 4 评论 0原文

我是厨师的新手。最近几天,我正在研究厨师的政策。但是命令“厨师安装”失败了(mixlib :: shellout :: shellcommandfailed)。请看看和友好的帮助。谢谢 这是详细信息 -

  1. 我创建了一本名为“策略文件”样本的食谱 -

    厨师生成食谱样本

    它成功创建了食谱文件夹。

  2. 然后我创建了一个食谱-E.RB-在其中 -

    文件'/tmp/e.sh'做 内容 ' #!/bin/bash cat /tmp/e.log dt = 日期 +%f“”%t echo $ 1“” $ {dt}>> /tmp/e.log ' 模式'755' 结束

  3. 然后CD回到Chef-Repo文件夹,我创建了另一本食谱 - 策略测试 -

    厨师生成食谱策略测试-P

    它也完成了。

  4. 这次,我在策略测试中修改了元数据.rb为 -

    名称“策略测试” 维护者“作者” WEASTER_EMAIL' 许可“保留所有权利” 描述“安装/配置策略测试” 版本“ 0.1.0” Chef_version'> = 16.0'

    取决于“样本”

和policyfile.rb-

name 'policytest'
default_source :supermarket
run_list 'policytest::default'

cookbook 'policytest', path: '.'
cookbook 'sample', path: '../sample'
  1. 然后我上传了两个食谱 -

    刀食谱上传样本 刀食谱上传策略测试

    全部成功完成。

  2. 然后,当我安装策略时会引起的错误 -

    c:\ work \ chef-repo \ cookbooks>厨师安装politiontest \ policyfile.rb 构建策略测试扩展的运行列表: 食谱[PolicyTest ::默认]缓存食谱...安装策略测试

    = 0.0.0从路径安装示例> = 0.0.0的路径错误:无法生成politationfile.lock原因: (mixlib :: shellout :: shellcommandfailed)期望退出 [0],但收到了“ 1” ----开始git smbolic-ref -q头的输出 - stdout:stderr:'git'不被识别为内部或外部命令,可操作 程序或批处理文件。 ---- GIT符号-REF -Q头的最终输出 - 返回git smbolic-ref -q头返回1

    我无法在解决方案中搜索此错误。请帮助我获得我的错误 - 策略编码或我执行的过程?预先感谢您的任何想法。

I'm new to chef. Recent days, I'm studying policy in chef. But the command "chef install " failed with error (Mixlib::ShellOut::ShellCommandFailed). Please have a look and kind help. Thanks
Here's the details--

  1. I create a cookbook named sample with policy file --

    chef generate cookbook sample

    It created the cookbook folder successfully.

  2. Then I create a recipe -- e.rb -- in it --

    file '/tmp/e.sh' do
    content '
    #!/bin/bash
    cat /tmp/e.log
    DT=date +%F" "%T
    echo $1" "${DT} >> /tmp/e.log
    '
    mode '755'
    end

  3. Then cd back to the chef-repo folder, I create another cookbook -- policytest --

    chef generate cookbook policytest -P

    It completed too.

  4. This time, I modified the metadata.rb in policytest as --

    name 'policytest'
    maintainer 'The Authors'
    maintainer_email '[email protected]'
    license 'All Rights Reserved'
    description 'Installs/Configures policytest'
    version '0.1.0'
    chef_version '>= 16.0'

    depends 'sample'

And the policyfile.rb --

name 'policytest'
default_source :supermarket
run_list 'policytest::default'

cookbook 'policytest', path: '.'
cookbook 'sample', path: '../sample'
  1. Then I uploaded both cookbooks --

    knife cookbook upload sample
    knife cookbook upload policytest

    All successfully completed.

  2. Then the error raised when I install the policy --

    C:\Work\chef-repo\cookbooks>chef install policytest\Policyfile.rb
    Building policy policytest Expanded run list:
    recipe[policytest::default] Caching Cookbooks... Installing policytest

    = 0.0.0 from path Installing sample >= 0.0.0 from path Error: Failed to generate Policyfile.lock Reason:
    (Mixlib::ShellOut::ShellCommandFailed) Expected process to exit with
    [0], but received '1'
    ---- Begin output of git symbolic-ref -q HEAD ---- STDOUT: STDERR: 'git' is not recognized as an internal or external command, operable
    program or batch file.
    ---- End output of git symbolic-ref -q HEAD ---- Ran git symbolic-ref -q HEAD returned 1

    I can't search the solution for this error. Please kind help me to get what's my error -- either the policy coding or the process I executed? Thanks in advance for any idea.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何时共饮酒 2025-02-07 09:56:18

看来Git没有安装,请安装或将其指出路径。

Looks like Git is not installed, Please install it or point it out in path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文