Skip to content

Commit e8601aa

Browse files
committed
Enable IoP
Signed-off-by: Eric D. Helms <ericdhelms@gmail.com>
1 parent 25bb92c commit e8601aa

File tree

7 files changed

+115
-3
lines changed

7 files changed

+115
-3
lines changed

.fixtures.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ fixtures:
2626
puppet_version: '>= 6.0.0'
2727
systemd: "https://github.com/camptocamp/puppet-systemd"
2828
rhsm: "https://github.com/voxpupuli/puppet-rhsm"
29+
podman:
30+
repo: 'https://github.com/ehelms/puppet-podman'
31+
branch: 'allow-disabled-quadlet'
32+
iop: "https://github.com/ehelms/puppet-iop"

manifests/bundle.pp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
String $user = $katello_devel::user,
77
Stdlib::Absolutepath $cwd = $katello_devel::foreman_dir,
88
Integer[0] $timeout = 600,
9+
Optional[String] $command = undef,
910
) {
11+
$bundle_command = pick($command, $title)
12+
1013
exec { "bundle-${title}":
11-
command => "bundle ${title}",
14+
command => "bundle ${bundle_command}",
1215
environment => $environment + ["HOME=/home/${user}"],
1316
cwd => $cwd,
1417
user => $user,

manifests/database.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
database => 'all',
3939
user => 'all',
4040
address => '127.0.0.1/32',
41-
order => 2,
41+
order => 4,
4242
auth_method => 'trust',
4343
}
4444

@@ -47,7 +47,7 @@
4747
database => 'all',
4848
user => 'all',
4949
address => '::1/128',
50-
order => 3,
50+
order => 5,
5151
auth_method => 'trust',
5252
}
5353

manifests/init.pp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
#
7474
# @param rails_cache_store
7575
# Manage the type of cache used for Rails, default is Redis.
76+
#
77+
# @param enable_iop
78+
# Enable iop integration
79+
#
7680
class katello_devel (
7781
String $user = undef,
7882
Stdlib::Absolutepath $deployment_dir = '/home/vagrant',
@@ -98,6 +102,7 @@
98102
Boolean $katello_manage_repo = true,
99103
Boolean $rex_manage_repo = true,
100104
Hash[String, Any] $rails_cache_store = { 'type' => 'redis' },
105+
Boolean $enable_iop = false,
101106
) inherits katello_devel::params {
102107
$group = $user
103108

@@ -175,4 +180,8 @@
175180
group => $group,
176181
mode => '0755',
177182
}
183+
184+
if $enable_iop {
185+
include katello_devel::iop
186+
}
178187
}

manifests/iop.pp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# @summary Insights on Premise (IoP) integration for Katello development
2+
# @api private
3+
class katello_devel::iop {
4+
$iop_pidfile = "${katello_devel::foreman_dir}/tmp/pids/server.pid"
5+
6+
postgresql::server::pg_hba_rule { 'inventory_db IPV4':
7+
type => 'host',
8+
database => 'inventory_db',
9+
user => 'all',
10+
address => '127.0.0.1/32',
11+
order => 2,
12+
auth_method => 'md5',
13+
}
14+
15+
postgresql::server::pg_hba_rule { 'inventory_db IPV6':
16+
type => 'host',
17+
database => 'inventory_db',
18+
user => 'all',
19+
address => '::1/128',
20+
order => 3,
21+
auth_method => 'md5',
22+
}
23+
24+
# Create directory structure for Foreman assets
25+
file {
26+
[
27+
'/var/lib/foreman',
28+
'/var/lib/foreman/public',
29+
'/var/lib/foreman/public/assets',
30+
'/var/lib/foreman/public/assets/apps',
31+
]:
32+
ensure => directory,
33+
owner => 'foreman',
34+
group => 'foreman',
35+
mode => '0755',
36+
} ->
37+
Katello_devel::Git_repo['foreman'] ->
38+
katello_devel::plugin { 'theforeman/foreman_rh_cloud': } ->
39+
Katello_devel::Bundle['exec rake db:migrate'] ->
40+
katello_devel::bundle { 'iop-rails-startup':
41+
command => 'exec rails s -d',
42+
unless => "/usr/bin/pgrep --pidfile ${iop_pidfile}",
43+
} ->
44+
class { 'iop':
45+
register_as_smartproxy => true,
46+
} ->
47+
exec { 'destroy iop rails server':
48+
command => "/usr/bin/pkill -9 --pidfile ${iop_pidfile}",
49+
logoutput => 'on_failure',
50+
timeout => '600',
51+
}
52+
}

spec/acceptance/iop_spec.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'Scenario: install katello_devel' do
4+
let(:manifest) do
5+
<<-PUPPET
6+
class { 'katello_devel':
7+
user => 'vagrant',
8+
enable_iop => true,
9+
}
10+
PUPPET
11+
end
12+
13+
it 'applies with no errors' do
14+
apply_manifest(manifest, catch_failures: true)
15+
end
16+
17+
[
18+
'httpd',
19+
'tomcat',
20+
].each do |service_name|
21+
describe service(service_name) do
22+
it { is_expected.to be_enabled }
23+
it { is_expected.to be_running }
24+
end
25+
end
26+
27+
describe port(80) do
28+
it { is_expected.to be_listening }
29+
end
30+
31+
describe port(443) do
32+
it { is_expected.to be_listening }
33+
end
34+
35+
describe file("/usr/share/tomcat/conf/cert-users.properties") do
36+
its(:content) { should eq("katelloUser=CN=#{fact('fqdn')}, OU=PUPPET, O=FOREMAN, ST=North Carolina, C=US\n") }
37+
end
38+
end

spec/setup_acceptance_node.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@
3434
ensure => installed,
3535
}
3636
}
37+
38+
# Install required gems for foreman_smartproxy provider
39+
package { ['rubygem-oauth', 'puppet-agent-oauth']:
40+
ensure => installed,
41+
require => Class['foreman::repo'],
42+
}

0 commit comments

Comments
 (0)