And associated test, of course.

On Oct 15, 2009, at 7:03 PM, Rein Henrichs wrote:

>
> Yes. Yes it should.
>
> On Thu, Oct 15, 2009 at 4:55 PM, Luke Kanies <[email protected]> wrote:
>>
>> On Oct 15, 2009, at 4:53 PM, Rein Henrichs wrote:
>>
>>>
>>> Wrap Puppet::Settings.use in a block that disables noop mode during
>>> the
>>> execution of the block and then reenstates its original value
>>> afterwards. This allows internal puppet catalog operations like ssl
>>> directory creation to occur even when puppet is run in --noop mode.
>>> This
>>> should actually solve a broader class of related bugs.
>>>
>>> Signed-off-by: Rein Henrichs <[email protected]>
>>> ---
>>> lib/puppet/util/settings.rb           |    9 ++++++++-
>>> spec/integration/bin/puppetmasterd.rb |   26 ++++++++++++++++++++++ 
>>> ++
>>> ++
>>> 2 files changed, 34 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/ 
>>> settings.rb
>>> index 3e3bc7f..fb3709e 100644
>>> --- a/lib/puppet/util/settings.rb
>>> +++ b/lib/puppet/util/settings.rb
>>> @@ -157,6 +157,13 @@ class Puppet::Util::Settings
>>>         set_value(str, value, :cli)
>>>     end
>>>
>>> +    def without_noop
>>> +        old_noop = value(:noop,:cli)
>>> +        set_value(:noop, false, :cli)
>>> +        yield
>>> +        set_value(:noop, old_noop, :cli)
>>
>> Shouldn't this second 'set_value' be in an 'ensure' block?
>>
>>> +    end
>>> +
>>>     def include?(name)
>>>         name = name.intern if name.is_a? String
>>>         @config.include?(name)
>>> @@ -632,7 +639,7 @@ Generated on #{Time.now}.
>>>                 return
>>>             end
>>>
>>> -            begin
>>> +            without_noop do
>>>                 catalog.host_config = false
>>>                 catalog.apply do |transaction|
>>>                     if transaction.any_failed?
>>> diff --git a/spec/integration/bin/puppetmasterd.rb b/spec/
>>> integration/bin/puppetmasterd.rb
>>> index b5a3f96..5b3a29f 100755
>>> --- a/spec/integration/bin/puppetmasterd.rb
>>> +++ b/spec/integration/bin/puppetmasterd.rb
>>> @@ -107,4 +107,30 @@ describe "puppetmasterd" do
>>>     end
>>>
>>>     it "should exit with return code 1 after parsing if --parseonly
>>> is set and there are errors"
>>> +
>>> +    describe "when run for the first time" do
>>> +        before do
>>> +            @ssldir = File.join(@dir, 'ssl')
>>> +            FileUtils.rm_r(@ssldir) if File.exists?(@ssldir)
>>> +        end
>>> +
>>> +        describe "with noop" do
>>> +            it "should create its ssl directory" do
>>> +                File.directory?(@ssldir).should be_false
>>> +                start(' --noop')
>>> +
>>> +                sleep 0.5
>>> +                File.directory?(@ssldir).should be_true
>>> +            end
>>> +        end
>>> +
>>> +        describe "without noop" do
>>> +            it "should create its ssl directory" do
>>> +                File.directory?(@ssldir).should be_false
>>> +                start
>>> +                sleep 0.5
>>> +                File.directory?(@ssldir).should be_true
>>> +            end
>>> +        end
>>> +    end
>>> end
>>> --
>>> 1.6.4.2
>>>
>>>
>>>>
>>
>>
>> --
>> To be pleased with one's limits is a wretched state.
>>     -- Johann Wolfgang von Goethe
>> ---------------------------------------------------------------------
>> Luke Kanies | http://reductivelabs.com | http://madstop.com
>>
>>
>>>
>>
>
>
>
> -- 
> Rein Henrichs
> http://reductivelabs.com
>
> >


-- 
A nation is a society united by delusions about its ancestry and by
common hatred of its neighbors. -- William Ralph Inge
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to