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

system_hostname fails when no static_hosts specified #53

Closed
bleything opened this issue Jun 28, 2017 · 2 comments
Closed

system_hostname fails when no static_hosts specified #53

bleything opened this issue Jun 28, 2017 · 2 comments
Assignees

Comments

@bleything
Copy link

system_hostname 'test1.ops.sea.example.com'

... will fail with the following stacktrace:

/var/chef/cache/cookbooks/system/providers/hostname.rb:199:in `block in class_from_file'
(eval):2:in `block in action_set'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/provider.rb:211:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/provider.rb:211:in `compile_and_converge_action'
(eval):2:in `action_set'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/provider.rb:171:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/resource.rb:591:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/runner.rb:70:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/runner.rb:98:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/runner.rb:98:in `each'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/runner.rb:98:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/runner.rb:97:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/client.rb:715:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/client.rb:710:in `catch'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/client.rb:710:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/client.rb:749:in `converge_and_save'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/client.rb:286:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:291:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:279:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:279:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:244:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:232:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:450:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:450:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:434:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:58:in `load'
/usr/bin/chef-client:58:in `<main>'

... which points to this block.

I think that adding a default value to that attribute in the resource ought to do the trick... but that brings up a second issue, which is that the docs say that attribute expects an array of hashes, but the attribute itself and the provider which uses it both expect a hash.

@flaccid
Copy link
Contributor

flaccid commented Jun 28, 2017

@bleything can you paste the whole output of the run?

@flaccid flaccid self-assigned this Jun 28, 2017
@flaccid
Copy link
Contributor

flaccid commented Nov 17, 2017

bc3b179 should help iterate over an empty hash instead of nil.

@flaccid flaccid closed this as completed Nov 17, 2017
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