Notifications Triggered Every Run
andrewgross opened this issue · 2 comments
Posting this here to see if others are having the issue. I am guessing I am getting an edge case, since the behavior is too annoying to be prevalent yet unreported here.
Seeing an issue where notifications from a python_pip
block are triggered every Chef run. The cause is twofold:
- The code checks the boolean value of
status
, which is aMixlib::ShellOut
object. I don't believe this correctly translates the value ofMixlib::Shellout.status
when being evaluated as a boolean. Not 100% sure on this chain though. pip
returns an exit code of0
when it installs a package successfully. "Success" in this case can involve installing new files, or just confirming that everything is installed already. In the case where you only want to take action upon a changing of requirements we have to inspect the output from pip and check each line.
I don't think this is a big issue for most people since the checks around new_resource.version == current_resource.version
bypass this most of the time. However, I seem to never have a current_resource
populated during Chef runs, so I am hitting the edge case inside status
.
This is a recent bug it seems, and an edge case on my part. The bug is in pip freeze
. See a similar example here:
In my case I do not have any github requirements, though the error is similar.
Since pip freeze
returns error output, @current_resource
will not have a populated version and the comparison will fail, causing the install to proceed, and notifications to be triggered. At this time there isn't much for this cookbook to do, except to implement the workaround described above in 2.
My solution is to ensure I have a working pip freeze
command inside my virtual env. This required me to ensure I was using an older version of setuptools=<7.0
. I have not tried updating pip to <6.0
.