pkgng shell migration

This commit is contained in:
Thomas S Hatch 2015-01-07 13:19:16 -07:00
parent 1062e66f71
commit 0748e70889

View File

@ -211,7 +211,8 @@ def refresh_db(jail=None, chroot=None, force=False):
if force:
opts += ' -f'
return __salt__['cmd.retcode'](
'{0} update{1}'.format(_pkg(jail, chroot), opts)) == 0
'{0} update{1}'.format(_pkg(jail, chroot), opts),
python_shell=False) == 0
# Support pkg.update to refresh the db, since this is the CLI usage
@ -249,7 +250,7 @@ def latest_version(*names, **kwargs):
cmd = '{0} search {1}'.format(_pkg(jail, chroot), name)
pkgver = _get_version(
name,
__salt__['cmd.run'](cmd, output_loglevel='trace')
__salt__['cmd.run'](cmd, python_shell=False, output_loglevel='trace')
)
if pkgver is not None:
installed = pkgs.get(name, [])
@ -329,7 +330,10 @@ def list_pkgs(versions_as_list=False,
ret = {}
origins = {}
cmd = '{0} info -ao'.format(_pkg(jail, chroot))
out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace')
out = __salt__['cmd.run_stdout'](
cmd,
python_shell=False,
output_loglevel='trace')
for line in out.splitlines():
if not line:
continue
@ -437,6 +441,7 @@ def stats(local=False, remote=False, jail=None, chroot=None):
res = __salt__['cmd.run'](
'{0} stats {1}'.format(_pkg(jail, chroot), opts),
python_shell=False,
output_loglevel='trace'
)
res = [x.strip("\t") for x in res.split("\n")]
@ -478,6 +483,7 @@ def backup(file_name, jail=None, chroot=None):
'''
res = __salt__['cmd.run'](
'{0} backup -d {1!r}'.format(_pkg(jail, chroot), file_name),
python_shell=False,
output_loglevel='trace'
)
return res.split('...')[1]
@ -518,6 +524,7 @@ def restore(file_name, jail=None, chroot=None):
'''
return __salt__['cmd.run'](
'{0} backup -r {1!r}'.format(_pkg(jail, chroot), file_name),
python_shell=False,
output_loglevel='trace'
)
@ -553,6 +560,7 @@ def audit(jail=None, chroot=None):
'''
return __salt__['cmd.run'](
'{0} audit -F'.format(_pkg(jail, chroot)),
python_shell=False,
output_loglevel='trace'
)
@ -753,7 +761,7 @@ def install(name=None,
cmd = '{0} {1} {2} {3} {4}'.format(
_pkg(jail, chroot), pkg_cmd, repo_opts, opts, ' '.join(targets)
)
__salt__['cmd.run'](cmd, output_loglevel='trace')
__salt__['cmd.run'](cmd, python_shell=False, output_loglevel='trace')
__context__.pop(_contextkey(jail, chroot), None)
__context__.pop(_contextkey(jail, chroot, prefix='pkg.origin'), None)
new = list_pkgs(jail=jail, chroot=chroot)
@ -895,7 +903,7 @@ def remove(name=None,
cmd = '{0} delete {1} {2}'.format(
_pkg(jail, chroot), opts, ' '.join(targets)
)
__salt__['cmd.run'](cmd, output_loglevel='trace')
__salt__['cmd.run'](cmd, python_shell=False, output_loglevel='trace')
__context__.pop(_contextkey(jail, chroot), None)
__context__.pop(_contextkey(jail, chroot, prefix='pkg.origin'), None)
new = list_pkgs(jail=jail, chroot=chroot)
@ -984,6 +992,7 @@ def upgrade(jail=None, chroot=None, force=False, local=False, dryrun=False):
return __salt__['cmd.run'](
'{0} upgrade {1}'.format(_pkg(jail, chroot), opts),
python_shell=False,
output_loglevel='trace'
)
@ -1002,6 +1011,7 @@ def clean(jail=None, chroot=None):
'''
return __salt__['cmd.run'](
'{0} clean'.format(_pkg(jail, chroot)),
python_shell=False,
output_loglevel='trace'
)
@ -1033,6 +1043,7 @@ def autoremove(jail=None, chroot=None, dryrun=False):
opts = '-' + opts
return __salt__['cmd.run'](
'{0} autoremove {1}'.format(_pkg(jail, chroot), opts),
python_shell=False,
output_loglevel='trace'
)
@ -1109,6 +1120,7 @@ def check(jail=None,
return __salt__['cmd.run'](
'{0} check {1}'.format(_pkg(jail, chroot), opts),
python_shell=False,
output_loglevel='trace'
)
@ -1170,6 +1182,7 @@ def which(path, jail=None, chroot=None, origin=False, quiet=False):
opts = '-' + opts
return __salt__['cmd.run'](
'{0} which {1} {2}'.format(_pkg(jail, chroot), opts, path),
python_shell=False,
output_loglevel='trace'
)
@ -1357,6 +1370,7 @@ def search(name,
return __salt__['cmd.run'](
'{0} search {1} {2}'.format(_pkg(jail, chroot), opts, name),
python_shell=False,
output_loglevel='trace'
)
@ -1501,6 +1515,7 @@ def fetch(name,
'{0} fetch -y {1} {2} {3}'.format(
_pkg(jail, chroot), opts, repo_opts, name
),
python_shell=False,
output_loglevel='trace'
)
@ -1567,5 +1582,6 @@ def updating(name,
return __salt__['cmd.run'](
'{0} updating {1} {2}'.format(_pkg(jail, chroot), opts, name),
python_shell=False,
output_loglevel='trace'
)