Skip to content

Commit

Permalink
Reduce conditional branching
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Mar 26, 2021
1 parent 3e8996a commit 728f9c1
Showing 1 changed file with 20 additions and 34 deletions.
54 changes: 20 additions & 34 deletions manifests/plugin/dynflow.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,54 +49,40 @@
}

if $external_core {
foreman_proxy::plugin { 'dynflow_core':
notify => Service['smart_proxy_dynflow_core'],
}
$service = 'smart_proxy_dynflow_core'

file { '/etc/smart_proxy_dynflow_core/settings.yml':
ensure => file,
content => template('foreman_proxy/plugin/dynflow_core.yml.erb'),
require => Foreman_proxy::Plugin['dynflow_core'],
notify => Service['smart_proxy_dynflow_core'],
notify => Service[$service],
}

file { '/etc/smart_proxy_dynflow_core/settings.d':
ensure => link,
target => "${foreman_proxy::config_dir}/settings.d",
require => Foreman_proxy::Plugin['dynflow_core'],
notify => Service['smart_proxy_dynflow_core'],
}

systemd::service_limits { 'smart_proxy_dynflow_core.service':
limits => {
'LimitNOFILE' => $open_file_limit,
},
restart_service => false,
require => Foreman_proxy::Plugin['dynflow_core'],
notify => Service['smart_proxy_dynflow_core'],
}

service { 'smart_proxy_dynflow_core':
ensure => running,
enable => true,
notify => Service[$service],
}
} else {
foreman_proxy::plugin { 'dynflow_core':
notify => Service['foreman-proxy'],
}
$service = 'foreman-proxy'
}

systemd::service_limits { 'foreman-proxy.service':
limits => {
'LimitNOFILE' => $open_file_limit,
},
restart_service => false,
require => Foreman_proxy::Plugin['dynflow_core'],
notify => Service['foreman-proxy'],
}
foreman_proxy::plugin { 'dynflow_core':
notify => Service[$service],
}

service { 'smart_proxy_dynflow_core':
ensure => false,
enable => false,
}
systemd::service_limits { "${$service}.service":
limits => {
'LimitNOFILE' => $open_file_limit,
},
restart_service => false,
require => Foreman_proxy::Plugin['dynflow_core'],
notify => Service[$service],
}

service { 'smart_proxy_dynflow_core':
ensure => $external_core,
enable => $external_core,
}
}

0 comments on commit 728f9c1

Please sign in to comment.