-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add ability to block and unblock pkg listings #228
Conversation
Thanks @rhartman93 . I'm reviewing this and my notes at #2 |
Ah so 2 failures I see, 1) I have a bad call for the test, extra parameter, I'll remove that. For the test-collection test, it's failing because of a non standard definition of "Required" now that there are conditional requirements. Is this test a standard ansible role test? In which case maybe I can find suggested syntax for this situation. Otherwise, is there a preferable way for me to record this in the doc notes? Or do you have a disagreement with the approach to have these conditionally linked parameters in the module? |
Thank you for writing this PR. I'm still reviewing and testing it on my local Koji instance. Here are my initial thoughts... It looks like Koji always requires an owner for a package, even when blocking it. As this PR is currently written, playbook authors don't need to provide owners for blocked packages. The important thing is that this is how most users use Koji. Once an admin has "blocked" a package in a tag, an admin does not really care who owns it. I'm guessing this is why you've implemented this PR with a simple list? Here's a corner-case. What should the expected behavior be in the following scenario?
Should Ansible add the package that tag to the package and block it (with what user account?) Or show an error to the user (like the I'd like to know more about how you plan to use this feature, so I can know more about how we should implement this so that it's easy to use for most cases. Some other initial thoughts: Let's remove the Regarding documentation: If we get rid of Avoid calling |
Gotcha, so my reasoning behind excluding owners was, I was struggling to think of a use case where you'd be adding a package block to a tag, that doesn't already have the package in it's listing either explicitly in the specified tag, or via inheritance, otherwise, why would you need to block it as it couldn't be tagged in the first place. But there's an argument to be made that maybe this module should provide the ability to sort of preemptively block packages, in which case, your suggestion to add and then block would make sense. I also like the idea of not adding additional states and rather just making the logic driven by which field happens to be populated. I think it will make sense to make them mutually exclusive in that case as well. I'll hopefully be able to make all these updates later on this week |
More discussion in internal ticket CWFCONF-1083 |
Here's the use-case from CWFCONF-1083. Engineers want to block a rapidly-changing package from their
Thinking holistically, it's unclear to me if In this case, the koji administrator has manually run the following command:
They run this every product version, and want to capture this in Ansible. Note, the admin did not mention having to run I'm leaning more towards just punting on the ownership-of-blocked-packages corner-cases. If Ansible cannot block a package (either because it's not in that tag's direct package list, or if it's not inherited), we'll raise an error to the user explaining that they must add the package to a tag or that tag's parents first. |
Add ability to block and unblock pkg listings
Here are the changes from our call yesterday: rhartman93#1 |
Dumping some of my own notes here: Given the following tags:
And the package in the parent tag:
I can run
It then shows up as an entry in the
Once I unblock it, it is no longer present in
|
* tag_packages: fix test assertion for packageListBlock The packageListBlock RPC takes two arguments, not three. * tag_packages: remove unused conditional * tag_packages: handle listPackages() in hubs prior to v1.25 v1.25.0 added the with_owners kwarg for performance, but that release is only five months old. Let's keep support for older hubs. * tag_packages: login immediately before packageListBlock Only login if we are not in check_mode and we have changes to make (we're about to call packageListBlock). * tag_packages: rm "koji: kojidev" from blocked pkg examples Remove this setting to make the examples simpler. * tag_packages: simplify current_blocked list comprehension Simplify the boolean evaluation for pkg['blocked']. * tag_packages: simplify blocked_packages implementation Remove the "blocked" and "unblocked" states. Make blocked_packages a simple list parameter of package names that we will either "block" or "unblock" according to "state: present" or "state: absent". * tag_packages: add package block integration test Assert that we can block and unblock a package from a child tag. * tag_packages: only remove package blocks if present Check listPackages to learn which packages to unblock, rather than directly calling packageListUnblock on the entire list. With this change, koji_tag_packages only reports the packages that it's changing, rather than reporting potentially false changes every time.
I've opened #242 to track adding this feature to the |
Added 'blocked' and 'unblocked' states, requiring separate argument "blocked_packages" which is a list as opposed to the current "packages" dict.