From b714378dd86add422725ac60b79566e8deee38a3 Mon Sep 17 00:00:00 2001 From: Thomas Lacroix Date: Mon, 26 Aug 2019 14:33:01 +0200 Subject: [PATCH] Adds policy name in node details when available --- features/node.feature | 14 +++++++++++++- views/node.erb | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/features/node.feature b/features/node.feature index fb1a54e..c03c6d4 100644 --- a/features/node.feature +++ b/features/node.feature @@ -6,6 +6,7 @@ Background: { "nodes": { "some-node-name": { + "chef_environment": "production", "automatic": { "fqdn": "some-node-name.example.com", "ipaddress": "1.2.3.4", @@ -19,13 +20,24 @@ Background: "another-node-name": { "automatic": { "fqdn": "another-node-name.example.com", - "ipaddress": "1.2.3.5" + "ipaddress": "1.2.3.5", + "policy_name": "my-policy" } } } } """ +Scenario: Show main attributes without policy + When I visit "/node/some-node-name" + Then I can't see "Policy:" + And I can see "Environment: production" + +Scenario: Show main attributes with policy + When I visit "/node/another-node-name" + Then I can see "Policy: my-policy" + And I can see "Environment: _default" + Scenario: List of node attributes When I visit "/node/some-node-name" Then I can see "$.automatic.records[0]" diff --git a/views/node.erb b/views/node.erb index fb64b2d..8c5def0 100644 --- a/views/node.erb +++ b/views/node.erb @@ -5,6 +5,9 @@

<%= node[:automatic][:fqdn] %> (<%= node[:automatic][:ipaddress] %>)

Environment: <%= node.chef_environment %>

+<% if attributes[:policy_name] && !attributes[:policy_name].empty? -%> +

Policy: <%= attributes[:policy_name] %>

+<% end -%> <% if attributes[:tags] && !attributes[:tags].empty? -%>

Tags: