[chef] Re: Ho to restart service if aws_s3_file file changes


Chronological Thread 
  • From: Ranjib Dey < >
  • To: " " < >
  • Subject: [chef] Re: Ho to restart service if aws_s3_file file changes
  • Date: Wed, 9 Jul 2014 22:57:40 -0700

looking at the code[1] i am not sure if it supports :creates, you can simulate the same using not_if{::File.exist?('/path.')} . creates is only available with certain resources (execute ..etc) its not a meta attribute (like only_if / ignore_failure),

ps. by default the notification is delayed, i.e it will be triggered at the end of the chef run, you can use :immediately to alter that.




On Wed, Jul 9, 2014 at 8:09 PM, David Montgomery < " target="_blank"> > wrote:

Hi,

I am using aws s3 to download a file and if the file changes then restart a service


execute "restart-rexster" do
  command "supervisorctl restart rexster_server:"
  action :nothing
end

 aws_s3_file "/var/titan-#{feature}-#{version}/rexhome/scripts/VersionControl.groovy" do
    bucket "testbucket"
    remote_path "#{node.chef_environment}/VersionControl.groovy"
    aws_access_key_id aws['AWS_ACCESS_KEY_ID']
    aws_secret_access_key aws['AWS_SECRET_ACCESS_KEY']
    notifies :run, 'execute[restart-rexster]'
    creates "/var/titan-#{feature}-#{version}/rexhome/scripts/VersionControl.groovy"
  end


So..with the above....does the aws_s3 resource support 'creates'?  And...is it not the case that if the file checksum changes then 'execute[restart-rexster]' will be executed?

Thanks




Archive powered by MHonArc 2.6.16.

§