preserve the order of tags when reading the cache file

Use an OrderedDict to preserve the order of tags when reading the
cache file because the Loader assumes the scanner and cache manage the
order of values. Without this change building the release notes with
the cache in place results in random ordering of the output.

Story: #2001934
Task: #14464
Change-Id: I07d73e2e0c2f8bb2fd66f26fcbc088ef9a2a23a5
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann
2018-04-27 15:47:13 -04:00
parent 451d1ebcb9
commit c18078355b
2 changed files with 10 additions and 3 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Correct a problem with version number ordering when reading data
from the cache file. See
https://storyboard.openstack.org/#!/story/2001934 for details.

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
import logging
import os.path
@ -71,10 +72,10 @@ class Loader(object):
# Save the cached scanner output to the same attribute
# it would be in if we had loaded it "live". This
# simplifies some of the logic in the other methods.
self._scanner_output = {
n['version']: n['files']
self._scanner_output = collections.OrderedDict(
(n['version'], n['files'])
for n in self._cache['notes']
}
)
else:
self._scanner = scanner.Scanner(self._config)
self._scanner_output = self._scanner.get_notes_by_version()