Expect upper case message 'levels' for galaxy publish results (#63530)

pull/76751/head
Adrian Likins 3 years ago committed by GitHub
parent 71f3996778
commit 20cc87f059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy publish - Fix warning and error detection in import messages to properly display them in Ansible

@ -715,9 +715,9 @@ class GalaxyAPI:
for message in data.get('messages', []):
level = message['level']
if level == 'error':
if level.lower() == 'error':
display.error("Galaxy import error message: %s" % message['message'])
elif level == 'warning':
elif level.lower() == 'warning':
display.warning("Galaxy import warning message: %s" % message['message'])
else:
display.vvv("Galaxy import message: %s - %s" % (level, message['message']))

@ -509,15 +509,15 @@ def test_wait_import_task_with_failure(server_url, api_version, token_type, toke
},
'messages': [
{
'level': 'error',
'level': 'ERrOR',
'message': u'Somé error',
},
{
'level': 'warning',
'level': 'WARNiNG',
'message': u'Some wärning',
},
{
'level': 'info',
'level': 'INFO',
'message': u'Somé info',
},
],
@ -549,7 +549,7 @@ def test_wait_import_task_with_failure(server_url, api_version, token_type, toke
assert mock_display.mock_calls[0][1][0] == 'Waiting until Galaxy import task %s has completed' % full_import_uri
assert mock_vvv.call_count == 1
assert mock_vvv.mock_calls[0][1][0] == u'Galaxy import message: info - Somé info'
assert mock_vvv.mock_calls[0][1][0] == u'Galaxy import message: INFO - Somé info'
assert mock_warn.call_count == 1
assert mock_warn.mock_calls[0][1][0] == u'Galaxy import warning message: Some wärning'
@ -582,15 +582,15 @@ def test_wait_import_task_with_failure_no_error(server_url, api_version, token_t
'error': {},
'messages': [
{
'level': 'error',
'level': 'ERROR',
'message': u'Somé error',
},
{
'level': 'warning',
'level': 'WARNING',
'message': u'Some wärning',
},
{
'level': 'info',
'level': 'INFO',
'message': u'Somé info',
},
],
@ -622,7 +622,7 @@ def test_wait_import_task_with_failure_no_error(server_url, api_version, token_t
assert mock_display.mock_calls[0][1][0] == 'Waiting until Galaxy import task %s has completed' % full_import_uri
assert mock_vvv.call_count == 1
assert mock_vvv.mock_calls[0][1][0] == u'Galaxy import message: info - Somé info'
assert mock_vvv.mock_calls[0][1][0] == u'Galaxy import message: INFO - Somé info'
assert mock_warn.call_count == 1
assert mock_warn.mock_calls[0][1][0] == u'Galaxy import warning message: Some wärning'

Loading…
Cancel
Save