|
106 | 106 | } |
107 | 107 |
|
108 | 108 | if $facts['os']['name'] == 'SLES' { |
109 | | - # Enable legacy repo to install apache2-mod_php7 package |
110 | | - # if SUSE OS major version is >= 15 and minor version is > 3 |
111 | | - if ($_package_name == 'apache2-mod_php7' and versioncmp($facts['os']['release']['major'], '15') >= 0 and versioncmp($facts['os']['release']['minor'], '3') == 1) { |
112 | | - exec { 'enable legacy repos': |
113 | | - path => '/bin:/usr/bin/:/sbin:/usr/sbin', |
114 | | - command => "SUSEConnect --product sle-module-legacy/${facts['os']['release']['major']}.${facts['os']['release']['minor']}/x86_64", |
115 | | - unless => "SUSEConnect --status-text | grep sle-module-legacy/${facts['os']['release']['major']}.${facts['os']['release']['minor']}/x86_64", |
116 | | - } |
| 109 | + # TEMPORARY FIX: Configure fallback repo for unregistered SLES systems |
| 110 | + # GCP BYOS images have zero repos configured, SUSEConnect doesn't work |
| 111 | + # Use version-appropriate repos: Leap 42.3 for SLES 12 (PHP 5), Leap 15.6 for SLES 15 (PHP 7) |
| 112 | + if versioncmp($facts['os']['release']['major'], '15') >= 0 { |
| 113 | + $repo_url = 'http://download.opensuse.org/distribution/leap/15.6/repo/oss/' |
| 114 | + } else { |
| 115 | + # SLES 12 needs older repo with PHP 5 support |
| 116 | + $repo_url = 'http://download.opensuse.org/distribution/leap/42.3/repo/oss/' |
| 117 | + } |
| 118 | + |
| 119 | + exec { 'Configure zypper repo for SLES mod_php': |
| 120 | + path => '/bin:/usr/bin:/sbin:/usr/sbin', |
| 121 | + command => "zypper --non-interactive --gpg-auto-import-keys ar ${repo_url} opensuse-leap-fallback && zypper --non-interactive --gpg-auto-import-keys refresh", |
| 122 | + unless => "zypper lr 2>/dev/null | grep -q 'opensuse-leap-fallback\\|http'", |
| 123 | + logoutput => true, |
117 | 124 | } |
118 | 125 |
|
119 | 126 | ::apache::mod { $mod: |
|
122 | 129 | lib => "mod_${mod}.so", |
123 | 130 | id => $_module_id, |
124 | 131 | path => "${apache::lib_path}/mod_${mod}.so", |
| 132 | + require => Exec['Configure zypper repo for SLES mod_php'], |
125 | 133 | } |
126 | 134 | } else { |
127 | 135 | ::apache::mod { $mod: |
|
0 commit comments