Skip to content

Commit

Permalink
Merge pull request #111 from Phil-Friderici/type_puppet_rebased
Browse files Browse the repository at this point in the history
Changed outdated type-function to is_<type>
  • Loading branch information
ghoneycutt committed Nov 25, 2015
2 parents 5b585e2 + 6981e27 commit 63ee097
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project_page 'https://github.com/ghoneycutt/puppet-module-puppet'

dependency 'ghoneycutt/common', '>= 1.0.3'
dependency 'leinaddm/htpasswd', '>= 0.0.1'
dependency 'puppetlabs/stdlib', '>= 3.2.0'
dependency 'puppetlabs/stdlib', '>= 4.6.0'
dependency 'puppetlabs/mysql', '>= 2.0.0'
dependency 'puppetlabs/passenger', '>= 0.0.4'
dependency 'puppetlabs/apache', '>= 0.5.0'
Expand Down
12 changes: 6 additions & 6 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
$etckeeper_hooks = false,
) {

if type($run_in_noop) == 'String' {
if is_string($run_in_noop) {
$run_in_noop_bool = str2bool($run_in_noop)
} else {
$run_in_noop_bool = $run_in_noop
}
validate_bool($run_in_noop_bool)

if type($run_at_boot) == 'String' {
if is_string($run_at_boot) {
$run_at_boot_bool = str2bool($run_at_boot)
} else {
$run_at_boot_bool = $run_at_boot
}
validate_bool($run_at_boot_bool)

if type($is_puppet_master) == 'String' {
if is_string($is_puppet_master) {
$is_puppet_master_bool = str2bool($is_puppet_master)
} else {
$is_puppet_master_bool = $is_puppet_master
Expand All @@ -63,14 +63,14 @@
fail("puppet::agent::puppet_masterport is set to <${puppet_masterport}>. It should be an integer.")
}

if type($stringify_facts) == 'string' {
if is_string($stringify_facts) {
$stringify_facts_bool = str2bool($stringify_facts)
} else {
$stringify_facts_bool = $stringify_facts
}
validate_bool($stringify_facts_bool)

if type($etckeeper_hooks) == 'String' {
if is_string($etckeeper_hooks) {
$etckeeper_hooks_bool = str2bool($etckeeper_hooks)
} else {
$etckeeper_hooks_bool = $etckeeper_hooks
Expand Down Expand Up @@ -176,7 +176,7 @@
$at_boot_ensure = 'absent'
}

if type($symlink_puppet_binary) == 'string' {
if is_string($symlink_puppet_binary) {
$symlink_puppet_binary_bool = str2bool($symlink_puppet_binary)
} else {
$symlink_puppet_binary_bool = $symlink_puppet_binary
Expand Down
2 changes: 1 addition & 1 deletion manifests/dashboard.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
) {

validate_absolute_path($external_node_script_path)
if type($dashboard_package) != 'String' and type($dashboard_package) != 'Array' {
if !is_string($dashboard_package) and !is_array($dashboard_package) {
fail('puppet::dashboard::dashboard_package must be a string or an array.')
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/dashboard/maintenance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
minute => $purge_old_reports_minute,
}

if type($remove_old_reports_spool) == 'string' {
if is_string($remove_old_reports_spool) {
$enable_remove_old_reports_spool = str2bool($remove_old_reports_spool)
} else {
$enable_remove_old_reports_spool = $remove_old_reports_spool
Expand Down
11 changes: 4 additions & 7 deletions manifests/dashboard/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,14 @@
require 'passenger'
include puppet::dashboard::maintenance

case type($manage_mysql_options) {
'boolean': {
if is_bool($manage_mysql_options) {
$manage_mysql_options_real = $manage_mysql_options
}
'string': {
} elsif is_string($manage_mysql_options) {
$manage_mysql_options_real = str2bool($manage_mysql_options)
}
default: {
} else {
fail("puppet::dashboard::server::manage_mysql_options supports booleans only and is <${manage_mysql_options}>.")
}
}


if $manage_mysql_options_real == true {
class { 'mysql::server':
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"dependencies": [
{"name":"ghoneycutt/common","version_requirement":">= 1.0.3"},
{"name":"leinaddm/htpasswd","version_requirement":">= 0.0.1"},
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0"},
{"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0"},
{"name":"puppetlabs/mysql","version_requirement":">= 2.0.0"},
{"name":"puppetlabs/passenger","version_requirement":">= 0.0.4"},
{"name":"puppetlabs/apache","version_requirement":">= 0.5.0"},
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@
it 'should fail' do
expect {
should contain_class('puppet::agent')
}.to raise_error(Puppet::Error,/^puppet::agent::puppet_masterport is set to <invalidtype>. It should be an integer./)
}.to raise_error(Puppet::Error,/puppet::agent::puppet_masterport is set to <invalidtype>\. It should be an integer\./)
end
end
end
Expand Down Expand Up @@ -696,7 +696,7 @@
it 'should fail' do
expect {
should contain_class('puppet::agent')
}.to raise_error(Puppet::Error,/^puppet::agent::http_proxy_host is set to <invalidtype>. It should be a fqdn or an ip-address./)
}.to raise_error(Puppet::Error,/puppet::agent::http_proxy_host is set to <invalidtype>\. It should be a fqdn or an ip-address\./)
end
end
end
Expand All @@ -723,7 +723,7 @@
it 'should fail' do
expect {
should contain_class('puppet::agent')
}.to raise_error(Puppet::Error,/^puppet::agent::http_proxy_port is set to <invalidtype>. It should be an Integer./)
}.to raise_error(Puppet::Error,/puppet::agent::http_proxy_port is set to <invalidtype>\. It should be an Integer\./)
end
end
context 'set to an invalid value' do
Expand Down

0 comments on commit 63ee097

Please sign in to comment.