Skip to content

Commit

Permalink
Merge pull request #192 from jcpunk/puppet-lint
Browse files Browse the repository at this point in the history
Resolve puppet-lint
  • Loading branch information
bastelfreak committed Oct 24, 2020
2 parents b52c2ee + f212a0c commit 308ac13
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions manifests/versionlock.pp
Expand Up @@ -69,7 +69,9 @@

if $facts['package_provider'] == 'yum' 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.")
# lint:endignore
}

$_versionlock = "${line_prefix}${name}"
Expand Down
25 changes: 24 additions & 1 deletion types/rpmarch.pp
@@ -1,4 +1,27 @@
# @summary Valid rpm architectures.
# Output of `rpm -q --queryformat '%{arch}\n' package`
# @see https://github.com/rpm-software-management/rpm/blob/master/rpmrc.in
type Yum::RpmArch = Enum['noarch', 'x86_64', 'i386', 'arm', 'ppc64', 'ppc64le', 'sparc64', 'ia64' ,'alpha' , 'ip' , 'm68k', 'mips', 'mipsel' , 'mk68k' , 'mint' , 'ppc', 'rs6000' , 's390', 's390x' , 'sh', 'sparc', 'xtensa']
type Yum::RpmArch = Enum[
'noarch',
'x86_64',
'i386',
'arm',
'ppc64',
'ppc64le',
'sparc64',
'ia64',
'alpha',
'ip',
'm68k',
'mips',
'mipsel',
'mk68k',
'mint',
'ppc',
'rs6000',
's390',
's390x',
'sh',
'sparc',
'xtensa',
]
6 changes: 6 additions & 0 deletions types/versionlockstring.pp
Expand Up @@ -15,8 +15,10 @@
# RELEASE: Any valid release string. Only limitation is that it is not a dash (`-`)
# type Yum::PackageRelease = Regexp[/[^-]+/]
#
# lint:ignore:140chars
# ARCH: Matches a string such as `el7.x86_64`. This is actuall two sub-expressions. See below.
# type Yum::PackageArch = Regexp[/([0-9a-zZ-Z_\*]+)(?:\.(noarch|x86_64|i386|arm|ppc64|ppc64le|sparc64|ia64|alpha|ip|m68k|mips|mipsel|mk68k|mint|ppc|rs6000|s390|s390x|sh|sparc|xtensa|\*))?/]
# lint:endignore
#
# The `%{ARCH}` sub-expression is composed of two sub-expressions
# separated by a dot (`.`), where the second part is optional. The RPM
Expand All @@ -26,8 +28,10 @@
# DistTag: Any string consiting of only letters, numbers, or an underscore, e.g., `el6`, `sl7`, or `fc24`.
# type Yum::PackageDistTag = Regexp[/[0-9a-zZ-Z_\*]+/]
#
# lint:ignore:140chars
# BuildArch: Any string from the list at https://github.com/rpm-software-management/rpm/blob/master/rpmrc.in. Strings are roughly listed from most common to least common to improve performance.
# type Yum::PackageBuildArch = Regexp[/noarch|x86_64|i386|arm|ppc64|ppc64le|sparc64|ia64|alpha|ip|m68k|mips|mipsel|mk68k|mint|ppc|rs6000|s390|s390x|sh|sparc|xtensa/]
# lint:endignore
#
# @note Each field may contain wildcard characters (`*`), but the
# wildcard characters may not span the fields, may not cover the
Expand All @@ -40,4 +44,6 @@
# @example An invalid string (wildcard spans the VERSION and RELEASE fields): `0:bash-4.*-el6.x86_64
# @example An invlaid string (wildcard spans the VERSION, RELEASE, and ARCH fields): `0:bash-*`
#
# lint:ignore:140chars
type Yum::VersionlockString = Pattern[/^([0-9\*]+):([0-9a-zA-Z\._\+%\{\}\*-]+)-([^-]+)-([^-]+)\.(([0-9a-zZ-Z_\*]+)(?:\.(noarch|x86_64|i386|arm|ppc64|ppc64le|sparc64|ia64|alpha|ip|m68k|mips|mipsel|mk68k|mint|ppc|rs6000|s390|s390x|sh|sparc|xtensa|\*))?)$/]
# lint:endignore

0 comments on commit 308ac13

Please sign in to comment.