forked from puppetlabs-toy-chest/puppetlabs-rpmbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request puppetlabs-toy-chest#67 from mckern/master
(maint) Add global cleanup option for mock stubs
- Loading branch information
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class rpmbuilder::mock::cleanup( | ||
$on_success = true, | ||
$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, | ||
} | ||
|
||
ini_setting { "Cleanup on failure": | ||
ensure => present, | ||
path => '/etc/mock/site-defaults.cfg', | ||
section => '', | ||
setting => "config_opts['cleanup_on_failure']", | ||
value => $cleanup_on_failure, | ||
} | ||
} |