Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package name must be formatted as %{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}, not 'String'. #240

Open
JCW-USDA opened this issue Mar 2, 2022 · 2 comments

Comments

@JCW-USDA
Copy link

JCW-USDA commented Mar 2, 2022

Any insight would be appreciated, thanks.

I have the following code in the manifest -

yum::versionlock { '0:elasticsearch-7.*':  
  ensure => present,
}

I get the following error on a puppet run when calling that line of code:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Package name must be formatted as %{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}, not 'String'. See Yum::Versionlock documentation for details.

Using tag v5.3.1 of this module.

@sbrowne-godaddy
Copy link

sbrowne-godaddy commented Jul 2, 2024

This also occurs on the v7.1.0 tag, on systems where the $::facts['package_provider'] is dnf (rather than yum).

This simple patch has worked for me on EL9 without breaking EL7 operability.

diff --git a/manifests/versionlock.pp b/manifests/versionlock.pp
index 0a6653d..f398dca 100644
--- a/manifests/versionlock.pp
+++ b/manifests/versionlock.pp
@@ -67,7 +67,7 @@ define yum::versionlock (
     default   => '',
   }
 
-  if $facts['package_provider'] == 'yum' and $version =~ Undef {
+  if $facts['package_provider'] in [ 'yum', 'dnf' ] and $version =~ Undef {
     assert_type(Yum::VersionlockString, $name) |$_expected, $actual | {
       # lint:ignore:140chars
       fail("Package name must be formatted as %{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}, not \'${actual}\'. See Yum::Versionlock documentation for details.")

@sbrowne-godaddy
Copy link

sbrowne-godaddy commented Jul 11, 2024

That being said, on an EL9 box i'm testing on now, the format of the lines has changed from:

[epoch]:[name]-[version].[archive]

to

[name]-[epoch]:[version].[archive]

More testing obviously required.
And yes, in man(8) dnf, it shows:

name-[epoch:]version-release.arch
name.arch
name
name-[epoch:]version-release
name-[epoch:]version

As the accepted package naming formats. NEVRA.
This is from the yum man(8) page:

name
name.arch
name-ver
name-ver-rel
name-ver-rel.arch
name-epoch:ver-rel.arch
epoch:name-ver-rel.arch

So, ENVRA is a hang-over from yum on EL6 (and earlier?) doing direct comparisons against the rpm database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants