{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef/issues/5137","repository_url":"https://api.github.com/repos/chef/chef","labels_url":"https://api.github.com/repos/chef/chef/issues/5137/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef/issues/5137/comments","events_url":"https://api.github.com/repos/chef/chef/issues/5137/events","html_url":"https://github.com/chef/chef/issues/5137","id":167373204,"number":5137,"title":"user creation failed because user does not previously exist?","user":{"login":"snebel29","id":9039085,"avatar_url":"https://avatars.githubusercontent.com/u/9039085?v=3","gravatar_id":"","url":"https://api.github.com/users/snebel29","html_url":"https://github.com/snebel29","followers_url":"https://api.github.com/users/snebel29/followers","following_url":"https://api.github.com/users/snebel29/following{/other_user}","gists_url":"https://api.github.com/users/snebel29/gists{/gist_id}","starred_url":"https://api.github.com/users/snebel29/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snebel29/subscriptions","organizations_url":"https://api.github.com/users/snebel29/orgs","repos_url":"https://api.github.com/users/snebel29/repos","events_url":"https://api.github.com/users/snebel29/events{/privacy}","received_events_url":"https://api.github.com/users/snebel29/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-25T14:01:25Z","updated_at":"2016-07-25T14:14:42Z","closed_at":null,"body":"## Description\r\n\r\nuser resource fails to create a local system user because this does not exist within /etc/passwd,  the command issued by chef is usermod\r\n\r\n```\r\nusermod -c 'perundeck user' -u '5011' -m -d '/home/perundeck/perundeck' perundeck returned 6, expected 0\r\n```\r\n\r\n## Chef Version\r\n```\r\nINFO: *** Chef 11.4.4 ***\r\n```\r\n## Platform Version\r\n```\r\n$ cat /etc/redhat-release \r\nCentOS Linux release 7.1.1503 (Core)\r\n```\r\n## Replication Case\r\n\r\nCreate cookbook with a default recipe and the following code\r\n\r\n```\r\n##### Create the new local user\r\n\r\nusername = 'perundeck'\r\nuid = 5011\r\n\r\nuser \"#{username}\" do\r\n  action :create\r\n  supports :manage_home => true\r\n  comment \"#{username} user\"\r\n  uid uid\r\n  home \"/home/perundeck/#{username}\"\r\n  shell '/bin/bash'\r\n  system true\r\nend\r\n```\r\n\r\nrun sudo chef-client\r\n\r\n## Client Output\r\n\r\n```\r\n  * user[perundeck] action create[2016-07-25T06:05:36-07:00] INFO: Processing user[perundeck] action create (ask-pedeploy-test::default line 56)\r\n\r\n================================================================================\r\nError executing action `create` on resource 'user[perundeck]'\r\n================================================================================\r\n\r\n\r\nChef::Exceptions::Exec\r\n----------------------\r\nusermod -c 'perundeck user' -u '5011' -m -d '/home/perundeck/perundeck' perundeck returned 6, expected 0\r\n\r\n\r\nResource Declaration:\r\n---------------------\r\n# In /var/chef/cache/cookbooks/ask-pedeploy-test/recipes/default.rb\r\n\r\n 56: user \"#{username}\" do\r\n 57:   action :create\r\n 58:   supports :manage_home => true\r\n 59:   comment \"#{username} user\"\r\n 60:   uid uid\r\n 61:   home \"/home/perundeck/#{username}\"\r\n 62:   shell '/bin/bash'\r\n 63:   system true\r\n 64: end\r\n 65: \r\n\r\n\r\n\r\nCompiled Resource:\r\n------------------\r\n# Declared in /var/chef/cache/cookbooks/ask-pedeploy-test/recipes/default.rb:56:in `from_file'\r\n\r\nuser(\"perundeck\") do\r\n  action [:create]\r\n  supports {:manage_home=>true}\r\n  retries 0\r\n  retry_delay 2\r\n  username \"perundeck\"\r\n  comment \"perundeck user\"\r\n  uid 5011\r\n  home \"/home/perundeck/perundeck\"\r\n  shell \"/bin/bash\"\r\n  system true\r\n  cookbook_name \"ask-pedeploy-test\"\r\n  recipe_name \"default\"\r\nend\r\n\r\n\r\n\r\n[2016-07-25T06:05:36-07:00] INFO: Running queued delayed notifications before re-raising exception\r\n[2016-07-25T06:05:36-07:00] ERROR: Running exception handlers\r\n[2016-07-25T06:05:36-07:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json\r\n[2016-07-25T06:05:36-07:00] ERROR: Exception handlers complete\r\nChef Client failed. 0 resources updated\r\n[2016-07-25T06:05:36-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out\r\n[2016-07-25T06:05:36-07:00] FATAL: Chef::Exceptions::Exec: user[perundeck] (ask-pedeploy-test::default line 56) had an error: Chef::Exceptions::Exec: usermod -c 'perundeck user' -u '5011' -m -d '/home/perundeck/perundeck' perundeck returned 6, expected 0\r\n[rundeck@development-rundeck001iad rundeck-resource-generator-from-chef]$ sudo usermod -c 'perundeck user' -u '5011' -m -d '/home/perundeck/perundeck' perundeck\r\nusermod: user 'perundeck' does not exist in /etc/passwd\r\n[rundeck@development-rundeck001iad rundeck-resource-generator-from-chef]$ echo $?\r\n6\r\n```\r\n\r\n## Stacktrace\r\n\r\n```\r\nGenerated at 2016-07-25 06:05:36 -0700\r\nChef::Exceptions::Exec: user[perundeck] (ask-pedeploy-test::default line 56) had an error: Chef::Exceptions::Exec: usermod -c 'perundeck user' -u '5011' -m -d '/home/perundeck/perundeck' perundeck returned 6, expected 0\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/mixin/command.rb:128:in `handle_command_failures'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/mixin/command.rb:75:in `run_command'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/provider/user/useradd.rb:40:in `manage_user'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/provider/user.rb:129:in `block in action_create'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/mixin/why_run.rb:52:in `call'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/mixin/why_run.rb:52:in `add_action'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/provider.rb:151:in `converge_by'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/provider/user.rb:128:in `action_create'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/provider.rb:114:in `run_action'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource.rb:606:in `run_action'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/runner.rb:50:in `run_action'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/runner.rb:82:in `block (2 levels) in converge'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/runner.rb:82:in `each'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/runner.rb:82:in `block in converge'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource_collection.rb:94:in `block in execute_each_resource'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/resource_collection.rb:92:in `execute_each_resource'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/runner.rb:81:in `converge'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/client.rb:404:in `converge'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/client.rb:469:in `do_run'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/client.rb:200:in `run'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application.rb:190:in `run_chef_client'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application/client.rb:297:in `block in run_application'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application/client.rb:290:in `loop'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application/client.rb:290:in `run_application'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application.rb:73:in `run'\r\n/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.4/bin/chef-client:26:in `<top (required)>'\r\n/bin/chef-client:23:in `load'\r\n/bin/chef-client:23:in `<main>'\r\n```"},"comment":{"url":"https://api.github.com/repos/chef/chef/issues/comments/234965212","html_url":"https://github.com/chef/chef/issues/5137#issuecomment-234965212","issue_url":"https://api.github.com/repos/chef/chef/issues/5137","id":234965212,"user":{"login":"snebel29","id":9039085,"avatar_url":"https://avatars.githubusercontent.com/u/9039085?v=3","gravatar_id":"","url":"https://api.github.com/users/snebel29","html_url":"https://github.com/snebel29","followers_url":"https://api.github.com/users/snebel29/followers","following_url":"https://api.github.com/users/snebel29/following{/other_user}","gists_url":"https://api.github.com/users/snebel29/gists{/gist_id}","starred_url":"https://api.github.com/users/snebel29/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snebel29/subscriptions","organizations_url":"https://api.github.com/users/snebel29/orgs","repos_url":"https://api.github.com/users/snebel29/repos","events_url":"https://api.github.com/users/snebel29/events{/privacy}","received_events_url":"https://api.github.com/users/snebel29/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T14:14:42Z","updated_at":"2016-07-25T14:14:42Z","body":"Hi,\r\nIn my organization we still have thousands of nodes using this \"legacy\" version of chef-client, even if user creation works with a newer version won't fix my problem as I can't just upgrade the whole infrastructure.\r\n\r\nIf 11.4.4 is not supported anymore I'll create the user using a bash command.\r\n\r\nThanks"}}
{"actor":{"display_login":"snebel29"}}