From 0753f1940309add760f7e4e390c34f23eb0e64ee Mon Sep 17 00:00:00 2001 From: amol patil Date: Mon, 30 Dec 2024 15:17:02 +0530 Subject: [PATCH] created new proxy for non-admin user --- tests/foreman/cli/test_ansible.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/foreman/cli/test_ansible.py b/tests/foreman/cli/test_ansible.py index 9e688c4537..224c8efd51 100644 --- a/tests/foreman/cli/test_ansible.py +++ b/tests/foreman/cli/test_ansible.py @@ -710,9 +710,16 @@ def _finalize(): ) assert result.status == 0, f'Failed to register host: {result.stderr}' proxy_id = target_sat.nailgun_smart_proxy.id + new_port = target_sat.available_capsule_port + with target_sat.default_url_on_new_port(9090, new_port) as url: + proxy_id_new = ( + target_sat.api.SmartProxy(url=url) + .search(query={'search': f'name={target_sat.hostname}'})[0] + ) target_host = rhel_contenthost.nailgun_host + new_proxy = proxy_id if auth_type == 'admin' else proxy_id_new target_sat.cli.Ansible.with_user(username, password).roles_sync( - {'role-names': SELECTED_ROLE, 'proxy-id': proxy_id} + {'role-names': SELECTED_ROLE, 'proxy-id': new_proxy} ) result = target_sat.cli.Host.with_user(username, password).ansible_roles_assign( {'id': target_host.id, 'ansible-roles': f'{SELECTED_ROLE}'}