From 2c7e877e581153ddc17dfd976b0779b3ccebf315 Mon Sep 17 00:00:00 2001 From: David J Peacock Date: Wed, 26 Sep 2018 12:24:34 -0400 Subject: [PATCH] adding deployment_type fact in support We have added a deployment_type fact to indicate when puppet is being executed within a container. Change-Id: I5270778a7c4da2c383cf98c746b77c9b210e9ba0 Related-Bug: #1761624 Needed-By: https://review.openstack.org/#/c/559182/ --- manifests/fencing.pp | 2 +- .../profile/base/database/mysql/client.pp | 2 +- ...profile_base_database_mysql_client_spec.rb | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/manifests/fencing.pp b/manifests/fencing.pp index 81e49b4aa..ad952a61a 100644 --- a/manifests/fencing.pp +++ b/manifests/fencing.pp @@ -67,7 +67,7 @@ class tripleo::fencing( $all_devices = $config['devices'] - if $::uuid != 'docker' { + if $::uuid != 'docker' and $::deployment_type != 'containers' { $xvm_devices = local_fence_devices('fence_xvm', $all_devices) create_resources('pacemaker::stonith::fence_xvm', $xvm_devices, $common_params) } diff --git a/manifests/profile/base/database/mysql/client.pp b/manifests/profile/base/database/mysql/client.pp index 7669a4f74..9e76f81fe 100644 --- a/manifests/profile/base/database/mysql/client.pp +++ b/manifests/profile/base/database/mysql/client.pp @@ -82,7 +82,7 @@ class tripleo::profile::base::database::mysql::client ( # present in the base image but installed as a package afterwards), # create it. We do not want to touch the permissions in case it already # exists due to the mariadb server package being pre-installed - if $::uuid == 'docker' { + if $::uuid == 'docker' or $::deployment_type == 'containers' { # When generating configuration with docker-puppet, services do # not include any profile that would ensure creation of /etc/my.cnf.d, # so we enforce the check here. diff --git a/spec/classes/tripleo_profile_base_database_mysql_client_spec.rb b/spec/classes/tripleo_profile_base_database_mysql_client_spec.rb index 342d389bd..060e927bf 100644 --- a/spec/classes/tripleo_profile_base_database_mysql_client_spec.rb +++ b/spec/classes/tripleo_profile_base_database_mysql_client_spec.rb @@ -66,6 +66,28 @@ describe 'tripleo::profile::base::database::mysql::client' do } end + context 'with defaults with deployment_type' do + let (:params) do + { :step => 1 } + end + + before (:each) do + facts.merge!({ :uuid => 'notdocker', :deployment_type => 'containers' }) + end + + it { + is_expected.to contain_file('/etc/my.cnf.d').with(:ensure => 'directory') + is_expected.to contain_augeas('tripleo-mysql-client-conf').with( + :incl => '/etc/my.cnf.d/tripleo.cnf', + :changes => [ + 'rm tripleo/bind-address', + 'rm tripleo/ssl', + 'rm tripleo/ssl-ca' + ] + ) + } + end + context 'with ip address set to "" LP#1748180' do let (:params) do { :step => 1,