zypper: Fix gpg check option for state=latest. --no-gpg-checks is used in new and old zypper versions

reviewable/pr18780/r1
Alexander Gubin 10 years ago
parent 846eb48ea4
commit 50a8774784

@ -148,11 +148,8 @@ def package_present(m, name, installed_state, disable_gpg_check, disable_recomme
if len(packages) != 0: if len(packages) != 0:
cmd = ['/usr/bin/zypper', '--non-interactive'] cmd = ['/usr/bin/zypper', '--non-interactive']
# add global options before zypper command # add global options before zypper command
if disable_gpg_check and not old_zypper: if disable_gpg_check:
cmd.append('--no-gpg-check')
else:
cmd.append('--no-gpg-checks') cmd.append('--no-gpg-checks')
cmd.extend(['install', '--auto-agree-with-licenses']) cmd.extend(['install', '--auto-agree-with-licenses'])
# add install parameter # add install parameter
if disable_recommends and not old_zypper: if disable_recommends and not old_zypper:
@ -182,10 +179,16 @@ def package_latest(m, name, installed_state, disable_gpg_check, disable_recommen
if not changed: if not changed:
pre_upgrade_versions = get_current_version(m, name) pre_upgrade_versions = get_current_version(m, name)
cmd = ['/usr/bin/zypper', '--non-interactive']
if disable_gpg_check:
cmd.append('--no-gpg-checks')
if old_zypper: if old_zypper:
cmd = ['/usr/bin/zypper', '--non-interactive', 'install', '--auto-agree-with-licenses'] cmd.extend(['install', '--auto-agree-with-licenses'])
else: else:
cmd = ['/usr/bin/zypper', '--non-interactive', 'update', '--auto-agree-with-licenses'] cmd.extend(['update', '--auto-agree-with-licenses'])
cmd.extend(name) cmd.extend(name)
rc, stdout, stderr = m.run_command(cmd, check_rc=False) rc, stdout, stderr = m.run_command(cmd, check_rc=False)

Loading…
Cancel
Save