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

fix(client): Status code should indicate registration status #4344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion insights/client/phase/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@ def post_update(client, config):
if config.status:
if reg_check:
logger.info('This host is registered.')
sys.exit(constants.sig_kill_ok)
else:
logger.info('This host is unregistered.')
sys.exit(constants.sig_kill_ok)
sys.exit(constants.sig_kill_bad)

# put this first to avoid conflicts with register
if config.unregister:
Expand Down
4 changes: 2 additions & 2 deletions insights/tests/client/phase/test_post_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ def test_post_update_check_status_registered(insights_config, insights_client, _
def test_post_update_check_status_unregistered(insights_config, insights_client, _isfile):
"""
Just check status.
If unregistered, exit with 100 exit code (kill parent)
If unregistered, exit with 101 exit code (kill parent)
"""
insights_config.return_value.load_all.return_value.status = True
insights_client.return_value.get_registration_status = MagicMock(return_value=False)
with raises(SystemExit) as exc_info:
post_update()
assert exc_info.value.code == 100
assert exc_info.value.code == 101
insights_client.return_value.clear_local_registration.assert_not_called()
insights_client.return_value.set_display_name.assert_not_called()

Expand Down
Loading