-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make private classes private, dont pass params #107
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,21 @@ | |
# | ||
class jenkins::cli { | ||
|
||
if $caller_module_name != $module_name { | ||
fail("Use of private class ${name} by ${caller_module_name}") | ||
} | ||
|
||
$jar = '/usr/lib/jenkins/jenkins-cli.jar' | ||
$extract_jar = 'unzip /usr/lib/jenkins/jenkins.war WEB-INF/jenkins-cli.jar' | ||
$move_jar = "mv WEB-INF/jenkins-cli.jar ${jar}" | ||
$remove_dir = 'rm -rf WEB-INF' | ||
|
||
exec { | ||
'jenkins-cli' : | ||
command => "${extract_jar} && ${move_jar} && ${remove_dir}", | ||
path => ['/bin', '/usr/bin'], | ||
cwd => '/tmp', | ||
creates => $jar, | ||
require => Package['jenkins']; | ||
exec { 'jenkins-cli' : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason this block has been changed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have both resource { name: ... } and resource { \n name: ...} - just picked one to standardize on and the style guid seemed to go this way. |
||
command => "${extract_jar} && ${move_jar} && ${remove_dir}", | ||
path => ['/bin', '/usr/bin'], | ||
cwd => '/tmp', | ||
creates => $jar, | ||
require => Package['jenkins'], | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,8 +74,8 @@ | |
$repo = $jenkins::params::repo, | ||
$service_enable = $jenkins::params::service_enable, | ||
$service_ensure = $jenkins::params::service_ensure, | ||
$config_hash = undef, | ||
$plugin_hash = undef, | ||
$config_hash = {}, | ||
$plugin_hash = {}, | ||
$configure_firewall = undef, | ||
$install_java = $jenkins::params::install_java, | ||
$proxy_host = undef, | ||
|
@@ -84,6 +84,7 @@ | |
) inherits jenkins::params { | ||
|
||
validate_bool($lts, $install_java, $repo) | ||
validate_hash($config_hash, $plugin_hash) | ||
|
||
if $configure_firewall { | ||
validate_bool($configure_firewall) | ||
|
@@ -102,22 +103,14 @@ | |
class {'jenkins::repo':} | ||
} | ||
|
||
class {'jenkins::package' : | ||
version => $version; | ||
} | ||
class {'jenkins::package': } | ||
|
||
class { 'jenkins::config': | ||
config_hash => $config_hash, | ||
} | ||
class { 'jenkins::config': } | ||
|
||
class { 'jenkins::plugins': | ||
plugin_hash => $plugin_hash, | ||
} | ||
class { 'jenkins::plugins': } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not group this, and the other classes in one big class declaration? E.g. class {
'jenkins::package' : ;
'jenkins::config' : ;
'jenkins::plugins' : ;
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. personally I don't like multiple resources separated with a semicolon, but that's a persona preference. I can update if you'd like. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took a look at the style guide on this, since you referenced it above. I think they're wrong about this, but I'm fine following Puppet Labs' silly arbitrary guidelines in the module. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't agree with a few of the style guide things and am happy to change whatever - I just like consistency as it makes it easier to modify. |
||
|
||
if $proxy_host { | ||
if $proxy_host and $proxy_port { | ||
class { 'jenkins::proxy': | ||
host => $proxy_host, | ||
port => $proxy_port, | ||
require => Package['jenkins'], | ||
notify => Service['jenkins'] | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ | |
) inherits jenkins::params { | ||
|
||
jenkins::plugin {'swarm': | ||
version => $version } | ||
version => $version , | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
# Class: jenkins::plugins | ||
# | ||
class jenkins::plugins ( | ||
$plugin_hash = {} | ||
) { | ||
validate_hash( $plugin_hash ) | ||
create_resources('jenkins::plugin',$plugin_hash) | ||
class jenkins::plugins { | ||
|
||
if $caller_module_name != $module_name { | ||
fail("Use of private class ${name} by ${caller_module_name}") | ||
} | ||
|
||
create_resources('jenkins::plugin',$jenkins::plugin_hash) | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
# Class: jenkins::service | ||
# | ||
class jenkins::service { | ||
|
||
if $caller_module_name != $module_name { | ||
fail("Use of private class ${name} by ${caller_module_name}") | ||
} | ||
|
||
service { 'jenkins': | ||
ensure => $jenkins::service_ensure, | ||
enable => $jenkins::service_enable, | ||
hasstatus => true, | ||
hasrestart => true, | ||
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this cause
rake lint
to complain about the lack of parenthesis in the if statement?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at all - http://docs.puppetlabs.com/guides/style_guide.html#conditionals. In fact, under 11.2 the example is without parenthesis.