Normalize version numbers to strings in winrepo

This fixes #5682.
This commit is contained in:
Erik Johnson 2013-06-21 17:40:44 -05:00
parent 67f0b88225
commit bda73dc9cc

View File

@ -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))