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

Knife bootstrap is not uploading the secret file specified by --secret-file on Windows #9018

Closed
AMC-7 opened this issue Oct 23, 2019 · 2 comments · Fixed by #10577
Closed

Comments

@AMC-7
Copy link

AMC-7 commented Oct 23, 2019

Description

We have recently upgraded to using version 15.3.14, from version 14 and have found that when bootstrapping a windows node the secret file is not being uploaded when specified using the --secret-file <PATH TO FILE> parameter, but supplying the raw contents using the --secret <SECRET> parameter it is.

Confirmed the secret file does exist in the location specified by the --secret-file <PATH TO FILE> parameter.

Chef Version

15.3.14

Platform Version

windows 10.0.14393

Replication Case

Doesn't work (doesn't upload the secret file to C:\chef\encrypted_data_bag_secret):
knife bootstrap winrm://<IP ADDRESS> -U 'USER' -P 'PASS' -E PROD -y -N NODE_NAME -F json --secret-file '<PATH TO SECRET FILE>' --node-ssl-verify-mode none --bootstrap-version 15.3.14 --chef-license accept

Does work (file is created and contents copied):
knife bootstrap winrm://<IP ADDRESS> -U 'USER' -P 'PASS' -E PROD -y -N NODE_NAME -F json --secret '<SECRET>' --node-ssl-verify-mode none --bootstrap-version 15.3.14 --chef-license accept

Client Output

C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/encrypted_data_bag_item.rb:134:in `load_secret'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/dsl/data_query.rb:69:in `data_bag_item'
c:/chef/cache/cookbooks/custom_cookbook1/recipes/default.rb:26:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/cookbook_version.rb:199:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:393:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:349:in `block in include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
c:/chef/cache/cookbooks/custom_cookbook2/recipes/windows.rb:23:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/cookbook_version.rb:199:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:393:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:349:in `block in include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
c:/chef/cache/cookbooks/custom_cookbook2/recipes/default.rb:15:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/cookbook_version.rb:199:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:393:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:349:in `block in include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
c:/chef/cache/cookbooks/custom_cookbook3/recipes/default.rb:23:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/cookbook_version.rb:199:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:393:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:349:in `block in include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:348:in `include_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
c:/chef/cache/cookbooks/custom_cookbook4/recipes/default.rb:8:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/mixin/from_file.rb:34:in `from_file'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/cookbook_version.rb:199:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:393:in `load_recipe'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:166:in `block in compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:163:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:163:in `compile_recipes'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:79:in `compile'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/run_context.rb:223:in `load'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/policy_builder/expand_node_object.rb:103:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/2.6.0/forwardable.rb:230:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/client.rb:488:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/client.rb:285:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/application.rb:320:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/application.rb:296:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/local_mode.rb:42:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/application.rb:279:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/application/base.rb:330:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.3.14-universal-mingw32/lib/chef/application.rb:69:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-bin-15.3.14/bin/chef-client:25:in `<top (required)>'
C:/opscode/chef/bin/chef-client:176:in `load'
C:/opscode/chef/bin/chef-client:176:in `<main>'

Stacktrace

No secret specified and no secret found at C:\chef\encrypted_data_bag_secret

@AMC-7 AMC-7 added the Status: Untriaged An issue that has yet to be triaged. label Oct 23, 2019
@lamont-granquist lamont-granquist added Focus: knife bootstrap Priority: Critical Fix immediately Status: Sustaining Backlog Type: Regression It used to work, now it doesn't. and removed Status: Untriaged An issue that has yet to be triaged. labels Oct 23, 2019
@danielcbright
Copy link

I can confirm this is still an ongoing issue

@mwrock
Copy link
Member

mwrock commented Oct 29, 2020

#10577 should fix this. I think since this issue was filed --secret is busted in addition to --secret-file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants