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 · 7 comments · Fixed by #263
Closed

Idempotency #262

Ginja opened this issue Jan 21, 2016 · 7 comments · Fixed by #263

Comments

@Ginja
Copy link
Contributor

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
Copy link
Contributor

scalp42 commented Jan 21, 2016

@Ginja unrelated but where is this UI from ?

@johnbellone
Copy link
Contributor

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
Copy link
Contributor 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
Copy link
Contributor

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
Copy link
Contributor 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
Copy link
Contributor

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.

@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 a pull request may close this issue.

3 participants