From 373b166c02af91f25768faf30235f6e431b8312e Mon Sep 17 00:00:00 2001 From: Phil Friderici Date: Wed, 20 Sep 2023 08:59:33 +0000 Subject: [PATCH] Rename tag parameter to label Remove this error message that pops up when validation the code: puppet-syntax: tag is a metaparam; this value will inherit to all contained resources --- manifests/image.pp | 6 +++--- spec/defines/image_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/image.pp b/manifests/image.pp index 8d0965e..7f48f7a 100644 --- a/manifests/image.pp +++ b/manifests/image.pp @@ -4,15 +4,15 @@ # @param image # TODO: add documentation # -# @param tag +# @param label # TODO: add documentation # define docker::image ( Enum['present', 'absent'] $ensure = 'present', String[1] $image = $name, - String[1] $tag = 'latest', # TODO tag is a metaparameter and needs to get renamed + String[1] $label = 'latest', ) { - $image_real = "${image}:${tag}" + $image_real = "${image}:${label}" $image_cond = "images=`docker images | grep \"${image}\" | awk 'BEGIN{ OFS=\":\" } { print \$1, \$2 }'` && exist='false' && for img in \${images} ; do if [ \${img} == \"${image_real}\" ]; then exist='true' ; fi ; done && test \${exist} == 'true'" #lint:ignore:140chars if $ensure == 'present' { diff --git a/spec/defines/image_spec.rb b/spec/defines/image_spec.rb index 6c3eae2..d12fa0a 100644 --- a/spec/defines/image_spec.rb +++ b/spec/defines/image_spec.rb @@ -61,8 +61,8 @@ end end - context 'with tag set to valid value' do - let(:params) { { tag: '2.4.2' } } + context 'with label set to valid value' do + let(:params) { { label: '2.4.2' } } it { is_expected.to contain_exec('docker_image_test-title_pull').with_command('docker pull test-title:2.4.2') } end