-
Notifications
You must be signed in to change notification settings - Fork 164
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
don't fail when removing a content credential from a repository #1649
Conversation
probably should add tests, right? 🙈 |
and the tests helped me to write the fix correctly |
Mhh. The existing apidoc doesn't have https://projects.theforeman.org/issues/36497 yet. Makes sense. |
@ehelms @mdellweg @Griffin-Sullivan does anyone want to look at this one? 🥺 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Is the /fixtures
directory what we use for "recorded" testing?
Yes, exactly. |
@_check_patch_needed(fixed_version='3.8.0', plugins=['katello']) | ||
def _patch_products_repositories_allow_nil_credential(self): | ||
""" | ||
This is a workaround for the missing allow_nil: true in the Products and Repositories controllers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a in two-three releases of Katello this work around gets dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've been rather conservative in dropping those apidoc patches, but the code is a noop once it detects a new enough version.
foreman-ansible-modules/plugins/module_utils/foreman_helper.py
Lines 109 to 135 in 87e1b51
def _check_patch_needed(introduced_version=None, fixed_version=None, plugins=None): | |
""" | |
Decorator to check whether a specific apidoc patch is required. | |
:param introduced_version: The version of Foreman the API bug was introduced. | |
:type introduced_version: str, optional | |
:param fixed_version: The version of Foreman the API bug was fixed. | |
:type fixed_version: str, optional | |
:param plugins: Which plugins are required for this patch. | |
:type plugins: list, optional | |
""" | |
def decor(f): | |
@wraps(f) | |
def inner(self, *args, **kwargs): | |
if plugins is not None and not all(self.has_plugin(plugin) for plugin in plugins): | |
return | |
if fixed_version is not None and self.foreman_version >= LooseVersion(fixed_version): | |
return | |
if introduced_version is not None and self.foreman_version < LooseVersion(introduced_version): | |
return | |
return f(self, *args, **kwargs) | |
return inner | |
return decor |
No description provided.