Skip to content

Commit 1786384

Browse files
committed
simplify
1 parent 549cb44 commit 1786384

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

manifests/init.pp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,13 @@
114114
# This workaround is needed because GCP-provisioned SLES images are unregistered BYOS
115115
# without any package repositories configured. Remove this once proper PAYG images are used.
116116
if ($facts['os']['family'] in ['SLES', 'SUSE']) {
117-
exec { 'Add openSUSE repo if no repos exist':
117+
exec { 'Configure zypper repo for SLES':
118118
path => '/bin:/usr/bin:/sbin:/usr/sbin',
119-
command => 'zypper --non-interactive --gpg-auto-import-keys ar http://download.opensuse.org/distribution/leap/15.6/repo/oss/ opensuse-leap-fallback',
120-
unless => "zypper lr | grep -q '|'",
119+
command => 'zypper --non-interactive --gpg-auto-import-keys ar http://download.opensuse.org/distribution/leap/15.6/repo/oss/ opensuse-leap-fallback && zypper --non-interactive --gpg-auto-import-keys refresh',
120+
unless => "zypper lr 2>/dev/null | grep -q 'opensuse-leap-fallback\\|http'",
121121
logoutput => true,
122-
before => Package['java'],
123-
}
124-
125-
exec { 'Refresh zypper repos':
126-
path => '/bin:/usr/bin:/sbin:/usr/sbin',
127-
command => 'zypper --non-interactive --gpg-auto-import-keys refresh',
128-
refreshonly => true,
129-
subscribe => Exec['Add openSUSE repo if no repos exist'],
130-
before => Package['java'],
131122
}
123+
-> Package['java']
132124
}
133125

134126
if $facts['os']['family'] == 'Debian' {

0 commit comments

Comments
 (0)