diff options
author | Sloane Hertel <19572925+s-hertel@users.noreply.github.com> | 2022-10-26 17:05:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 16:05:17 -0500 |
commit | 65fd4e182ba1664deec04418af085db92cc6029b (patch) | |
tree | 5599f1e1a96ef55c3aaf2478bab19680e1797728 /test | |
parent | a5480c330db2645c213081955273610b98c67a6c (diff) | |
download | ansible-65fd4e182ba1664deec04418af085db92cc6029b.tar.gz |
[2.13] ansible-galaxy - fix unnecessary api check when installing role (#79143)
* ansible-galaxy install - fix unnecessary api check when installing a role from git repo (#79090)
* delay server api evaluation until a GalaxyRole needs to make an api call for info, list, and install
(cherry picked from commit cb2e434dd2359a9fe1c00e75431f4abeff7381e8)
* fix type for older python
* Fix isinstance check (#79159)
Use GalaxyAPI for isinstance check instead of RoleDistributionServer, since the latter is defined in __main__ sometimes (when running integration tests or ansible-galaxy from source) and importing from ansible.cli.galaxy won't reference the same object.
(cherry picked from commit 89d682464b65af6d2f77a148fc6abb2c38b0e994)
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/ansible-galaxy-role/tasks/main.yml | 3 | ||||
-rwxr-xr-x | test/integration/targets/ansible-galaxy/runme.sh | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/test/integration/targets/ansible-galaxy-role/tasks/main.yml b/test/integration/targets/ansible-galaxy-role/tasks/main.yml index e49e4e2958..03d0b3c243 100644 --- a/test/integration/targets/ansible-galaxy-role/tasks/main.yml +++ b/test/integration/targets/ansible-galaxy-role/tasks/main.yml @@ -1,3 +1,6 @@ +- name: Install role from Galaxy (should not fail with AttributeError) + command: ansible-galaxy role install ansible.nope -vvvv --ignore-errors + - name: Archive directories file: state: directory diff --git a/test/integration/targets/ansible-galaxy/runme.sh b/test/integration/targets/ansible-galaxy/runme.sh index 4bb459588a..0df42aa82b 100755 --- a/test/integration/targets/ansible-galaxy/runme.sh +++ b/test/integration/targets/ansible-galaxy/runme.sh @@ -103,7 +103,11 @@ f_ansible_galaxy_status "install of local git repo" mkdir -p "${galaxy_testdir}" pushd "${galaxy_testdir}" - ansible-galaxy install git+file:///"${galaxy_local_test_role_git_repo}" "$@" + # minimum verbosity is hardcoded to include calls to Galaxy + ansible-galaxy install git+file:///"${galaxy_local_test_role_git_repo}" "$@" -vvvv 2>&1 | tee out.txt + + # Test no initial call is made to Galaxy + grep out.txt -e "https://galaxy.ansible.com" && cat out.txt && exit 1 # Test that the role was installed to the expected directory [[ -d "${HOME}/.ansible/roles/${galaxy_local_test_role}" ]] |