Skip to content

Commit

Permalink
(maint) Fix mock stubs
Browse files Browse the repository at this point in the history
This didn't work the way I expected it to at all. I've added an
explicit requirement for puppetlabs-stdlib so I can use the
capitalize() function when changing the mock settings instead.
  • Loading branch information
mckern committed May 15, 2014
1 parent 04f1a1c commit b3c72a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
1 change: 1 addition & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ project_page 'https://github.com/Whopper92/puppetlabs-rpmbuilder'
dependency 'stahnma/epel', '>= 0.0.1'
dependency 'stahnma/puppetlabs_yum', '>= 0.1.0'
dependency 'puppetlabs/inifile', '>= 1.0.0'
dependency 'puppetlabs/stdlib', '>= 3.0.0'
20 changes: 2 additions & 18 deletions manifests/mock/cleanup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,19 @@
$on_failure = true,
) {


# Python is awesome, in that it's true and false boolean
# values are Camel-cased: True and False. Subsequently,
# any values you pass in to a boolean configuration options
# must respect the aforementioned camel-casing. Might be worth
# adding a camel method for strings into stdlib?
$failure = $on_failure ? {
/(?i:false)/ => 'False',
/(?i:true)/ => 'True',
}

$success = $on_success ? {
/(?i:false)/ => 'False',
/(?i:true)/ => 'True',
}

ini_setting { "Cleanup on success":
ensure => present,
path => '/etc/mock/site-defaults.cfg',
section => '',
setting => "config_opts['cleanup_on_success']",
value => $cleanup_on_success,
value => capitalize("$on_success"),
}

ini_setting { "Cleanup on failure":
ensure => present,
path => '/etc/mock/site-defaults.cfg',
section => '',
setting => "config_opts['cleanup_on_failure']",
value => $cleanup_on_failure,
value => capitalize("$on_failure"),
}
}

0 comments on commit b3c72a4

Please sign in to comment.