Hi,
Ok I checked it and I have to say that the problem is still there
Its ok if the file is copied every time, but it won't be copied It will be copied if I start the copy sequence alone, but in a role with more cookbook (cookbook role > 1 [the cookbook alone) it won't be copied. So I didn't understand the problem ?!
Is it possible, that chef doesn't handle the cookbooks no in a order?
1.) Copy the file
2.) Extract it
3.) Install it
It looks like:
2 .)-> 3.) -> 1.)
The other thing is, that I used your line
subscribes :run, "cookbook_file[/tmp/VMwareTools.tar.gz]", :immediately
I thought I can use it simple as it should be:
execute "Unpacking the Installer File" do
command "/bin/tar zxf /tmp/VMWareTools.tar.gz -C /tmp/"
subscribes :run, "cookbook_file[/tmp/VMwareTools.tar.gz]", :immediately
end
but with these lines I got the error:
/usr/lib/ruby/1.8/chef/resource.rb:293:in subscribes': undefined method
notifies' for "cookbook_file[/tmp/VMwareTools.tar.gz]":String (NoMethodError)
So I think I didn't use it as you mentioned in the mail before ?
Im sry but I didn't know something to get rid of this issue
Regards
Andreas
From: Haselwanter Edmund [mailto:edmund@haselwanter.com]
Sent: Samstag, 21. Mai 2011 10:15
To: chef@lists.opscode.com
Subject: [chef] Re: Re: Re: VMWareTools-installation
On 21.05.2011, at 02:02, Seth Chisamore wrote:
Mac OS X doesn't have sha256sum but it does have openssl
openssl dgst -sha256 VMwareTools.tar.gz
and it has
shasum -a256 VMwareTools.tar.gz
Seth
--
Opscode, Inc.
Seth Chisamore, Senior Technical Evangelist
IRC, Skype, Twitter, Github: schisamo
On Fri, May 20, 2011 at 7:06 PM, Joshua Timberman <joshua@opscode.commailto:joshua@opscode.com> wrote:
Hello!
On Wednesday, May 18, 2011 at 6:45 AM, WEINHAPL Andreas wrote:
Today I ve created a new role named "VMWare_Install" Its based on Ubuntu / Debian! So the first thing I do is to copy the *.tar.gz into my node working directory (with an cookbook_file statement) after that I will will extract it with an execute command. If this is finished I'll begin to compare the installation version with the local vesion of the VMWareTools.
Did you create the file in the cookbook's "files/default" directory?
http://wiki.opscode.com/display/chef/File+Distribution
Also, I suggest a couple changes to your resources, noted below:
cookbook_file "/tmp/VMWareTools.tar.gz" do
puts "Copy File to its place\n"
source "VMWareTools.tar.gz"
owner "root"
group "root"
mode 0777
end
I would use the "checksum" parameter in this resource to ensure that the file is not copied every time. You will need a SHA256 checksum, and can generate that. On linux, use sha256sum:
sha256sum VMwareTools.tar.gz
Mac OS X does not have a sha256sum binary, but you can generate the checksum with a Chef library
ruby -rchef/checksum_cache -e 'puts Chef::ChecksumCache.checksum_for_file("VMWareTools.tar.gz")'
Supply the full path to the .tar.gz if its not in the cwd.
execute "Unpacking the Installer File" do
puts "Extracting installation File\n"
command "/bin/tar zxf /tmp/VMWareTools.tar.gz -C /tmp/"
action :run
end
I would have this be action :nothing with a "subscribe" meta-parameter on the cookbook_file resource.
subscribes :run, "cookbook_file[/tmp/VMwareTools.tar.gz]", :immediately
See: http://wiki.opscode.com/display/chef/Resources#Resources-Notifications
In both resources, you do not need the "puts" line, as Chef will display a message about the resource it is configuring at run time.
--
Opscode, Inc.
Joshua Timberman, Director of Training and Services
IRC, Skype, Twitter, Github: jtimberman
--
DI Edmund Haselwanter, edmund@haselwanter.commailto:edmund@haselwanter.com, http://edmund.haselwanter.com/
http://www.iteh.at | Facebook | http://at.linkedin.com/in/haselwanteredmund