diff options
author | Tim Smith <tsmith@chef.io> | 2020-03-06 16:12:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 16:12:38 -0800 |
commit | 70026494578a331c68eda10eebd3ca5f74ab7573 (patch) | |
tree | c690e834a9836ce1f3eb47189ef9bcf872ea11c8 | |
parent | 78bb0d404f632f1bf3c0f74022010366d8aac18c (diff) | |
parent | e23fb9955df4657af4e6aace0c9b7316d5660da6 (diff) | |
download | chef-70026494578a331c68eda10eebd3ca5f74ab7573.tar.gz |
Merge pull request #9460 from chef/use_cloud_attributes
Use Ohai's cloud attributes in knife node / status presenters
-rw-r--r-- | lib/chef/knife/core/node_presenter.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife/core/status_presenter.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb index 258a4822fd..be01b39728 100644 --- a/lib/chef/knife/core/node_presenter.rb +++ b/lib/chef/knife/core/node_presenter.rb @@ -94,8 +94,8 @@ class Chef def summarize(data) if data.is_a?(Chef::Node) node = data - # special case ec2 with their split horizon whatsis. - ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress] + # special case clouds with their split horizon whatsis. + ip = (node[:cloud] && node[:cloud][:public_ipv4_addrs] && node[:cloud][:public_ipv4_addrs].first) || node[:ipaddress] summarized = <<~SUMMARY #{ui.color("Node Name:", :bold)} #{ui.color(node.name, :bold)} diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb index b33bd95da4..32ea605e70 100644 --- a/lib/chef/knife/core/status_presenter.rb +++ b/lib/chef/knife/core/status_presenter.rb @@ -95,9 +95,9 @@ class Chef summarized = "" list.each do |data| node = data - # special case ec2 with their split horizon whatsis. - ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress] - fqdn = (node[:ec2] && node[:ec2][:public_hostname]) || node[:fqdn] + # special case clouds with their split horizon whatsis. + ip = (node[:cloud] && node[:cloud][:public_ipv4_addrs] && node[:cloud][:public_ipv4_addrs].first) || node[:ipaddress] + fqdn = (node[:cloud] && node[:cloud][:public_hostname]) || node[:fqdn] name = node["name"] || node.name if config[:run_list] |