EisenWang
EisenWang

Reputation: 383

Chef policy installation failed with (Mixlib::ShellOut::ShellCommandFailed)

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.

Upvotes: 0

Views: 770

Answers (1)

Thirumoorthi
Thirumoorthi

Reputation: 518

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

Upvotes: 1

Related Questions