Skip to content

Commit

Permalink
Fixes #27053 - Drop Puppet 3 support from the proxy
Browse files Browse the repository at this point in the history
This drops support for the puppet_proxy_legacy and
puppet_proxy_puppetrun classes. These have been depcated for some time
and there's no way to deploy this anymore given this module is Puppet 4+
for some time.
  • Loading branch information
ekohl committed Jul 15, 2019
1 parent bfb58d6 commit 9939f88
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 314 deletions.
13 changes: 8 additions & 5 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,22 @@
}
foreman_proxy::settings_file { [
'puppet_proxy_customrun',
'puppet_proxy_legacy',
'puppet_proxy_mcollective',
'puppet_proxy_puppet_api',
'puppet_proxy_puppetrun',
'puppet_proxy_salt',
'puppet_proxy_ssh',
'puppetca_hostname_whitelisting',
'puppetca_token_whitelisting',
]:
module => false,
}
foreman_proxy::settings_file { [
'puppet_proxy_legacy',
'puppet_proxy_puppetrun',
]:
ensure => 'absent',
module => false,
}
foreman_proxy::settings_file { 'puppetca':
enabled => $::foreman_proxy::puppetca,
feature => 'Puppet CA',
Expand Down Expand Up @@ -134,9 +139,7 @@
}

if $foreman_proxy::puppetca or $foreman_proxy::puppet {
$puppetca_sudo = $foreman_proxy::puppetca and versioncmp($facts['puppetversion'], '6.0') < 0
$puppetrun_sudo = $foreman_proxy::puppet and $foreman_proxy::puppetrun_provider == 'puppetrun'
$uses_sudo = $puppetrun_sudo or $puppetca_sudo
$uses_sudo = $foreman_proxy::puppetca and versioncmp($facts['puppetversion'], '6.0') < 0

if $foreman_proxy::use_sudoersd {
if $uses_sudo and $foreman_proxy::manage_sudoersd {
Expand Down
12 changes: 1 addition & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@
#
# $puppetrun_provider:: Provider for running/kicking Puppet agents
#
# $puppetrun_cmd:: Puppet run/kick command to be allowed in sudoers
#
# $customrun_cmd:: Puppet customrun command
#
# $customrun_args:: Puppet customrun command arguments
Expand Down Expand Up @@ -117,9 +115,6 @@
#
# $puppet_ssl_key:: SSL private key used when accessing the Puppet master API
#
# $puppet_use_environment_api:: Override use of Puppet's API to list environments. When unset, the proxy will
# try to determine this automatically.
#
# $puppet_api_timeout:: Timeout in seconds when accessing Puppet environment classes API
#
# $templates:: Enable templates feature
Expand Down Expand Up @@ -277,8 +272,6 @@
#
# $oauth_consumer_secret:: OAuth secret to be used for REST interaction
#
# $puppet_use_cache:: Whether to enable caching of puppet classes
#
# === Advanced parameters:
#
# $repo:: Which repository to use. Can be a specific version or nightly. Will not configure anything when undefined.
Expand Down Expand Up @@ -362,8 +355,7 @@
Boolean $manage_puppet_group = $::foreman_proxy::params::manage_puppet_group,
Boolean $puppet = $::foreman_proxy::params::puppet,
Foreman_proxy::ListenOn $puppet_listen_on = $::foreman_proxy::params::puppet_listen_on,
String $puppetrun_cmd = $::foreman_proxy::params::puppetrun_cmd,
Optional[Enum['puppetrun', 'mcollective', 'ssh', 'salt', 'customrun']] $puppetrun_provider = $::foreman_proxy::params::puppetrun_provider,
Optional[Enum['mcollective', 'ssh', 'salt', 'customrun']] $puppetrun_provider = $::foreman_proxy::params::puppetrun_provider,
String $customrun_cmd = $::foreman_proxy::params::customrun_cmd,
String $customrun_args = $::foreman_proxy::params::customrun_args,
String $mcollective_user = $::foreman_proxy::params::mcollective_user,
Expand All @@ -378,7 +370,6 @@
Stdlib::Absolutepath $puppet_ssl_ca = $::foreman_proxy::params::ssl_ca,
Stdlib::Absolutepath $puppet_ssl_cert = $::foreman_proxy::params::ssl_cert,
Stdlib::Absolutepath $puppet_ssl_key = $::foreman_proxy::params::ssl_key,
Optional[Boolean] $puppet_use_environment_api = $::foreman_proxy::params::puppet_use_environment_api,
Integer[0] $puppet_api_timeout = $::foreman_proxy::params::puppet_api_timeout,
Boolean $templates = $::foreman_proxy::params::templates,
Foreman_proxy::ListenOn $templates_listen_on = $::foreman_proxy::params::templates_listen_on,
Expand Down Expand Up @@ -466,7 +457,6 @@
String $oauth_effective_user = $::foreman_proxy::params::oauth_effective_user,
String $oauth_consumer_key = $::foreman_proxy::params::oauth_consumer_key,
String $oauth_consumer_secret = $::foreman_proxy::params::oauth_consumer_secret,
Optional[Boolean] $puppet_use_cache = $::foreman_proxy::params::puppet_use_cache,
) inherits foreman_proxy::params {
if $bind_host =~ String {
warning('foreman_proxy::bind_host should be changed to an array, support for string only is deprecated')
Expand Down
3 changes: 0 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@

# puppet settings
$puppet_url = "https://${::fqdn}:8140"
$puppet_use_environment_api = undef
$puppet_use_cache = undef
$puppet_api_timeout = 30

# puppetca settings
Expand All @@ -220,7 +218,6 @@
$puppet = true
$puppet_listen_on = 'https'

$puppetrun_cmd = "${puppet_cmd} kick"
$puppetrun_provider = undef
$customrun_cmd = $shell
$customrun_args = '-ay -f -s'
Expand Down
21 changes: 15 additions & 6 deletions manifests/settings_file.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@
#
# $owner:: Settings file's owner
#
# $group: Settings file's group
# $group:: Settings file's group
#
# $mode: Settings file's mode
# $mode:: Settings file's mode
#
# $feature:: Feature name advertised by proxy module
# If set, foreman_proxy::register will validate the feature name is loaded and advertised.
#
# $ensure:: Whether the config file should be a file or absent
#
define foreman_proxy::settings_file (
Enum['file', 'absent'] $ensure = 'file',
Boolean $module = true,
Boolean $enabled = true,
Foreman_proxy::ListenOn $listen_on = 'https',
Stdlib::Absolutepath $path = "${::foreman_proxy::etc}/foreman-proxy/settings.d/${title}.yml",
String $owner = 'root',
String $group = $::foreman_proxy::user,
String $mode = '0640',
Stdlib::Filemode $mode = '0640',
String $template_path = "foreman_proxy/${title}.yml.erb",
Optional[String] $feature = undef,
) {
Expand All @@ -49,17 +52,23 @@
default => false,
}

if $feature {
if $feature and $ensure != 'absent' {
foreman_proxy::feature { $feature: }
}
} else {
$module_enabled = false
}
}

if $ensure == 'absent' {
$content = undef
} else {
$content = template($template_path)
}

file {$path:
ensure => file,
content => template($template_path),
ensure => $ensure,
content => $content,
owner => $owner,
group => $group,
mode => $mode,
Expand Down
Loading

0 comments on commit 9939f88

Please sign in to comment.