Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Don't set owner, group, mode unless unpacking the archive #30

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

jdutton commented Oct 29, 2012

I am using ark to install Tomcat (also derived from a @bryanwb cookbook), and I noticed that Tomcat was restarting every time I did a chef run. The root cause was because of the recursive FileUtils.chown_R and FileUtils.chmod_R called unconditionally from action_set_owner(), which is called from action_install() and action_put().

Inside my exploded Tomcat, I have some config XML files and WAR files that do not have 755 permissions (which is what ark is recursively setting). When chef runs, the ark recipe changes my war and config files to 755 and then when my template and remote_file resources run to set up XML and WAR files they change the permissions back. This falsely triggers service tomcat to restart every chef run.

The way ark is now, the only permissions that will avoid this behavior is if every file under the exploded archive has user and group match the ark archive and has a 755 permission level.

I think a reasonable fix is to only change the permissions when unpacking.

Owner

bryanwb commented Oct 29, 2012

Hey @jdutton tks for the patch! i worry that since these actions are run as root that the permissions will never be set properly for the :put and :install actions. I think a better place to put the action_set_owner new_resource.path into the unless unpacked? block on these lines

https://github.com/bryanwb/chef-ark/blob/master/libraries/provider_ark.rb#L179
https://github.com/bryanwb/chef-ark/blob/master/libraries/provider_ark.rb#L188

What do you think?

Owner

bryanwb commented Oct 29, 2012

@jdutton btw, I could really use some help w/ the tomcat cookbook :) . Got a public repo?

jdutton commented Oct 30, 2012

Yes, maybe also on https://github.com/bryanwb/chef-ark/blob/master/libraries/provider_ark.rb#L169.

As for tomcat cookbook help, I'm in! That was the first cookbook I worked on, so I didn't fork the repo, I downloaded it into my chef repo's cookbooks directory. Also, it's based on your older bryanwb/tomcat repo, not the bryanwb/chef-tomcat repo that you are actively developing on.

Are you looking to push your new tomcat cookbook upstream eventually?

jdutton commented Oct 30, 2012

I see you're all over CentOS. I'm using Ubuntu - is that still helpful to you?

Also, I have a 1 character Ubuntu-specific pull request outstanding to you - bryanwb/chef-collectd#1. I've found your interests very similar to my interests. I guess I'll be deploying logstash next ;-)

Owner

bryanwb commented Oct 30, 2012

@jdutton it is very important to me that my cookbooks all work on ubuntu.
I intend to upstream all of them

not enough time to respond to all your q's right now

you should check out my chef-logstash cookbook. I has a super useful
hash_to_stash function that hasn't been accepted upstream yet.

also, check out http://foodfightshow.org my chef podcast if you haven't yet

On Tue, Oct 30, 2012 at 2:49 AM, Jeff Dutton notifications@github.comwrote:

I see you're all over CentOS. I'm using Ubuntu - is that still helpful to
you?

Also, I have a 1 character Ubuntu-specific pull request outstanding to you


Reply to this email directly or view it on GitHubhttps://github.com/bryanwb/chef-ark/pull/30#issuecomment-9892552.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment