Skip to content

Commit 2d18d15

Browse files
committed
Fixes #38993: add OpenVox repository
* Add OpenVox repository when relevant parameters are in use * Test VoxPupuli repository and Puppet setup snippets when OpenVox parameters are set
1 parent 7269a75 commit 2d18d15

File tree

12 files changed

+372
-3
lines changed

12 files changed

+372
-3
lines changed

app/views/unattended/provisioning_templates/cloud_init/cloud_init_default.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ runcmd:
7777
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
7878
<%= indent(2) { snippet 'puppetlabs_repo' } %>
7979
<% end -%>
80+
<% if host_param_true?('enable-openvox8') || host_param_true?('enable-openvox7') -%>
81+
<%= indent(2) { snippet 'voxpupuli_repo' } %>
82+
<% end -%>
8083
<%= indent(2) { snippet 'puppet_setup' } %>
8184
<% end -%>
8285
phone_home:

app/views/unattended/provisioning_templates/finish/kickstart_default_finish.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ chmod +x /root/remote_execution_pull_setup.sh
8181
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
8282
<%= snippet 'puppetlabs_repo' %>
8383
<% end -%>
84+
<% if host_param_true?('enable-openvox8') || host_param_true?('enable-openvox7') -%>
85+
<%= snippet 'voxpupuli_repo' %>
86+
<% end -%>
8487
<%= snippet 'puppet_setup' %>
8588
<% end -%>
8689

app/views/unattended/provisioning_templates/finish/preseed_default_finish.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ echo 'root:<%= root_pass -%>' | /usr/sbin/chpasswd -e
7575
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
7676
<%= snippet 'puppetlabs_repo' %>
7777
<% end -%>
78+
<% if host_param_true?('enable-openvox8') || host_param_true?('enable-openvox7') -%>
79+
<%= snippet 'voxpupuli_repo' %>
80+
<% end -%>
7881
<%= snippet 'puppet_setup' %>
7982
<% end -%>
8083
<% if salt_enabled -%>

app/views/unattended/provisioning_templates/host_init_config/host_init_config_default.erb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,18 @@ export DEBIAN_FRONTEND=noninteractive
4747
apt-get -y update
4848
<% end -%>
4949

50-
<% if !host_param_true?('skip-puppet-setup') && (host_puppet_server.present? || host_param_true?('force-puppet')) -%>
50+
<%# Install Puppet only if forced and not in conflict with OpenVox %>
51+
<% if host_puppet_server.present? && host_param_true?('force-puppet') && !host_param_true?('force-openvox') -%>
5152
<%= snippet 'puppetlabs_repo' %>
5253
<%= snippet 'puppet_setup' %>
5354
<% end -%>
5455

56+
<%# Otherwise install OpenVox as default (or if forced), unless explicitly skipped %>
57+
<% if !host_param_true?('skip-openvox-setup') && (host_puppet_server.present? || host_param_true?('force-openvox')) -%>
58+
<%= snippet 'voxpupuli_repo' %>
59+
<%= snippet 'puppet_setup' %>
60+
<% end -%>
61+
5562
<% if host_param_true?('host_registration_remote_execution') -%>
5663
<%= snippet 'remote_execution_ssh_keys' %>
5764
<% end -%>

app/views/unattended/provisioning_templates/provision/kickstart_default.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ chmod +x /root/remote_execution_pull_setup.sh
290290
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppetlabs-puppet6-repo')|| host_param_true?('enable-puppetlabs-puppet5-repo') -%>
291291
<%= snippet 'puppetlabs_repo' %>
292292
<% end -%>
293+
<% if host_param_true?('enable-openvox8') || host_param_true?('enable-openvox7') -%>
294+
<%= snippet 'voxpupuli_repo' %>
295+
<% end -%>
293296
<%= snippet 'puppet_setup' %>
294297
<% end -%>
295298

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<%#
2+
kind: snippet
3+
name: voxpupuli_repo
4+
model: ProvisioningTemplate
5+
snippet: true
6+
description: |
7+
Fetches the package that deploys the VoxPupuli repository that can be
8+
used to install OpenVox from. It only performs the installation in case
9+
one of the enable-openvox* parameter is set to true.
10+
It is modeled after puppetlabs_repo snippet.
11+
12+
This template accepts the following parameters:
13+
- enable-openvox7: boolean (default=undef)
14+
Set to true to enable the OpenVox 7 repository appropriate for the OS.
15+
- enable-openvox8: boolean (default=undef)
16+
Set to true to enable the OpenVox 8 repository appropriate for the OS.
17+
- use-openvox-voxpupuli-repo-with-katello: boolean (default=undef)
18+
By default assume that if Katello is in use, OpenVox is delivered through it.
19+
Set to true to use VoxPupuli's OpenVox repository with Katello.
20+
-%>
21+
22+
<%
23+
http_proxy = host_param('http-proxy') ? " --httpproxy #{host_param('http-proxy')}" : nil
24+
http_port = host_param('http-proxy-port') ? " --httpport #{host_param('http-proxy-port')}" : nil
25+
proxy_uri = host_param('http-proxy') ? "http://#{host_param('http-proxy')}:#{host_param('http-proxy-port')}" : nil
26+
proxy_string = proxy_uri ? " -e https_proxy=#{proxy_uri}/" : ''
27+
proxy_string_bits = proxy_uri ? " -ProxyUsage Override -ProxyList #{proxy_uri}" : ''
28+
os_family = @host.operatingsystem.family
29+
os_major = @host.operatingsystem.major.to_i
30+
os_name = @host.operatingsystem.name
31+
# For Debian/Ubuntu repo name
32+
os_string = @host.operatingsystem.to_s.downcase.gsub(' ', '')
33+
34+
if os_family == 'Redhat'
35+
repo_host = 'yum.voxpupuli.org'
36+
if os_name == 'Amazon Linux'
37+
repo_os = 'amazon'
38+
elsif os_name == 'Fedora'
39+
repo_os = 'fedora'
40+
else
41+
repo_os = 'el'
42+
end
43+
elsif os_family == 'Suse'
44+
repo_host = 'yum.voxpupuli.org'
45+
repo_os = 'sles' # OpenVox repos only exist for SLES, not OpenSUSE
46+
elsif os_family == 'Debian'
47+
repo_host = 'apt.voxpupuli.org'
48+
repo_os = @host.operatingsystem.release_name
49+
end
50+
51+
if host_param_true?('enable-openvox8')
52+
repo_name = 'openvox8-release'
53+
elsif host_param_true?('enable-openvox7')
54+
repo_name = 'openvox7-release'
55+
end
56+
57+
# If Katello is in use, expect OpenVox is delivered through it
58+
if (plugin_present?('katello'))
59+
if host_param_true?('use-openvox-voxpupuli-repo-with-katello')
60+
skip_openvox_repo = false
61+
else
62+
skip_openvox_repo = true
63+
end
64+
else
65+
skip_openvox_repo = false
66+
end
67+
68+
if host_param_true?('enable-openvox8') and host_param_true?('enable-openvox7')
69+
raise "Both 'enable-openvox8' and 'enable-openvox7' are true"
70+
end
71+
-%>
72+
73+
<% if repo_name && !skip_openvox_repo -%>
74+
<% if os_family == 'Redhat' || os_name == 'Amazon Linux' || os_name == 'SLES' -%>
75+
rpm -Uvh<%= http_proxy %><%= http_port %> https://<%= repo_host %>/<%= repo_name %>-<%= repo_os %>-<%= os_major %>.noarch.rpm
76+
<% elsif os_family == 'Debian' -%>
77+
apt-get update
78+
apt-get -y install ca-certificates
79+
wget -O /tmp/<%= repo_name %>-<%= os_string %>.deb<%= proxy_string %> https://<%= repo_host %>/<%= repo_name %>-<%= os_string %>.deb
80+
dpkg -i /tmp/<%= repo_name %>-<%= os_string %>.deb
81+
<% end -%>
82+
<% end -%>

app/views/unattended/provisioning_templates/user_data/autoyast_default_user_data.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ echo 'root:<%= root_pass -%>' | /usr/sbin/chpasswd -e
3434
<% if host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
3535
<%= snippet 'puppetlabs_repo' %>
3636
<% end -%>
37+
<% if host_param_true?('enable-openvox8') || host_param_true?('enable-openvox7') -%>
38+
<%= snippet 'voxpupuli_repo' %>
39+
<% end -%>
3740
<%= snippet 'puppet_setup' %>
3841
<% end -%>
3942

app/views/unattended/provisioning_templates/user_data/kickstart_default_user_data.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ fi
6666
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
6767
<%= snippet 'puppetlabs_repo' %>
6868
<% end -%>
69+
<% if host_param_true?('enable-openvox8') || host_param_true?('enable-openvox7') -%>
70+
<%= snippet 'voxpupuli_repo' %>
71+
<% end -%>
6972
<%= snippet 'puppet_setup' %>
7073
<% end -%>
7174

app/views/unattended/provisioning_templates/user_data/preseed_default_user_data.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ echo 'Acquire::http::Proxy "<%= proxy_uri %>";' >> /etc/apt/apt.conf
4747
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-official-puppet8-repo') || host_param_true?('enable-official-puppet7-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
4848
<%= snippet 'puppetlabs_repo' %>
4949
<% end -%>
50+
<% if host_param_true?('enable-openvox8') || host_param_true?('enable-openvox7') -%>
51+
<%= snippet 'voxpupuli_repo' %>
52+
<% end -%>
5053
<%= snippet 'puppet_setup' %>
5154
<% end -%>
5255

app/views/unattended/provisioning_templates/user_data/userdata_default.erb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ description: |
2020
- ssh_authorized_keys: string w newline seperated keys (default="")
2121
- package_upgrade: boolean (default=false)
2222
- reboot: boolean (default=false)
23-
- skip-puppet-setup: boolean (default=false)
23+
- skip-openvox-setup: boolean (default=false)
24+
- force-puppet: boolean (default=false)
2425
-%>
2526
<%
2627
ssh_pwauth = host_param('ssh_pwauth') ? host_param_true?('ssh_pwauth') : !host_param('ssh_authorized_keys')
2728
rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name != 'Fedora'
2829
# safemode renderer does not support unary negation
29-
puppet_enabled = !host_param_true?('skip-puppet-setup') && (host_puppet_server.present? || host_param_true?('force-puppet'))
30+
openvox_enabled = !host_param_true?('skip-openvox-setup') && (host_puppet_server.present? || host_param_true?('force-openvox'))
31+
# Use force-puppet to keep backward compatibility
32+
puppet_enabled = host_param_true?('force-puppet')
3033
salt_enabled = host_param('salt_master') ? true : false
3134
chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
3235
-%>
@@ -72,6 +75,12 @@ runcmd:
7275
- |
7376
<%= indent(2) { snippet('chef_client') } %>
7477
<% end -%>
78+
<% if openvox_enabled -%>
79+
- |
80+
<%= indent(2) { snippet('voxpupuli_repo') } %>
81+
- |
82+
<%= indent(2) { snippet('puppet_setup') } %>
83+
<% end -%>
7584
<% if puppet_enabled -%>
7685
- |
7786
<%= indent(2) { snippet('puppetlabs_repo') } %>

0 commit comments

Comments
 (0)