From b3c72a469fa54a71216accf5fd18bf4d2c173266 Mon Sep 17 00:00:00 2001 From: Ryan McKern Date: Thu, 15 May 2014 14:31:50 -0700 Subject: [PATCH] (maint) Fix mock stubs 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. --- Modulefile | 1 + manifests/mock/cleanup.pp | 20 ++------------------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Modulefile b/Modulefile index 8ad4f97..3f61c12 100644 --- a/Modulefile +++ b/Modulefile @@ -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' diff --git a/manifests/mock/cleanup.pp b/manifests/mock/cleanup.pp index a251ae2..15f9686 100644 --- a/manifests/mock/cleanup.pp +++ b/manifests/mock/cleanup.pp @@ -3,28 +3,12 @@ $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": @@ -32,6 +16,6 @@ path => '/etc/mock/site-defaults.cfg', section => '', setting => "config_opts['cleanup_on_failure']", - value => $cleanup_on_failure, + value => capitalize("$on_failure"), } }