Add support for priority and humanname in pkrepo zypper backend

humanname is zypper ar --name
priority is zypper mr -p
both are quite important arguments for setting zypper repositories that were
silently ignored. This commit introduces support on them so that pkgrepo will
properly act on them

Signed-off-by: Marcus Rueckert <mrueckert@suse.com>
Signed-off-by: Bo Maryniuk <bmaryniuk@suse.com>
Signed-off-by: Theo Chatzimichos <tchatzimichos@suse.com>
This commit is contained in:
Theo Chatzimichos 2015-11-12 12:04:11 +01:00 committed by rallytime
parent a45ce78e20
commit d167a6b83d

View File

@ -32,6 +32,7 @@ HAS_ZYPP = False
ZYPP_HOME = '/etc/zypp'
LOCKS = '{0}/locks'.format(ZYPP_HOME)
REPOS = '{0}/repos.d'.format(ZYPP_HOME)
DEFAULT_PRIORITY = 99
# Define the module's virtual name
__virtualname__ = 'pkg'
@ -502,6 +503,12 @@ def mod_repo(repo, **kwargs):
if kwargs.get('gpgautoimport') is True:
cmd_opt.append('--gpg-auto-import-keys')
if 'priority' in kwargs:
cmd_opt.append("--priority='{0}'".format(kwargs.get('priority', DEFAULT_PRIORITY)))
if 'humanname' in kwargs:
cmd_opt.append("--name='{0}'".format(kwargs.get('humanname')))
if cmd_opt:
__salt__['cmd.run'](('zypper -x mr {0} \'{1}\''.format(' '.join(cmd_opt), repo)),
output_loglevel='trace')