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

[Customer Case]Reregister Host with removed consumer certs #17552

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -2814,3 +2814,47 @@ def test_host_registration_with_capsule_using_content_coherence(
assert 'Validation failed' not in result.stderr, f'Error is: {result.stderr}'
if rhel_contenthost.os_version.major != 7:
assert 'HTTP error code 422' not in result.stderr, f'Error is: {result.stderr}'


@pytest.mark.no_containers
@pytest.mark.rhel_ver_match('9')
@pytest.mark.cli_host_subscription
@pytest.mark.tier3
def test_positive_reregister_rhel(
target_sat,
rhel_contenthost,
function_ak_with_cv,
function_org,
):
"""Reregister a Host after consumer certs have been removed

:id: 23d1ddba-256f-43a9-bd25-797f6a66942d

:steps:
1. Register a Host
2. Remove consumer certs from Host
3. Attempt to reregister the Host

:expectedresults: Host is reregisterd with no errors

:Verifies: SAT-27875

:customerscenario: true
"""
# register client
result = rhel_contenthost.register(function_org, None, function_ak_with_cv.name, target_sat)
assert result.status == 0
assert rhel_contenthost.subscribed
# remove local consumer certs
rhel_contenthost.execute('rm -rf /etc/pki/consumer/*')
status = rhel_contenthost.execute("subscription-manager status")
assert "Overall Status: Unknown" in status.stdout
# reregister host with force
reregister = rhel_contenthost.register(
function_org, None, function_ak_with_cv.name, target_sat, force=True
)
assert reregister.status == 0
assert rhel_contenthost.subscribed
certs = rhel_contenthost.execute("ls /etc/pki/consumer").stdout
assert 'cert.pem' in certs
assert 'key.pem' in certs