diff options
author | danielsdeleo <dan@chef.io> | 2015-09-15 09:57:32 -0700 |
---|---|---|
committer | danielsdeleo <dan@chef.io> | 2015-09-17 14:29:50 -0700 |
commit | 3ca6231a7908e2c54c679c187a46ae10dfe21396 (patch) | |
tree | af5c4d255a80d63c6e5163bec50540a23053f7c8 | |
parent | f21715037c1fc9956738ba069760f3c7615987ce (diff) | |
download | chef-3ca6231a7908e2c54c679c187a46ae10dfe21396.tar.gz |
Show policyfile attributes in node presenter
-rw-r--r-- | lib/chef/knife/core/node_presenter.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb index d1aab592ef..d9ea8c7669 100644 --- a/lib/chef/knife/core/node_presenter.rb +++ b/lib/chef/knife/core/node_presenter.rb @@ -67,7 +67,12 @@ class Chef result = {} result["name"] = node.name - result["chef_environment"] = node.chef_environment + if node.policy_name.nil? && node.policy_group.nil? + result["chef_environment"] = node.chef_environment + else + result["policy_name"] = node.policy_name + result["policy_group"] = node.policy_group + end result["run_list"] = node.run_list result["normal"] = node.normal_attrs @@ -95,11 +100,29 @@ class Chef summarized=<<-SUMMARY #{ui.color('Node Name:', :bold)} #{ui.color(node.name, :bold)} +SUMMARY + show_policy = !(node.policy_name.nil? && node.policy_group.nil?) + if show_policy + summarized << <<-POLICY +#{key('Policy Name:')} #{node.policy_name} +#{key('Policy Group:')} #{node.policy_group} +POLICY + else + summarized << <<-ENV #{key('Environment:')} #{node.chef_environment} +ENV + end + summarized << <<-SUMMARY #{key('FQDN:')} #{node[:fqdn]} #{key('IP:')} #{ip} #{key('Run List:')} #{node.run_list} +SUMMARY + unless show_policy + summarized << <<-ROLES #{key('Roles:')} #{Array(node[:roles]).join(', ')} +ROLES + end + summarized << <<-SUMMARY #{key('Recipes:')} #{Array(node[:recipes]).join(', ')} #{key('Platform:')} #{node[:platform]} #{node[:platform_version]} #{key('Tags:')} #{Array(node[:tags]).join(', ')} |