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

Idempotency #262

Closed
Ginja opened this Issue Jan 21, 2016 · 6 comments

Comments

Projects
None yet
3 participants
@Ginja
Copy link
Collaborator

Ginja commented Jan 21, 2016

I'm not sure if anyone else is noticing this, but I'm seeing this cookbook consistently apply at least 3 resources (on both Windows & Linux hosts):

image

When I view what resources were changed in our monitoring tool, it looks like this:

image

I'm wondering if this is because of Poise. I haven't done a deep-dive into this issue as I wanted to bring it up here in case this is to be expected.

@scalp42

This comment has been minimized.

Copy link
Contributor

scalp42 commented Jan 21, 2016

@Ginja unrelated but where is this UI from ?

@johnbellone

This comment has been minimized.

Copy link
Contributor

johnbellone commented Jan 22, 2016

We have noticed this recently while trying to fix some restart issues in other cookbooks. I think our initial thoughts led us to the libartifact cookbook or the libarchive cookbook.

@Ginja

This comment has been minimized.

Copy link
Collaborator Author

Ginja commented Jan 23, 2016

@johnbellone: I was thinking that too, but I'm seeing this even in the Windows provider (the pictures above are actually using it), which doesn't use libartifact or libarchive resources.

@scalp42 It's the Foreman. I have a cookbook to configure one into a reporting server for Chef that I'll release when it's ready for the public eye ;)

@johnbellone

This comment has been minimized.

Copy link
Contributor

johnbellone commented Jan 23, 2016

I was tinkering with the libarchive cookbook last night and narrowed it down there. Not sure about Windows. It looks like we have a few places this needs to be fixed.

@Ginja

This comment has been minimized.

Copy link
Collaborator Author

Ginja commented Jan 28, 2016

You're right, the inherent problem is in the libarchive cookbook, as it has no check on whether or not it should run. It looks like it's leaving that up to the cookbooks that use it. So I have a fix for libartifiact:

# Lines 56 to 71
# https://github.com/johnbellone/libartifact-cookbook/blob/master/libraries/libartifact_file.rb#L54

          archive_path = ::File.join(Chef::Config[:file_cache_path], friendly_name)
          archive = remote_file new_resource.remote_url do
            path archive_path
            source new_resource.remote_url
            checksum new_resource.remote_checksum
            action :create_if_missing
            notifies :extract, "libarchive_file[#{archive_path}]"
          end

          libarchive_file archive.path do
            action :nothing
            extract_to new_resource.release_path
            extract_options new_resource.extract_options
            owner new_resource.owner
            group new_resource.group
          end

If that looks alright to you, @johnbellone, I'll submit a PR to your libartifiact-cookbook. This unfortunately doesn't fix the problem on Windows, I'll work on that next.

@johnbellone

This comment has been minimized.

Copy link
Contributor

johnbellone commented Jan 28, 2016

Great work! Yes, please submit the PR :).

Sent from my iPhone
JB

On Jan 27, 2016, at 23:02, Riley Shott notifications@github.com wrote:

You're right, the inherent problem is in the libarchive cookbook, as it does no check on whether or not it should run. It looks like it's leaving that up to the cookbooks that use it. So I have a fix for libartifiact:

Lines 56 to 71

https://github.com/johnbellone/libartifact-cookbook/blob/master/libraries/libartifact_file.rb#L54

      archive_path = ::File.join(Chef::Config[:file_cache_path], friendly_name)
      archive = remote_file new_resource.remote_url do
        path archive_path
        source new_resource.remote_url
        checksum new_resource.remote_checksum
        action :create_if_missing
        notifies :extract, "libarchive_file[#{archive_path}]"
      end

      libarchive_file archive.path do
        action :nothing
        extract_to new_resource.release_path
        extract_options new_resource.extract_options
        owner new_resource.owner
        group new_resource.group
      end

If that looks alright to you, @johnbellone, I'll submit a PR to your libartifiact-cookbook. This unfortunately doesn't fix Windows, I'll work on that next.


Reply to this email directly or view it on GitHub.

Ginja added a commit to visioncritical/consul-cookbook that referenced this issue Jan 28, 2016

Fixes sous-chefs#262 for Windows
It appears the nssm resource also isn't idempotent. I also added
another attribute and made it the default value for the install_path
property for consul_service. My reasoning is that one should be able
to change this crucial property without having to redeclare the whole
resource. sous-chefs#262 will be fixed for linux once
johnbellone/libartifact-cookbook#2 is merged

Ginja added a commit to visioncritical/consul-cookbook that referenced this issue Jan 28, 2016

Fixes sous-chefs#262 for Windows
It appears the nssm resource also isn't idempotent. I also added
another attribute and made it the default value for the install_path
property for consul_service. My reasoning is that one should be able
to change this crucial property without having to redeclare the whole
resource. sous-chefs#262 will be fixed for linux once
johnbellone/libartifact-cookbook#2 is merged

Ginja added a commit to visioncritical/consul-cookbook that referenced this issue Jan 29, 2016

Fixes sous-chefs#262 for Windows
It appears the nssm resource also isn't idempotent. I also added
another attribute and made it the default value for the install_path
property for consul_service. My reasoning is that one should be able
to change this crucial property without having to redeclare the whole
resource. sous-chefs#262 will be fixed for linux once
johnbellone/libartifact-cookbook#2 is merged

Ginja added a commit to visioncritical/consul-cookbook that referenced this issue Feb 2, 2016

Fixes sous-chefs#262 for Windows
It appears the nssm resource also isn't idempotent. I also added
another attribute and made it the default value for the install_path
property for consul_service. My reasoning is that one should be able
to change this crucial property without having to redeclare the whole
resource. sous-chefs#262 will be fixed for linux once
johnbellone/libartifact-cookbook#2 is merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.