From bd2fc6d72b686a36e8f9b9c0c9422f8260e9ceae Mon Sep 17 00:00:00 2001 From: cristi1979 Date: Mon, 29 Sep 2014 17:16:32 +0300 Subject: [PATCH] set default port for firewall Since port parameter seems to be missing from init.pp, use the same logic to determin it as in cli_helper.pp add possibility to disable/uninstall plugins - add possibility to disable/uninstall plugins. - move $plugins_host outside of if block, as it looks identical for both cases. - rename all occurrences of ${name}.hpi with ${plugin} For uninstall/disable, there are 2 ifs added, each with 2 execs (one for jpi an one for hpi) if ($version == 'absent' or $version == 'uninstall') { test -f ${plugin_dir}/${plugin} && rm -rf ${name} ${plugin} ${name}.jpi ${name}.jpi.pinned && touch ${name}.jpi.disabled test -f ${plugin_dir}/${name}.jpi -a ! -f ${plugin_dir}/${name}.jpi.disabled && touch ${plugin_dir}/${name}.jpi.disabled } elsif ($version == 'disable' or $version == 'disabled') { test -f ${plugin_dir}/${name}.jpi -a ! -f ${plugin_dir}/${name}.jpi.disabled && touch ${plugin_dir}/${name}.jpi.disabled test -f ${plugin_dir}/${plugin} -a ! -f ${plugin_dir}/${plugin}.disabled && touch ${plugin_dir}/${plugin}.disabled } else { } update firewall --- manifests/firewall.pp | 8 +++++++- manifests/plugin.pp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/manifests/firewall.pp b/manifests/firewall.pp index b2c4764ff..8ae483c85 100644 --- a/manifests/firewall.pp +++ b/manifests/firewall.pp @@ -8,10 +8,16 @@ fail("Use of private class ${name} by ${caller_module_name}") } + if $::jenkins::config_hash and has_key($::jenkins::config_hash, 'HTTP_PORT') { + $http_port = $::jenkins::config_hash['HTTP_PORT'] + } else { + $http_port = '8080' + } + firewall { '500 allow Jenkins inbound traffic': action => 'accept', state => 'NEW', - dport => [$::jenkins::port], + dport => [$http_port], proto => 'tcp', } } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index c3c4986c5..ebbc4a4e6 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -134,3 +134,4 @@ } } } +