Skip to content
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

updated curl to register host with name param instead id #17152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amolpati30
Copy link
Contributor

The host is successfully registering using the label/name instead of the ID, and this applies to the following parameters:

  • Organization
  • Location
  • Host group
  • Operating System

@amolpati30 amolpati30 added QETestCoverage Issues and PRs relating to a Satellite bug CherryPick PR needs CherryPick to previous branches AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 6.16.z Introduced in or relating directly to Satellite 6.16 labels Dec 11, 2024
@amolpati30 amolpati30 requested a review from a team as a code owner December 11, 2024 15:56
@amolpati30 amolpati30 force-pushed the register_host_with_curl_with_name_param branch from 3ee8c57 to 7c974c2 Compare December 11, 2024 15:59
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 9592
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_fact.py -k test_positive_upload_host_facts --external-logging
Test Result : ================== 1 passed, 12 warnings in 728.79s (0:12:08) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Dec 11, 2024
@amolpati30 amolpati30 force-pushed the register_host_with_curl_with_name_param branch from 7c974c2 to e3ca50c Compare December 16, 2024 10:30
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Dec 16, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 9630
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_fact.py -k test_positive_upload_host_facts --external-logging
Test Result : ================== 1 failed, 9 warnings in 1495.33s (0:24:55) ==================

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Dec 16, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 9632
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_fact.py -k test_positive_upload_host_facts --external-logging
Test Result : ================== 1 failed, 9 warnings in 831.84s (0:13:51) ===================

Comment on lines 62 to 68
result = cmd[cmd.find('hostgroup_id=') : cmd.find('&update_packages=')]
if ' ' in default_os.title:
default_os.title = default_os.title.replace(' ', '+')
new_data = f'hostgroup={hostgroup.name}&location={module_location.name}&operatingsystem={default_os.title}&organization={module_sca_manifest_org.name}'
updated_cmd = cmd.replace(result, new_data)
assert new_data in updated_cmd
result = rhel_contenthost.execute(updated_cmd)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're switching the generated curl command manually for verifying this RFE, I'd suggest to create a new test for this in test_registration module, as it could impact the existing test and it looks unrelated to facts component, OR if I'm missing some context about this test please correct me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to create a new test for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gauravtalreja1 @shweta83
It was a small section, so I added it to the existing test instead of creating a new one. I don’t believe this change would impact the existing test since the PRT passed previously. Currently, it’s failing due to some internal issues, but otherwise, it should work. However, if you think I should create a new test for this, I’m happy to do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created different method to cover automation, please take a look -

result = rhel_contenthost.execute(cmd)
result = cmd[cmd.find('hostgroup_id=') : cmd.find('&update_packages=')]
if ' ' in default_os.title:
default_os.title = default_os.title.replace(' ', '+')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default_os.title = default_os.title.replace(' ', '+')
new_os_title = default_os.title.replace(' ', '+')

@amolpati30 amolpati30 force-pushed the register_host_with_curl_with_name_param branch 6 times, most recently from c6c3724 to fba5cba Compare December 26, 2024 18:54
@amolpati30 amolpati30 force-pushed the register_host_with_curl_with_name_param branch from fba5cba to 713652b Compare December 26, 2024 19:08
@amolpati30
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_registration.py -k test_registering_with_title_using_global_registration_parameter

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 9712
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_registration.py -k test_registering_with_title_using_global_registration_parameter --external-logging
Test Result : ========== 1 passed, 20 deselected, 31 warnings in 750.57s (0:12:30) ===========

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 6.16.z Introduced in or relating directly to Satellite 6.16 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR QETestCoverage Issues and PRs relating to a Satellite bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants