Hi Pepov,I'll be honest that I'm having a hard time determining exactly where you're issue is based on what's posted but.. The package resource should not be "updated_by_last_action" if the package is already installed and up to date. This slide deck has a slide on "Nested Resources" that might be applicable to what you are doing(and if not def worth knowing) http://www.slideshare.net/geekbri/lwrp-presentation . It involves running the nested resources in a new context and then checking that context to see if resources have been updated or not. It's a bit gross IMHO, and there may be a better way of doing it, but it's fairly straight forward.I hope that helps and apologise if it does not :)-GregOn Wed, Sep 10, 2014 at 12:31 AM, Peter Wilcsinszky < " target="_blank"> > wrote:Hi all!I've run into a problem, when I was trying to implement an lwrp, that does something like the artifact_package resource in https://github.com/RiotGames/artifact-cookbookThe simplified base of the lwrp looks like:use_inline_resourcesaction :installcustom_artifact_download_lwrp ...package ...endI wanted to test its idempotency, to make sure no notification will be propagated when the package is already installed. If any of the inner resources inside the custom_artifact_download_lwrp resource was modified (the file has been removed from the cache - we want to do periodic cleanup there) the notification was sent out even if the package was already installed. I wanted to force "mute" it somehow, because I want to avoid restarting services needlessly. I've naively tried:c = custom_artifact_download_lwrpc.updated_by_last_action(false)But after digging into the code I've realised I can not do this, since this code runs before the resource collection is converged. So if a resource gets modified the updated flag will be true and I cannot do anything about it. Is there a way to do this?Anyways, after reading the lwrp docs more closely, I've realized that I should do a conditional before declaring any of my resources, so ended up in doing this:def skip_install?(name, version)status = `dpkg -s #{name}`status.lines.any? { |l| /^Status: install ok installed/.match l } &&status.lines.any? { |l| /^Version: #{version}$/.match l }endaction :installunless skip_install?()custom_artifact_download_lwrp ...package ...endendI'm wondering if there is a more appropriate way of checking package availability, and wheter I've ended up doing this right or missing something?Thanks,pepov
Archive powered by MHonArc 2.6.16.