From 379ea164832b2900278acdc1d318990cf683ea04 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Thu, 17 Dec 2015 16:30:27 -0700 Subject: [PATCH] Fix hiera overrides for 8.0 This change updates how we add our hiera override to support the hiera.yaml format change in 8.0 Change-Id: Ib5203ab4684b7840c486aadc3ee3ca13ad1097a9 Related-Bug: #1526502 --- deployment_scripts/rabbitmq_hiera_override.pp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/deployment_scripts/rabbitmq_hiera_override.pp b/deployment_scripts/rabbitmq_hiera_override.pp index e237499..3b77948 100644 --- a/deployment_scripts/rabbitmq_hiera_override.pp +++ b/deployment_scripts/rabbitmq_hiera_override.pp @@ -64,10 +64,20 @@ deploy_vrouter: <%= @deploy_vrouter %> ensure => 'installed', } - file_line {"${plugin_name}_hiera_override": - path => '/etc/hiera.yaml', - line => " - override/${plugin_name}", - after => ' - override/module/%{calling_module}', + # hiera file changes between 7.0 and 8.0 so we need to handle the override the + # different yaml formats via these exec hacks. It should be noted that the + # fuel hiera task will wipe out these this update to the hiera.yaml + exec { "${plugin_name}_hiera_override_7.0": + command => "sed '/ - override\/plugins/a\ - override\/${plugin_name}' /etc/hiera.yaml", + path => '/bin:/usr/bin', + unless => "grep -q '^ - override/${plugin_name}' /etc/hiera.yaml", + onlyif => 'grep -q "^ - override/plugins" /etc/hiera.yaml' } + exec { "${plugin_name}_hiera_override_8.0": + command => "sed '/ - override\/plugins/a\ - override\/${plugin_name}' /etc/hiera.yaml", + path => '/bin:/usr/bin', + unless => "grep -q '^ - override/${plugin_name}' /etc/hiera.yaml", + onlyif => 'grep -q "^ - override/plugins" /etc/hiera.yaml' + } }