Check "version" kwarg after parse_targets

This commit is contained in:
Erik Johnson 2013-01-26 19:28:34 -06:00
parent 0812f1653a
commit f8fffbb6c4
2 changed files with 19 additions and 19 deletions

View File

@ -326,15 +326,6 @@ def install(name=None,
{'<package>': {'old': '<old-version>', {'<package>': {'old': '<old-version>',
'new': '<new-version>'}} 'new': '<new-version>'}}
''' '''
# This allows modules to specify the version in a kwarg, like the other
# package modules
if kwargs.get('version'):
if pkgs is None and sources is None:
name = '{0}-{1}'.format(name, kwargs.get('version'))
else:
log.warning('"version" parameter will be ignored for muliple '
'package targets')
# Catch both boolean input from state and string input from CLI # Catch both boolean input from state and string input from CLI
if refresh is True or str(refresh).lower() == 'true': if refresh is True or str(refresh).lower() == 'true':
refresh_db() refresh_db()
@ -355,6 +346,15 @@ def install(name=None,
disablerepo = kwargs.get('disablerepo', '') disablerepo = kwargs.get('disablerepo', '')
enablerepo = kwargs.get('enablerepo', '') enablerepo = kwargs.get('enablerepo', '')
repo = kwargs.get('repo', '') repo = kwargs.get('repo', '')
version = kwargs.get('version')
if version:
if pkgs is None and sources is None:
# Allow "version" to work for single package target
pkg_params = {name: version}
else:
log.warning('"version" parameter will be ignored for muliple '
'package targets')
# Support old "repo" argument # Support old "repo" argument
if not fromrepo and repo: if not fromrepo and repo:

View File

@ -252,15 +252,6 @@ def install(name=None,
{'<package>': {'old': '<old-version>', {'<package>': {'old': '<old-version>',
'new': '<new-version>'}} 'new': '<new-version>'}}
''' '''
# This allows modules to specify the version in a kwarg, like the other
# package modules
if kwargs.get('version'):
if pkgs is None and sources is None:
name = '{0}-{1}'.format(name, kwargs.get('version'))
else:
log.warning('"version" parameter will be ignored for muliple '
'package targets')
# Catch both boolean input from state and string input from CLI # Catch both boolean input from state and string input from CLI
if refresh is True or str(refresh).lower() == 'true': if refresh is True or str(refresh).lower() == 'true':
refresh_db() refresh_db()
@ -275,6 +266,15 @@ def install(name=None,
disablerepo = kwargs.get('disablerepo', '') disablerepo = kwargs.get('disablerepo', '')
enablerepo = kwargs.get('enablerepo', '') enablerepo = kwargs.get('enablerepo', '')
repo = kwargs.get('repo', '') repo = kwargs.get('repo', '')
version = kwargs.get('version')
if version:
if pkgs is None and sources is None:
# Allow "version" to work for single package target
pkg_params = {name: version}
else:
log.warning('"version" parameter will be ignored for muliple '
'package targets')
# Support old "repo" argument # Support old "repo" argument
if not fromrepo and repo: if not fromrepo and repo:
@ -292,7 +292,7 @@ def install(name=None,
log.info('Enabling repo "{0}"'.format(enablerepo)) log.info('Enabling repo "{0}"'.format(enablerepo))
repo_arg += '--enablerepo="{0}" '.format(enablerepo) repo_arg += '--enablerepo="{0}" '.format(enablerepo)
if pkg_type == 'repository' and pkgs: if pkg_type == 'repository':
targets = [] targets = []
for param, version in pkg_params.iteritems(): for param, version in pkg_params.iteritems():
if version is None: if version is None: