From 87bcfe3428967a715f58a3934b6f0a1044cc3ab4 Mon Sep 17 00:00:00 2001 From: William Yardley Date: Wed, 6 Sep 2017 11:56:26 -0700 Subject: [PATCH] Switch to 'contain' vs. anchor pattern, and use Class['foo'] vs Class['::foo'] --- manifests/init.pp | 40 +++++++++++++---------------------- spec/classes/rabbitmq_spec.rb | 2 -- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 9072b7d31..27335f024 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -151,45 +151,41 @@ } } - include '::rabbitmq::install' - include '::rabbitmq::config' - include '::rabbitmq::service' - include '::rabbitmq::management' + contain '::rabbitmq::install' + contain '::rabbitmq::config' + contain '::rabbitmq::service' + contain '::rabbitmq::management' if $admin_enable and $service_manage { include '::rabbitmq::install::rabbitmqadmin' rabbitmq_plugin { 'rabbitmq_management': ensure => present, - require => Class['rabbitmq::install'], notify => Class['rabbitmq::service'], provider => 'rabbitmqplugins', } - Class['::rabbitmq::service'] -> Class['::rabbitmq::install::rabbitmqadmin'] - Class['::rabbitmq::install::rabbitmqadmin'] -> Rabbitmq_exchange<| |> + Class['rabbitmq::service'] -> Class['rabbitmq::install::rabbitmqadmin'] + Class['rabbitmq::install::rabbitmqadmin'] -> Rabbitmq_exchange<| |> } if $stomp_ensure { rabbitmq_plugin { 'rabbitmq_stomp': - ensure => present, - require => Class['rabbitmq::install'], - notify => Class['rabbitmq::service'], + ensure => present, + notify => Class['rabbitmq::service'], } } if ($ldap_auth) { rabbitmq_plugin { 'rabbitmq_auth_backend_ldap': - ensure => present, - require => Class['rabbitmq::install'], - notify => Class['rabbitmq::service'], + ensure => present, + notify => Class['rabbitmq::service'], } } if ($config_shovel) { rabbitmq_plugin { 'rabbitmq_shovel': ensure => present, - require => Class['rabbitmq::install'], notify => Class['rabbitmq::service'], provider => 'rabbitmqplugins', } @@ -197,24 +193,18 @@ if ($admin_enable) { rabbitmq_plugin { 'rabbitmq_shovel_management': ensure => present, - require => Class['rabbitmq::install'], notify => Class['rabbitmq::service'], provider => 'rabbitmqplugins', } } } - # Anchor this as per #8040 - this ensures that classes won't float off and - # mess everything up. You can read about this at: - # http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues - anchor { 'rabbitmq::begin': } - anchor { 'rabbitmq::end': } - - Anchor['rabbitmq::begin'] -> Class['::rabbitmq::install'] - -> Class['::rabbitmq::config'] ~> Class['::rabbitmq::service'] - -> Class['::rabbitmq::management'] -> Anchor['rabbitmq::end'] + Class['rabbitmq::install'] + -> Class['rabbitmq::config'] + ~> Class['rabbitmq::service'] + -> Class['rabbitmq::management'] # Make sure the various providers have their requirements in place. - Class['::rabbitmq::install'] -> Rabbitmq_plugin<| |> + Class['rabbitmq::install'] -> Rabbitmq_plugin<| |> } diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 7dcda98fb..322a907c5 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -197,7 +197,6 @@ it 'we enable the admin interface by default' do is_expected.to contain_class('rabbitmq::install::rabbitmqadmin') is_expected.to contain_rabbitmq_plugin('rabbitmq_management').with( - 'require' => 'Class[Rabbitmq::Install]', 'notify' => 'Class[Rabbitmq::Service]' ) is_expected.to contain_archive('rabbitmqadmin').with_source('http://1.1.1.1:15672/cli/rabbitmqadmin') @@ -209,7 +208,6 @@ it 'we enable the admin interface by default' do is_expected.to contain_class('rabbitmq::install::rabbitmqadmin') is_expected.to contain_rabbitmq_plugin('rabbitmq_management').with( - 'require' => 'Class[Rabbitmq::Install]', 'notify' => 'Class[Rabbitmq::Service]' ) is_expected.to contain_archive('rabbitmqadmin').with_source('http://127.0.0.1:15672/cli/rabbitmqadmin')