Skip to content

Commit 4ac2204

Browse files
committed
prevent SUSEconnect command if missing
1 parent e2164a3 commit 4ac2204

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

manifests/init.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@
111111
}
112112

113113
# If the OS is SLES >= 15.3, enable the legacy repo to install net-tools-deprecated package
114+
# Only attempt this if SUSEConnect is available and the system is registered
114115
if ($facts['os']['family'] in ['SLES', 'SUSE']) and (versioncmp($facts['os']['release']['full'], '15.3') >= 0) {
115-
exec { 'Enable legacy repos (major only)':
116+
exec { 'Enable legacy repos':
116117
path => '/bin:/usr/bin:/sbin:/usr/sbin',
117118
command => "SUSEConnect --product sle-module-legacy/${facts['os']['release']['major']}/x86_64",
118-
unless => "SUSEConnect --list-extensions | grep -q 'Legacy Module .* (Activated)'",
119+
unless => "test ! -x /usr/bin/SUSEConnect || SUSEConnect --status-text | grep -qE '(Not Registered|sle-module-legacy/${facts['os']['release']['major']}/x86_64)'",
119120
}
120121
}
121122

0 commit comments

Comments
 (0)