From 86834aac70783232251d7d3644a0e944b0e07a84 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 13 Sep 2025 19:42:56 +0900 Subject: [PATCH] Replace anchor by tag Usage of anchor is recently discouraged and is not allowed by lint check by default. Change-Id: Ide6e9ffcc353c2a24afe45e70e641c3a333a2566 Signed-off-by: Takashi Kajinami --- manifests/repo/redhat/redhat.pp | 8 ++--- ...penstack_extras_repo_redhat_redhat_spec.rb | 30 ++++++++----------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/manifests/repo/redhat/redhat.pp b/manifests/repo/redhat/redhat.pp index f5075d3..1635f3e 100644 --- a/manifests/repo/redhat/redhat.pp +++ b/manifests/repo/redhat/redhat.pp @@ -95,18 +95,16 @@ class openstack_extras::repo::redhat::redhat ( 'gpgcheck' => '1', 'mirrorlist' => 'absent', 'notify' => 'Exec[yum_refresh]', - 'require' => 'Anchor[openstack_extras_redhat]', + 'tag' => 'openstack-extras-repo', }, $repo_defaults) $_gpgkey_defaults = stdlib::merge({ 'owner' => 'root', 'group' => 'root', 'mode' => '0644', - 'before' => 'Anchor[openstack_extras_redhat]', + 'tag' => 'openstack-extras-repo', }, $gpgkey_defaults) - anchor { 'openstack_extras_redhat': } - if $manage_rdo { $release_cap = capitalize($release) @@ -156,6 +154,8 @@ class openstack_extras::repo::redhat::redhat ( create_resources('yumrepo', $repo_hash, $_repo_defaults) create_resources('file', $gpgkey_hash, $_gpgkey_defaults) + File<| tag == 'openstack-extras-repo' |> -> Yumrepo<| tag == 'openstack-extras-repo' |> + $repo_source_hash.each |$filename, $url| { file { $filename: ensure => file, diff --git a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb index 4aab122..e825b78 100644 --- a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb +++ b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb @@ -3,14 +3,12 @@ require 'spec_helper' describe 'openstack_extras::repo::redhat::redhat' do shared_examples 'openstack_extras::repo::redhat::redhat' do context 'with default parameters' do - it { should contain_anchor('openstack_extras_redhat') } - it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud').with( :source => 'puppet:///modules/openstack_extras/RPM-GPG-KEY-CentOS-SIG-Cloud', :owner => 'root', :group => 'root', :mode => '0644', - :before => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_yumrepo('rdo-release').with( :baseurl => "http://mirror.stream.centos.org/SIGs/$stream/cloud/$basearch/openstack-epoxy/", @@ -21,7 +19,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :mirrorlist => 'absent', :module_hotfixes => true, :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should_not contain_file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}") } @@ -48,8 +46,6 @@ describe 'openstack_extras::repo::redhat::redhat' do } end - it { should contain_anchor('openstack_extras_redhat') } - it { should_not contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud') } it { should_not contain_yumrepo('rdo-release') } @@ -58,7 +54,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :owner => 'root', :group => 'root', :mode => '0644', - :before => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_yumrepo('epel').with( @@ -70,7 +66,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :gpgcheck => '1', :mirrorlist => 'absent', :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_resources('yumrepo').with_purge(true) } @@ -162,7 +158,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :group => 'root', :mode => '0644', :force => true, - :before => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_yumrepo('rdo-release').with( @@ -171,7 +167,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :mirrorlist => 'absent', :proxy => 'http://example.com:8000', :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}").with( @@ -179,7 +175,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :group => 'root', :mode => '0644', :force => true, - :before => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_yumrepo('epel').with( @@ -188,7 +184,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :mirrorlist => 'absent', :proxy => 'http://example.com:8000', :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_yumrepo('CentOS-Example').with( @@ -197,7 +193,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :mirrorlist => 'absent', :proxy => 'http://example.com:8000', :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-Example').with( @@ -205,7 +201,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :group => 'root', :mode => '0644', :force => true, - :before => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} end @@ -240,7 +236,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS', :mirrorlist => 'absent', :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_yumrepo('CentOS-Updates').with( @@ -251,7 +247,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS', :mirrorlist => 'absent', :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-Something').with( @@ -259,7 +255,7 @@ describe 'openstack_extras::repo::redhat::redhat' do :owner => 'root', :group => 'root', :mode => '0644', - :before => 'Anchor[openstack_extras_redhat]', + :tag => 'openstack-extras-repo', )} end