Browse code

[stable-2.10] Fix version comparison for determining what ansible to build against (#71152)

* The version comparison for determining what ansible package to build
docs against was comparing the version number for ansible-base but it
needed to check the version number for ansible instead

* add a comment about some bad logic than needs to be fixed after 2.10.0
(cherry picked from commit 37a7485)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>

Toshio Kuratomi authored on 2020/08/08 00:18:25
Showing 1 changed files
... ...
@@ -77,6 +77,10 @@ def generate_full_docs(args):
77 77
 
78 78
     with TemporaryDirectory() as tmp_dir:
79 79
         sh.git(['clone', 'https://github.com/ansible-community/ansible-build-data'], _cwd=tmp_dir)
80
+        # This is wrong.  Once ansible and ansible-base major.minor versions get out of sync this
81
+        # will stop working.  We probably need to walk all subdirectories in reverse version order
82
+        # looking for the latest ansible version which uses something compatible with
83
+        # ansible_base_major_ver.
80 84
         deps_files = glob.glob(os.path.join(tmp_dir, 'ansible-build-data',
81 85
                                             ansible_base_major_ver, '*.deps'))
82 86
         if not deps_files:
... ...
@@ -88,7 +92,7 @@ def generate_full_docs(args):
88 88
         for filename in deps_files:
89 89
             with open(filename, 'r') as f:
90 90
                 deps_data = yaml.safe_load(f.read())
91
-            new_version = Version(deps_data['_ansible_base_version'])
91
+            new_version = Version(deps_data['_ansible_version'])
92 92
             if new_version > latest_ver:
93 93
                 latest_ver = new_version
94 94
                 latest = filename