chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

knife winrm --attribute default from knife[:attribute] overlaps with knife node show #290

Closed hh closed 8 years ago

hh commented 9 years ago

Given a knife.rb with:

knife[:attribute] = 'cloud.public_ipv4'

I can run knife winrm name:foo without specifying -a or --attribute to set the hostname/ip.

However using that same knife.rb if I run knife node show foo it defaults to showing only that attribute.

[hh@mba provisioning]$ knife winrm name:windows-node  hostname
111.222.333.444 WIN-2U5H33KVULV
111.222.333.444 
$ knife node show windows-node
windows-node:
  cloud.public_ipv4: 111.222.333.444
$ grep attribute .chef/knife.rb 
knife[:attribute] = 'cloud.public_ipv4'
mwrock commented 9 years ago

Any reason why you filed this here in knife-windows? This does not strike me as a bug of knife-windows or maybe even a bug at all. I do see how it could be annoying but its a byproduct of how knife deals with config settings.

see https://github.com/chef/chef/blob/master/lib/chef/knife.rb#L310

One way to address that here would be to introduce a different argument name altogether for knife winrm but that would need to be mirrored in knife ssh.

I'm going to close for now but please feel free to reopen if you feel this needs further discussion in knife-windows.

hh commented 9 years ago
As a knife winrm/ssh user
When I put "knife[:{ssh,winrm}-attribute] = X" in knife.rb
Then the default connection host should come from attribute X
And it should have no affect on the output "knife node show" command

I think we should use a different attribute for knife winrm around https://github.com/chef/knife-windows/blob/master/lib/chef/knife/winrm_shared_options.rb#L37

Maybe we should open a similar bug against https://github.com/chef/chef/blob/master/lib/chef/knife/ssh.rb#L51

Another approach would be to rename the default knife.rb attribute for knife node show.

hh commented 9 years ago

I don't think I can reopen, can someone with authorization to do so do so? :)

mwrock commented 8 years ago

closing and tracking in #371