Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consul Watch: Ignore owner/group on windows machines #313

Merged
merged 6 commits into from
May 10, 2016
Merged

Consul Watch: Ignore owner/group on windows machines #313

merged 6 commits into from
May 10, 2016

Conversation

jirkafajfr
Copy link

@majormoses
Copy link

imho it would be better to have the reverse, as windows is the edge case not *nix something like unless windows...

@jirkafajfr
Copy link
Author

@majormoses I totally agree. I just wanted to be consistent with rest of cookbook. I modified other places with linux condition to the same unless Chef::Platform.windows?

@Ginja
Copy link
Contributor

Ginja commented May 10, 2016

Since we're including the helper library, you can use this method:

https://github.com/johnbellone/consul-cookbook/blob/master/libraries/helpers.rb#L18

unless windows?
      owner new_resource.owner
      group new_resource.group
      mode '0640'
end

@majormoses
Copy link

good call on using the helper library functions I hadn't looked at that

@jirkafajfr
Copy link
Author

done ..

@Ginja Ginja merged commit 0bbc6f5 into sous-chefs:master May 10, 2016
@jirkafajfr
Copy link
Author

Hi,
do you have any date for next supermarket release?

Thanks

@legal90
Copy link
Contributor

legal90 commented May 17, 2016

@Ginja @jarosser06
windows? helper is not included to Chef::Resource :

           ================================================================================
           Error executing action `create` on resource 'consul_config[consul]'
           ================================================================================

           NoMethodError
           -------------
           undefined method `windows?' for Chef::Resource::Directory

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/consul/libraries/consul_config.rb:114:in `block (3 levels) in <class:ConsulConfig>'
           /tmp/kitchen/cache/cookbooks/consul/libraries/consul_config.rb:112:in `block (2 levels) in <class:ConsulConfig>'
           /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/helpers/subcontext_block.rb:54:in `instance_eval'
           /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/helpers/subcontext_block.rb:54:in `subcontext_block'
           /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/helpers/notifying_block.rb:67:in `notifying_block'
           /tmp/kitchen/cache/cookbooks/consul/libraries/consul_config.rb:111:in `block in <class:ConsulConfig>'

So, 6913f6b should be reverted

@johnbellone
Copy link
Contributor

node.platform?('windows')

@Ginja
Copy link
Contributor

Ginja commented May 18, 2016

To use the helper methods in a resource block you first need to do this:

Chef::Resource.send(:include, ConsulCookbook::Helpers)

@johnbellone's solution would work too, as we inject the methods into the Node class:

https://github.com/johnbellone/consul-cookbook/blob/master/libraries/helpers.rb#L147

@johnbellone
Copy link
Contributor

This is fixed and released in 2.1.3.

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants