From bda73dc9cc4045f6b5e6eb91b60809476de45784 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 21 Jun 2013 17:40:44 -0500 Subject: [PATCH] Normalize version numbers to strings in winrepo This fixes #5682. --- salt/runners/winrepo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/salt/runners/winrepo.py b/salt/runners/winrepo.py index 8f2f172d54..024eda16c2 100644 --- a/salt/runners/winrepo.py +++ b/salt/runners/winrepo.py @@ -14,6 +14,7 @@ import salt.output import salt.utils import logging import salt.minion +from salt._compat import string_types log = logging.getLogger(__name__) @@ -41,11 +42,14 @@ def genrepo(): '{0}: {1}'.format(os.path.join(root, name), exc)) print 'Failed to compile {0}: {1}'.format(os.path.join(root, name), exc) if config: - ret.setdefault('repo', {}).update(config) revmap = {} for pkgname, versions in config.iteritems(): - for repodata in versions.values(): + for version, repodata in versions.iteritems(): + if not isinstance(version, string_types): + config[pkgname][str(version)] = \ + config[pkgname].pop(version) revmap[repodata['full_name']] = pkgname + ret.setdefault('repo', {}).update(config) ret.setdefault('name_map', {}).update(revmap) with salt.utils.fopen(os.path.join(repo, winrepo), 'w') as repo: repo.write(msgpack.dumps(ret))