-
Notifications
You must be signed in to change notification settings - Fork 83
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 support for debian repository creation #1203
Add support for debian repository creation #1203
Conversation
Can one of the admins verify this patch? |
3f99bfe
to
7490f03
Compare
7490f03
to
f605750
Compare
@omkarkhatavkar Should I ping someone for review? |
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 an interesting situation here. I checked out your code and tried to create a repository.
[ins] In [1]: from robottelo.hosts import ContentHost, Satellite, Capsule, IPAHost
[ins] In [2]: sat = Satellite.get_host_by_hostname('mysatellite.acme.com')
[ins] In [8]: org = sat.api.Organization(id=1).read()
[ins] In [12]: product = sat.api.Product(organization=org).create()
[ins] In [13]: sat.api.Repository(product=product).create()
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[13], line 1
----> 1 sat.api.Repository(product=product).create()
File ~/repos/nailgun/nailgun/entity_mixins.py:987, in EntityCreateMixin.create(self, create_missing)
961 def create(self, create_missing=None):
962 """Create an entity.
963
964 Call :meth:`create_json`, use the response to populate a new object
(...)
985
986 """
--> 987 return self.read(attrs=self.create_json(create_missing))
File ~/repos/nailgun/nailgun/entities.py:6948, in Repository.read(self, entity, attrs, ignore, params)
6946 ignore.add('upstream_password')
6947 ignore.add('mirror_on_sync')
-> 6948 return super().read(entity, attrs, ignore, params)
File ~/repos/nailgun/nailgun/entity_mixins.py:846, in EntityReadMixin.read(self, entity, attrs, ignore, params)
844 setattr(entity, field_name, referenced_entities)
845 else:
--> 846 setattr(entity, field_name, attrs[field_name])
847 return entity
KeyError: 'deb_errata_url'
The above happens when you run nailgun with your patch against a Satellite/Foreman instance that does not have the patch you referenced applied. The fix here is to add deb_errata_url
to ignore
as follows:
diff --git a/nailgun/entities.py b/nailgun/entities.py
index e20055a..ae2d070 100644
--- a/nailgun/entities.py
+++ b/nailgun/entities.py
@@ -6942,6 +6942,9 @@ class Repository(
"""
if ignore is None:
ignore = set()
+ if 'deb_errata_url' not in attrs:
+ ignore.add('deb_errata_url')
+
ignore.add('organization')
ignore.add('upstream_password')
ignore.add('mirror_on_sync')
Although it is not nice, I believe that this is the only way around it with the current nailgun structure/design.
I believe that we should remove all labels that are currently set on this PR and use |
Adding @SatelliteQE/team-phoenix since the patch is related to Repositories component of the product. |
@ogajduse Thanks for the review. That is a good catch, I did not consider that. I will remove the |
f605750
to
5f83b55
Compare
@dosas Can you please comment on this one? |
Since I'm using 6.15.z downstream I would like to backport it to this branch but the other labels can be removed. |
Description of changes
Add support for debian repository creation
Functional demonstration
All tests are green
Additional Information
I'm not sure if there should be explicit tests for debian repo creation?