-
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
Review entity methods, part 2 #166
Conversation
ec37612
to
8ec61f8
Compare
Part of #41 |
… Nailgun, part 2 Current fix should be merged right after SatelliteQE/nailgun#166 gets to the master branch
Can you paste the test results please? |
Can you show me an example of enabling a repository after this change?
|
If you use If you're working without that helper func, before you had to do smth like this: # Fetch product id by its name
prd_id = entities.Product().fetch_rhproduct_id(
name='Red Hat Enterprise Linux Server',
org_id=org_id
)
# Fetch reposet id by its name
reposet_id = entities.Product(id=prd_id).fetch_reposet_id(
name='Red Hat Satellite Tools 6 Beta (for RHEL 7 Server) (RPMs)')
# Enable RH repo
entities.Product(id=prd_id).enable_rhrepo(
base_arch='x86_64',
release_ver='7Server',
reposet_id=reposet_id,
) And now you should use # Find product by name, save its ID
prd_id = entities.Product(
name='Red Hat Enterprise Linux Server',
organization=org_id,
).search()[0].id
# Find repository set by name
reposet = entities.RepositorySet(
name='Red Hat Satellite Tools 6 Beta (for RHEL 7 Server) (RPMs)',
product=prd_id,
).search()[0]
# Enable RH repo
reposet.enable({'basearch': 'x86_64', 'releasever': '7Server'}) As you can see, |
Accepting only payloads vs attributes in some key methods will add more work to robottelo/sat users. Example: To enable a repo: Before this change: entities.Product(id=prd_id).enable_rhrepo(base_arch='x86_64',release_ver=u'6.7',reposet_id=reposet_id) After this change: reposet = entities.RepositorySet(name=reposet, product=prd_id).search()[0]
reposet.enable({'basearch': basearch, 'releasever': releasever}) Problems:
|
That wasn't fair comparison 😄 If you know the IDs, then you don't have to use # 103
entities.Product(id=prd_id).enable_rhrepo(base_arch='x86_64', release_ver='6.7', reposet_id=reposet_id)
# 105
entities.RepositorySet(id=reposet_id, product=prd_id).enable({'basearch': 'x86_64', 'releasever': '6.7'}) 103 vs 105 characters. Not that big change, and, basically, you should write both commands in 2 lines anyways.
You can read more about why this approach was selected here, Jeremy perfectly described all the pros and cons of each approach. |
Yeah, I wasn't worried about the search part, I am just concerned about the usage of payloads. ok I wasn't aware about the other issue/discussion until today. my bad. I am still reading about why you all chose the payloads approach. |
ACK - Great work! |
8ec61f8
to
af9ac72
Compare
Updated, added even more unit tests. Actually, all the entities starting from |
ACK |
… Nailgun, part 2 Current fix should be merged right after SatelliteQE/nailgun#166 gets to the master branch
@Ichimonji10: Quick update: We discussed this strategy in detail on last friday's meeting and we agreed as a team to go ahead with this strategy, so we are good :) The recommendation is to write some robottelo util functions to overcome issues (mentioning api attribute names in each nailgun call) which this strategy brings to robottelo users. |
@sthirugn Awesome. Sounds good. |
Product
:list_repositorysets()
moved toRepositorySet.list_all()
fetch_rhproduct_id()
(useProduct.search()
instead)fetch_reposet_id()
(useRepositorySet.search()
instead)enable_rhrepo()
now acceptspayload
dict instead of explicit parametersenable_rhrepo()
moved toRepositorySet.enable()
disable_rhrepo()
now acceptspayload
dict instead of explicit parametersdisable_rhrepo()
moved toRepositorySet.disable()
repository_sets_available_repositories()
moved toRepositorySet.available_repositories()
Repository
:search()
fetch_repoid
(useRepository.search()
instead)upload_content()
now acceptspayload
dict instead of explicit parametersRepositorySet
:RepositorySet
RHCIDeployment
:add_hypervisors()
now acceptspayload
dict instead of explicit parametersdeploy()
now acceptspayload
dict instead of explicit parametersSyncPlan
:add_products()
now acceptspayload
dict instead of explicit parametersremove_products()
now acceptspayload
dict instead of explicit parametersUpdated unit tests with changes described above. Added tests for new
RepositorySet
entity.