Browse code

[stable-2.9] Fix ansible-galaxy --version (#63636)

* [stable-2.9] Added changelog fragment
(cherry picked from commit 7da37e5)

Co-authored-by: Andrea Tartaglia <andrea@braingap.uk>

* Fixes --version in ansible-galaxy cli

(cherry picked from commit 202ad4f89ae56c63c8e29e4d45c78b648e27cfd8)

Toshio Kuratomi authored on 2019/10/18 00:59:14
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,2 @@
0
+bugfixes:
1
+- "ansible-galaxy cli - fixed ``--version`` argument"
... ...
@@ -44,7 +44,7 @@ class GalaxyCLI(CLI):
44 44
 
45 45
     def __init__(self, args):
46 46
         # Inject role into sys.argv[1] as a backwards compatibility step
47
-        if len(args) > 1 and args[1] not in ['-h', '--help'] and 'role' not in args and 'collection' not in args:
47
+        if len(args) > 1 and args[1] not in ['-h', '--help', '--version'] and 'role' not in args and 'collection' not in args:
48 48
             # TODO: Should we add a warning here and eventually deprecate the implicit role subcommand choice
49 49
             # Remove this in Ansible 2.13 when we also remove -v as an option on the root parser for ansible-galaxy.
50 50
             idx = 2 if args[1].startswith('-v') else 1
... ...
@@ -6,6 +6,9 @@ ansible-playbook setup.yml "$@"
6 6
 
7 7
 trap 'ansible-playbook cleanup.yml' EXIT
8 8
 
9
+# Very simple version test
10
+ansible-galaxy --version
11
+
9 12
 # Need a relative custom roles path for testing various scenarios of -p
10 13
 galaxy_relative_rolespath="my/custom/roles/path"
11 14