I simplified my test to this recipe:
#################################
dest_dir = "/opt/new"
cookbook_file "NEW" do
source "new.zip"
mode "0644"
path "/tmp/new.zip"
end
directory dest_dir do
owner 'root'
group 'root'
mode "0755"
recursive true
action :create
end
execute "extract from ZIP" do
cwd "/opt/new"
command "unzip /tmp/new.zip"
end
###################################
I see that the extraction was still skipped:
######################################################
2014-11-12T14:54:41-05:00] INFO: Processing cookbook_file[NEW] action
create (ccow::new line 4)
[2014-11-12T14:54:41-05:00] DEBUG: File /tmp/new.zip does not exist, so
there is no checksum to generate
[2014-11-12T14:54:41-05:00] DEBUG: cookbook_file[NEW] has new contents
[2014-11-12T14:54:41-05:00] DEBUG: cookbook_file[NEW] staging
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/ccow/files/default/new.zip to
/tmp/NEW20141112-19815-vxaf5i
[2014-11-12T14:54:41-05:00] INFO: cookbook_file[NEW] mode changed to 644
[2014-11-12T14:54:41-05:00] INFO: cookbook_file[NEW] created file
/tmp/new.zip
[2014-11-12T14:54:41-05:00] INFO: Processing directory[/opt/new] action
create (ccow::new line 10)
[2014-11-12T14:54:41-05:00] INFO: directory[/opt/new] created directory
/opt/new
[2014-11-12T14:54:41-05:00] INFO: directory[/opt/new] owner changed to 0
[2014-11-12T14:54:41-05:00] INFO: directory[/opt/new] group changed to 0
[2014-11-12T14:54:41-05:00] INFO: directory[/opt/new] mode changed to 755
[2014-11-12T14:54:41-05:00] INFO: Processing execute[extract from ZIP]
action run (ccow::new line 18)
[2014-11-12T14:54:41-05:00] DEBUG: Skipping execute[extract from ZIP] due
to only_if ruby block
[2014-11-12T14:54:41-05:00] INFO: Chef Run complete in 51.788973291 seconds
######################################################
Also, while I see that /tmp/new.zip is created, I wonder if I am not doing
things
"normally" when I see that Chef automatically cached the thing with no
instructions
from me:
[2014-11-12T14:54:41-05:00] DEBUG: cookbook_file[NEW] staging
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/ccow/files/default/new.zip to
/tmp/NEW20141112-19815-vxaf5i
Well, why is the SKIP happening when there is no only_if ?
Is an only_if inherited at some point?
Thanks!
Christopher
On Wed, Nov 12, 2014 at 8:25 AM, Christopher Hahn <
chahn@cognitivemedicine.com> wrote:
Thank you very much for the time.
You remind me of a terrible omission...I am forced to use
a specific version of Chef:
Running chef-solo...
[2014-11-12T10:54:57-05:00] INFO: *** Chef 10.14.4 ***
...but I grep'ed for that code (3694) in my log and saw nothing...I will
rerun with debug on to confirm.
Thank you again....Hope Springs Eternal! :0)
Christopher
On Wed, Nov 12, 2014 at 8:17 AM, Daniel DeLeo dan@kallistec.com wrote:
On Wednesday, November 12, 2014 at 8:12 AM, Christopher Hahn wrote:
Hello,
This small recipe:
##############################################
include_recipe 'nodejs'
service_name = node[:prod][:service]
dest_dir = "/opt/#{service_name}"
cookbook_file "PROD" do
source "prod.zip"
mode "0644"
path "/tmp/prod.zip"
end
directory dest_dir do
owner 'root'
group 'root'
mode "0755"
recursive true
action :create
end
execute "extract from ZIP" do
cwd dest_dir
command "unzip prod.zip"
action :run
#notifies :run, "execute[start]", :immediately
end
##############################################
...keeps skipping the extraction of the zipfile:
##############################################
[2014-11-12T10:55:18-05:00] INFO: Processing cookbook_file[PROD] action
create (prod::default line 15)
[2014-11-12T10:55:19-05:00] INFO: Processing directory[/opt/prod]
action create (prod::default line 21)
[2014-11-12T10:55:19-05:00] INFO: Processing execute[extract from ZIP]
action run (prod::default line 29)
[2014-11-12T10:55:19-05:00] DEBUG: Skipping execute[extract from ZIP]
due to only_if ruby block
[2014-11-12T10:55:19-05:00] INFO: Chef Run complete in 20.776709674
seconds
##############################################
...but I have no only_if guard in place?
Too new to complain. :0)
Christopher
Are you getting warnings for CHEF-3694 earlier in the logs?
--
Daniel DeLeo