[chef] Re: resource in a ruby_block?


Chronological Thread 
  • From: Jeremy Winters < >
  • To:
  • Cc:
  • Subject: [chef] Re: resource in a ruby_block?
  • Date: Thu, 17 Mar 2011 23:47:04 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=full360.com; s=google; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=QtFX8kG3K6fQWDnYUd/WdJje+Ggp6dSYAgb2qA7K50BetxPkO81+1mExo+wYtorIeW 3MjdOzgECliMljR1JK+eFzvM97/xbB8kljeBBXcjwR63jsMLauunvt9S8iGJi0i44GlX dCp7+DkuKkS6s2sXWpw5gvduxITYpixlNTmpk=

the problem is that the idempotent condition determines whether or not to run 
the ruby_block... but the decision to run the execute resource can only be 
determined during convergence... and not during the compilation phase... as 
the data in the database is changed in an earlier step during convergence.

looking at your recipe... am I correct that everything outside of the execute 
is evaluated during the compilation phase?

Jeremy Winters
212-202-0449 x1023




On Mar 17, 2011, at 11:35 PM, John E. Vincent (lusis) wrote:

> Why the nesting? Can you not make the inner operation idempotent based
> on the primary condition? You can pass a block to the idempotence
> statements. I do this in my user cookbook:
> 
> https://gist.github.com/865645
> 
> 
> 
> On Thu, Mar 17, 2011 at 11:31 PM, Jeremy Winters
> < >
>  wrote:
>> I'm looking to do something like this...
>
>
>> ruby_block "do something doing convergence" do
>>        block do
>>                check_value=result_from_database_at_convergence_run_time
>
>>                if check_value==0 then
>>                        execute "run my sql script" do
>>                                cwd "path_to_script"
>>                                user "root"
>>                                command "./execute_sql_file.rb"
>>                        end
>>                end
>>        end
>>        only_if do primary_idempotent_condition==true end
>> end
>
>> is this possible?  am I missing something?
>
>> Jeremy Winters
>> 212-202-0449 x1023
>
>
>
>
>




Archive powered by MHonArc 2.6.16.

§