Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chef_user resource create user error "Mixlib::ShellOut::ShellCommandFailed" #214

Closed
xianlin opened this issue Dec 31, 2017 · 3 comments
Closed

Comments

@xianlin
Copy link

xianlin commented Dec 31, 2017

Cookbook version

2.2.0

Chef-client version

13.6.4

Platform Details

CentOS 7.4

Scenario:

Configure "chef_user" resources failed when configure "chef_org" resource successfully

Steps to Reproduce:

My "Default" recipe

chef_ingredient "chef-server" do
  config <<-EOS
api_fqdn "#{node["fqdn"]}"
ip_version "ipv6"
notification_email "#{node["chef_admin"]}"
nginx["ssl_protocols"] = "TLSv1 TLSv1.1 TLSv1.2"
EOS
  action :install
end

ingredient_config "chef-server" do
  notifies :reconfigure, "chef_ingredient[chef-server]"
end

chef_user "chef-server" do  
    username "admin123"
    first_name "admin"
    last_name "google_admin"
    email "[email protected]"
    password "test123"
end

chef_org "chef-server" do
    org "test_org"
    org_full_name "org_full_name"
    users ['admin123']
end

Expected Result:

Chef organization and user are created

Actual Result:

organization is created but not the user.

Error Message:

[2017-12-31T11:54:33+00:00] ERROR: chef_user[chef-server] (gs_chef_server::default line 21) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[create-user-admin123] (/tmp/kitchen/cache/cookbooks/chef-ingredient/resources/chef_user.rb line 47) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource

Anyone has successfully created user and organization both?

@xianlin
Copy link
Author

xianlin commented Jan 1, 2018

After change the "sensitive" to false and I got the below console output error message:

 Error executing action `create` on resource 'chef_user[chef-server]'
           ================================================================================
           
           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           execute[create-user-admin123] (/tmp/kitchen/cache/cookbooks/chef-ingredient/resources/chef_user.rb line 47) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
           ---- Begin output of chef-server-ctl user-create admin123 admin google_admin [email protected] test123 -f /etc/opscode/users/admin123.pem ----
           STDOUT: 
           STDERR: ERROR: CONFIGURATION ERROR:Specified config file /etc/opscode/pivotal.rb does not exist
           ---- End output of chef-server-ctl user-create admin123 admin google_admin [email protected] test123 -f /etc/opscode/users/admin123.pem ----
           Ran chef-server-ctl user-create admin123 admin google_admin [email protected] test123 -f /etc/opscode/users/admin123.pem returned 1
           

Since I am using Kitchen to test and I am using "policyfile_zero" provisioner, is this the reason the "pivotal.rb" file not found?

@xianlin
Copy link
Author

xianlin commented Jan 1, 2018

I added "immediately" solved the problem. Because the "chef-server-crl reconfigure" should run immediately after install chef-server-core, not at the end of the chef-client run by default.

chef_ingredient "chef-server" do
  config <<-EOS
api_fqdn "#{node["fqdn"]}"
ip_version "ipv6"
notification_email "#{node["chef_admin"]}"
nginx["ssl_protocols"] = "TLSv1 TLSv1.1 TLSv1.2"
EOS
  action :install
end

ingredient_config "chef-server" do
  notifies :reconfigure, "chef_ingredient[chef-server]", :immediately
end

chef_user "chef-server" do  
    username "admin123"
    first_name "admin"
    last_name "google_admin"
    email "[email protected]"
    password "test123"
end

chef_org "chef-server" do
    org "test_org"
    org_full_name "org_full_name"
    admins ['admin123']
    users ['admin123']
end

This issue can be closed. Thanks

@wrightp
Copy link

wrightp commented Jan 8, 2018

Just throwing this out there... Since you are using the chef_user and chef_org infrastructure resources maybe also try the chef_server resource instead of the base resource to install chef server. https://github.com/chef-cookbooks/chef-ingredient#chef_server

@wrightp wrightp closed this as completed Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants