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 windows: log_level should be updated as in client.rb #11658

Conversation

msys-sgarg
Copy link
Contributor

@msys-sgarg msys-sgarg commented Jun 4, 2021

Signed-off-by: smriti sgarg@msystechnologies.com

log_level while being set in client.rb was referring to wrong hash variable

Description

knife bootstrap -o winrm IPaddress -U 'USERNAME' -P 'PASSWORD' -c /.chef/config.rb -N NODENAME -V
" -V " verbose option plays a role in value of final log_level setting in client.rb
To set log_level it searches in config[:config_log_level] which is wrong hash variable, hence file being created with default log_level = auto always it should look for log_level in chef_config[:config_log_level]

Related Issue

#11367

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • [] I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@msys-sgarg msys-sgarg requested review from a team as code owners June 4, 2021 09:44
if config[:config_log_level]
client_rb << %Q{log_level :#{config[:config_log_level]}\n}
if chef_config[:log_level]
client_rb << %Q{log_level :#{chef_config[:log_level]}\n}
else
client_rb << "log_level :auto\n"
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be changed to be the same as the linux/unix code in boostrap_context.rb:

          unless chef_config[:config_log_level].nil? || chef_config[:config_log_level].empty?
            client_rb << %Q{log_level   :#{chef_config[:config_log_level]}\n}
          end

Or else both should be made consistent one way or another.

And it looks like chef_config[:config_log_level] should be used instead of chef_config[:log_level] unless that was deliberate (in which case the boostrap_context.rb should also be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lamont-granquist We have made the changes as per the comment. looks like chef_config[:config_log_level] is working fine in both cases. Thanks

@msys-sgarg msys-sgarg force-pushed the smriti/11367_knife_bootstrap_against_windows_does_not_respect_config_log_level branch from 7fec199 to 571c2a6 Compare June 10, 2021 13:26
Signed-off-by: smriti <sgarg@msystechnologies.com>
@msys-sgarg msys-sgarg force-pushed the smriti/11367_knife_bootstrap_against_windows_does_not_respect_config_log_level branch from 571c2a6 to 4fe60f4 Compare June 10, 2021 13:29
@tas50 tas50 changed the title knife bootstrap window: log_level should be updated as in client.rb knife bootstrap windows: log_level should be updated as in client.rb Jul 28, 2021
@tas50 tas50 merged commit 6f5d793 into chef:master Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants