Search code examples
shellcurlapache-flexchef-infra

Getting error while running curl command via chef


While running curl command using chef getting error. Block which I am trying to execute:

bash 'create_aemadmin' do
  code <<-EOF
    curl -u admin:admin -FcreateUser=aemadmin -FauthorizableId=aemadmin -Frep:password=#{node['aem_vm_cookbook']['aem_api_auth']['password']} -Fprofile/familyName=aemadmin http://#{node['aem_vm_cookbook']['host_name']}:8080/libs/granite/security/post/authorizables
  EOF
    not_if { File.exist?('/home/aemadmin/dce/aemadminusercreate') }
  end

Error which i am getting for this:

/bin/chef-client:162:in `<main>'
[2020-09-09T01:48:24-05:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: bash[create_aemadmin] (aem_vm_cookbook::default line 455) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of "bash"  "/tmp/chef-script20200909-12267-2dd1ke" ----
STDOUT: 
STDERR: curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
---- End output of "bash"  "/tmp/chef-script20200909-12267-2dd1ke" ----
Ran "bash"  "/tmp/chef-script20200909-12267-2dd1ke" returned 2

Using this block i am trying to create a user i can see curl is getting values for variable which i am using but it is not able to execute.


Solution

  • Due space issue i was facing this. Now i resolved it