forked from theforeman/puppet-katello_devel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.pp
More file actions
47 lines (43 loc) · 1.58 KB
/
setup.pp
File metadata and controls
47 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# @summary Handles initialization and setup of the Rails app
# @api private
class katello_devel::setup (
Stdlib::Absolutepath $foreman_dir = $katello_devel::foreman_dir,
String $user = $katello_devel::user,
String $initial_organization = $katello_devel::initial_organization,
String $initial_location = $katello_devel::initial_location,
String $admin_password = $katello_devel::admin_password,
Integer[0] $npm_timeout = $katello_devel::npm_timeout,
) {
$pidfile = "${foreman_dir}/tmp/pids/server.pid"
$seed_env = [
"SEED_ORGANIZATION=${initial_organization}",
"SEED_LOCATION=${initial_location}",
"SEED_ADMIN_PASSWORD=${admin_password}",
]
katello_devel::bundle { 'exec rake webpack:compile':
require => Katello_devel::Bundle['exec npm install'],
before => Katello_devel::Bundle['exec rake db:migrate'],
}
katello_devel::bundle { 'install --retry 3 --jobs 3 --path .vendor':
environment => ['MAKEOPTS=-j'],
} ->
katello_devel::bundle { 'exec npm install':
timeout => $npm_timeout,
} ->
katello_devel::bundle { 'exec rake db:migrate': } ->
katello_devel::bundle { 'exec rake db:seed':
environment => $seed_env,
}
if defined(Class['foreman_proxy::register']) {
katello_devel::bundle { 'exec rails s -d':
unless => "/usr/bin/pgrep --pidfile ${pidfile}",
subscribe => Katello_devel::Bundle['exec rake db:seed'],
} ->
Class['foreman_proxy::register'] ->
exec { 'destroy rails server':
command => "/usr/bin/pkill -9 --pidfile ${pidfile}",
logoutput => 'on_failure',
timeout => '600',
}
}
}