From 8d426c658028ffd97cbed74191534cb4feec8a1e Mon Sep 17 00:00:00 2001 From: thomashaw Date: Sun, 14 May 2017 23:04:47 +0100 Subject: [PATCH] services/parameterised_webiste: Business facts can be blank. no manager / employee data will hide the contacts page. --- .../manifests/install.pp | 13 +++--- .../subtemplates/main_container.html.erb | 2 +- .../templates/subtemplates/navbar.html.erb | 2 + scenarios/ctf/nw_cyber_games.xml | 44 ++++++++++++++++--- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/modules/services/unix/http/parameterised_website/manifests/install.pp b/modules/services/unix/http/parameterised_website/manifests/install.pp index 3f51e3cde..b1583f7b5 100644 --- a/modules/services/unix/http/parameterised_website/manifests/install.pp +++ b/modules/services/unix/http/parameterised_website/manifests/install.pp @@ -5,7 +5,8 @@ class parameterised_website::install { # Parse out parameters $business_name = $secgen_parameters['business_name'][0] $business_motto = $secgen_parameters['business_motto'][0] - $manager_profile = parsejson($secgen_parameters['manager_profile'][0]) + $manager_profile = $secgen_parameters['manager_profile'][0] + if $manager_profile != '' { $manager_profile = parsejson($manager_profile) } $business_address = $secgen_parameters['business_address'][0] $office_telephone = $secgen_parameters['office_telephone'][0] $office_email = $secgen_parameters['office_email'][0] @@ -54,10 +55,12 @@ class parameterised_website::install { content => template($index_template), } - # Apply contact page template - file { "$docroot/contact.html": - ensure => file, - content => template('parameterised_website/contact.html.erb'), + if $manager_profile != '' or $business_address != '' or $employees[0] != '' { + # Apply contact page template + file { "$docroot/contact.html": + ensure => file, + content => template('parameterised_website/contact.html.erb'), + } } # Create visible tab html files diff --git a/modules/services/unix/http/parameterised_website/templates/subtemplates/main_container.html.erb b/modules/services/unix/http/parameterised_website/templates/subtemplates/main_container.html.erb index 4231ba544..59636069b 100644 --- a/modules/services/unix/http/parameterised_website/templates/subtemplates/main_container.html.erb +++ b/modules/services/unix/http/parameterised_website/templates/subtemplates/main_container.html.erb @@ -11,7 +11,7 @@

Find the Acceptable Use Policy here.

<% end -%> <% # Externally input / default style -%> - <% else -%> + <% elsif @manager_profile != '' or @employees[0] != '' or @business_address != ''-%>

<%= @business_name %>

<%= @product_name %>

<%= @main_page_paragraph_content.join %>

diff --git a/modules/services/unix/http/parameterised_website/templates/subtemplates/navbar.html.erb b/modules/services/unix/http/parameterised_website/templates/subtemplates/navbar.html.erb index f0a430840..7a1b78e8e 100644 --- a/modules/services/unix/http/parameterised_website/templates/subtemplates/navbar.html.erb +++ b/modules/services/unix/http/parameterised_website/templates/subtemplates/navbar.html.erb @@ -3,7 +3,9 @@