Skip to content

Commit

Permalink
Merge pull request #177 from traylenator/star
Browse files Browse the repository at this point in the history
versionlock must specify at least .* for arch.
  • Loading branch information
bastelfreak authored Jun 27, 2020
2 parents 45e8f58 + 62aebcf commit 07c24b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,11 @@ Default value: '*'

##### `arch`

Data type: `Optional[Variant[Yum::RpmArch, Enum['*']]]`
Data type: `Variant[Yum::RpmArch, Enum['*']]`

Arch of the package if CentOS 8 mechanism is used.

Default value: `undef`
Default value: '*'

##### `epoch`

Expand Down
12 changes: 3 additions & 9 deletions manifests/versionlock.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
Optional[Yum::RpmVersion] $version = undef,
Yum::RpmRelease $release = '*',
Integer[0] $epoch = 0,
Optional[Variant[Yum::RpmArch, Enum['*']]] $arch = undef,
Variant[Yum::RpmArch, Enum['*']] $arch = '*',
) {
require yum::plugin::versionlock

Expand All @@ -85,15 +85,9 @@
fail("Version must be formatted as Yum::RpmVersion, not \'${actual}\'. See Yum::RpmVersion documentation for details.")
}

if $arch {
$_dotarch = ".${arch}"
} else {
$_dotarch = ''
}

$_versionlock = $facts['package_provider'] ? {
'yum' => "${line_prefix}${epoch}:${name}-${version}-${release}${_dotarch}",
default => "${line_prefix}${name}-${epoch}:${version}-${release}${_dotarch}",
'yum' => "${line_prefix}${epoch}:${name}-${version}-${release}.${arch}",
default => "${line_prefix}${name}-${epoch}:${version}-${release}.${arch}",
}

}
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/versionlock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
let(:params) { { version: '4.3' } }

it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("0:bash-4.3-*\n")
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("0:bash-4.3-*.*\n")
end
end

Expand Down Expand Up @@ -141,7 +141,7 @@
let(:params) { { version: '4.3' } }

it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-0:4.3-*\n")
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-0:4.3-*.*\n")
end
context 'and an arch set to x86_64' do
let(:params) { super().merge(arch: 'x86_64') }
Expand All @@ -154,14 +154,14 @@
let(:params) { super().merge(release: '22.5') }

it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-0:4.3-22.5\n")
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-0:4.3-22.5.*\n")
end
end
context 'and an epoch set to 5' do
let(:params) { super().merge(epoch: 5) }

it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-5:4.3-*\n")
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-5:4.3-*.*\n")
end
end
end
Expand Down

0 comments on commit 07c24b7

Please sign in to comment.