Skip to content

Commit

Permalink
Fixes #36947 - Support openSUSE Leap 15
Browse files Browse the repository at this point in the history
  • Loading branch information
ananace committed Apr 15, 2024
1 parent c21ac65 commit 287de73
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ if host_param('http-proxy') && host_param('http-proxy-port')
elsif host_param('http-proxy')
extra_args << "proxy=http://" + host_param('http-proxy')
end

subnet = @host.subnet
if subnet.respond_to?(:dhcp_boot_mode?) && subnet.dhcp_boot_mode?
extra_args << "useDHCP=1"
else
extra_args << "netsetup=-dhcp"
extra_args << "ifcfg=*=\"${netX/ip}/#{@host.primary_interface.subnet.cidr},${netX/gateway},${dns},#{@host.domain}\""
end
extra_args << "BOOTIF=01-${netX/mac:hexhyp}"
-%>
echo Trying to ping Gateway: ${netX/gateway}
ping --count 1 ${netX/gateway} || echo Ping to Gateway failed or ping command not available.
Expand All @@ -28,11 +37,6 @@ ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not availa
<% kernel = boot_files_uris[0] -%>
<% initrd = boot_files_uris[1] -%>

<% subnet = @host.subnet -%>
<% if subnet.respond_to?(:dhcp_boot_mode?) && subnet.dhcp_boot_mode? -%>
kernel <%= kernel %> initrd=initrd.img splash=silent install=<%= medium_uri %> autoyast=<%= foreman_url('provision') %> text-mode=1 useDHCP=1 <%= extra_args.join(' ')%>
<% else -%>
kernel <%= kernel %> initrd=initrd.img splash=silent install=<%= medium_uri %> autoyast=<%= foreman_url('provision') %> text-mode=1 useDHCP=0 netsetup=-dhcp ifcfg=*="${netX/ip}/<%= @host.primary_interface.subnet.cidr -%>,${netX/gateway},${dns},<%= @host.domain %>" <%= extra_args.join(' ')%>
<% end -%>
initrd <%= initrd %>
kernel <%= kernel %> initrd=initrd.img splash=silent install=<%= medium_uri %> autoyast=<%= foreman_url('provision') %> text-mode=1 <%= extra_args.join(' ')%>
initrd --name initrd.img <%= initrd %>
boot
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ description: |
-%>
<%
# safemode renderer does not support unary negation
aio_enabled = host_param_true?('enable-puppetlabs-repo') || %w[official-puppet8 official-puppet7].any? { |repo| host_param_true?("enable-#{repo}-repo") }
puppet_enabled = !host_param_true?('skip-puppet-setup') && (host_puppet_server.present? || host_param_true?('force-puppet'))
salt_enabled = host_param('salt_master') ? true : false
os_major = @host.operatingsystem.major.to_i
os_minor = @host.operatingsystem.minor.to_i
primary_interface_identifier = @host.primary_interface.identifier.blank? ? 'eth0' : @host.primary_interface.identifier
primary_interface_subnet = @host.primary_interface.subnet
-%>
Expand All @@ -29,7 +31,9 @@ description: |
<hostname><%= @host.name %></hostname>
<% unless primary_interface_subnet.dhcp_boot_mode? -%>
<dhcp_hostname config:type="boolean">false</dhcp_hostname>
<% if os_major < 12 -%>
<dhcp_resolv config:type="boolean">false</dhcp_resolv>
<% end -%>
<% if @host.domain -%>
<domain><%= @host.domain -%></domain>
<% end -%>
Expand Down Expand Up @@ -96,9 +100,18 @@ description: |
</routing>
<% end -%>
</networking>
<%# NTP client configuration has incompatible changes in Leap 15 -%>
<% if os_major <= 12 || os_major == 42 -%>
<ntp-client>
<% if os_major >= 15 -%>
<ntp_policy>auto</ntp_policy>
<ntp_servers config:type="list">
<ntp_server>
<address><%= host_param('ntp-server') || '0.opensuse.pool.ntp.org' %></address>
<iburst config:type="boolean">false</iburst>
<offline config:type="boolean">true</offline>
</ntp_server>
</ntp_servers>
<ntp_sync>15</ntp_sync>
<% else -%>
<configure_dhcp config:type="boolean">false</configure_dhcp>
<peers config:type="list">
<peer>
Expand All @@ -110,23 +123,21 @@ description: |
</peers>
<start_at_boot config:type="boolean">true</start_at_boot>
<start_in_chroot config:type="boolean">true</start_in_chroot>
</ntp-client>
<% else -%>
<ntp-client>
<ntp_policy>auto</ntp_policy>
<ntp_servers config:type="list">
<ntp_server>
<iburst config:type="boolean">false</iburst>
<address><%= host_param('ntp-server') || '0.opensuse.pool.ntp.org' %></address>
<offline config:type="boolean">true</offline>
</ntp_server>
</ntp_servers>
<ntp_sync>systemd</ntp_sync>
</ntp-client>
<% end -%>
</ntp-client>
<% if ! @dynamic -%>
<%= @host.diskLayout %>
<%= @host.diskLayout %>
<% end -%>
<% if os_major >= 15 -%>
<services-manager>
<default_target>multi-user</default_target>
<services>
<enable config:type="list">
<service>sshd</service>
</enable>
</services>
</services-manager>
<% else -%>
<runlevel>
<default>3</default>
<services config:type="list">
Expand All @@ -136,8 +147,11 @@ description: |
</service>
</services>
</runlevel>
<% end -%>
<software>
<% if os_major < 15 -%>
<base>default</base>
<% end -%>
<patterns config:type="list">
<pattern>base</pattern>
<pattern>enhanced_base</pattern>
Expand All @@ -147,8 +161,12 @@ description: |
<packages config:type="list">
<package>lsb-release</package>
<% if puppet_enabled -%>
<% if aio_enabled -%>
<package>puppet-agent</package>
<% else -%>
<package>rubygem-puppet</package>
<% end -%>
<% end -%>
<% if host_param('additional-packages').present? -%>
<%= host_param('additional-packages').split(" ").collect{|x| "<package>#{x}</package>" }.join("\n") %>
<% end -%>
Expand Down Expand Up @@ -181,6 +199,7 @@ description: |
</pre-scripts>
<% end -%>
<chroot-scripts config:type="list">
<% if os_major < 15 -%>
<script>
<filename>cp-resolv.sh</filename>
<chrooted config:type="boolean">false</chrooted>
Expand All @@ -191,6 +210,7 @@ cp /etc/resolv.conf /mnt/etc
]]>
</source>
</script>
<% end -%>
<script>
<filename>foreman.sh</filename>
<chrooted config:type="boolean">true</chrooted>
Expand Down Expand Up @@ -224,11 +244,60 @@ rm /etc/resolv.conf
</script>
</chroot-scripts>
</scripts>
<% if os_major >= 15 -%>
<firewall>
<enable_firewall config:type="boolean">true</enable_firewall>
<log_denied_packets>off</log_denied_packets>
<default_zone>public</default_zone>
<zones config:type="list">
<zone>
<name>public</name>
<services config:type="list">
<service>ssh</service>
<service>dhcpv6-client</service>
</services>
</zone>
</zones>
</firewall>
<% end -%>
<keyboard>
<keymap>english-us</keymap>
</keyboard>
<timezone>
<hwclock>UTC</hwclock>
<timezone><%= host_param('time-zone') || 'Etc/UTC' %></timezone>
</timezone>
<add-on>
<add_on_others config:type="list">
<% if puppet_enabled && aio_enabled -%>
<%
puppet_repo_url_base = 'https://yum.puppet.com'
if host_param_true?('enable-official-puppet8-repo')
puppet_repo_url = "#{puppet_repo_url_base}/puppet8/sles/#{os_major}/#{@host.architecture}/"
puppet_repo_alias = 'puppet8-release'
elsif host_param_true?('enable-official-puppet7-repo')
puppet_repo_url = "#{puppet_repo_url_base}/puppet7/sles/#{os_major}/#{@host.architecture}/"
puppet_repo_alias = 'puppet7-release'
else
puppet_repo_url = "#{puppet_repo_url_base}/puppet/sles/#{os_major}/#{@host.architecture}/"
puppet_repo_alias = 'puppet-release'
end
-%>
<listentry>
<media_url><![CDATA[<%= puppet_repo_url %>]]></media_url>
<alias><%= puppet_repo_alias %></alias>
<name>Puppet AutoYaST repository</name>
<signature-handling>
<accept_unknown_gpg_key>
<all config:type="boolean">false</all>
<keys config:type="list">
<keyid>7F438280EF8D349F</keyid>
<keyid>4528B6CD9E61EF26</keyid>
</keys>
</accept_unknown_gpg_key>
</signature-handling>
</listentry>
<% end -%>
</add_on_others>
</add-on>
</profile>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description: |
os_name = @host.operatingsystem.name

aio_enabled = host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppet7') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppet6') || host_param_true?('enable-puppetlabs-puppet5-repo') || host_param_true?('enable-puppet5')
aio_available = os_family == 'Debian' || os_family == 'Redhat' || os_name == 'SLES'
aio_available = os_family == 'Debian' || os_family == 'Redhat' || os_family == 'Suse'

if os_family == 'Windows'
var_dir = 'C:\ProgramData\PuppetLabs\puppet\cache'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ echo Trying to ping DNS: ${netX/dns}
ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not available.


kernel http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz initrd=initrd.img splash=silent install=http://mirror.centos.org/centos/7/os/x86_64 autoyast=http://foreman.example.com/unattended/provision text-mode=1 useDHCP=1
initrd http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
kernel http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz initrd=initrd.img splash=silent install=http://mirror.centos.org/centos/7/os/x86_64 autoyast=http://foreman.example.com/unattended/provision text-mode=1 useDHCP=1 BOOTIF=01-${netX/mac:hexhyp}
initrd --name initrd.img http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
boot
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<interfaces config:type="list">
</interfaces>
</networking>
<ntp-client>
<ntp-client>
<configure_dhcp config:type="boolean">false</configure_dhcp>
<peers config:type="list">
<peer>
Expand All @@ -31,7 +31,7 @@
<start_at_boot config:type="boolean">true</start_at_boot>
<start_in_chroot config:type="boolean">true</start_in_chroot>
</ntp-client>
zerombr
zerombr
clearpart --all --initlabel
part /boot --fstype ext3 --size=100 --asprimary
part / --fstype ext3 --size=1024 --grow
Expand Down Expand Up @@ -154,4 +154,8 @@ rm /etc/resolv.conf
<hwclock>UTC</hwclock>
<timezone>Etc/UTC</timezone>
</timezone>
<add-on>
<add_on_others config:type="list">
</add_on_others>
</add-on>
</profile>

0 comments on commit 287de73

Please sign in to comment.