[chef] Re: setting file permssions in the execution phase


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: setting file permssions in the execution phase
  • Date: Tue, 11 Feb 2014 18:04:13 -0800


On Tuesday, February 11, 2014 at 1:24 AM, Richard Murray wrote:

Hi I'm quite new to Chef and I'm struggling to set some file permissions using the following cookbook.  I'm using 'ark' to install Tomcat (I know there is a 'Tomcat' cookbook however this always pulls in the OpenJDK and I want to use Oracle's JDK).

The .tar.gz file is extracted OK however I'm unable to start Tomcat as the permissions in /usr/local/tomcat/conf have restricted permissions (read and write permissions for the file owner only).

I have tried using the Chef 'file' and 'directory' resources to update the permissions but these don't seem to have any effect.  Does the code below update permissons in the compile phase or the execution phase?  If so what is the correct way to do this (to update permissions after the ark action has executed).

ark "tomcat" do
   mode 0755
   #version '2.2.0'
   # test this checksum works...
   #checksum '18688f15ade6aa1aff510ff1b5990979 *apache-tomcat-7.0.50.zip'
   #try adding path attribute...
   action :install
end
 
#["/usr/local/tomcat/logs", "/usr/local/tomcat/conf"].each do | path | 
# directory path do
# mode 0777
# recursive true
# end 
#end

#update permissons on tomcat conf files..
Dir[ "/usr/local/tomcat/conf/**" ].each do |path|
  file path do
    mode "0755"
action :touch
  end 
end

Thanks, 
Richard.

Use `action :create` rather than “touch” on the files. The `:touch` action is like the touch command, generally you only use it if something is watching the mtime or ctime of a file.

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§