Handle repo argument as described in documentation.

This commit is contained in:
Denis Generalov 2012-09-19 03:14:14 +04:00
parent 9a9896858b
commit 50dbc3a3a1

View File

@ -127,12 +127,17 @@ def install(name, *args, **kwargs):
salt '*' pkg.install <package name>
'''
env = ()
if _check_pkgng():
pkg_command = 'pkg install -y'
if 'repo' in kwargs:
env = (('PACKAGESITE', kwargs['repo']),)
else:
pkg_command = 'pkg_add -r'
if 'repo' in kwargs:
env = (('PACKAGEROOT', kwargs['repo']),)
old = list_pkgs()
__salt__['cmd.retcode']('%s {0}'.format(name) % pkg_command)
__salt__['cmd.retcode']('%s {0}'.format(name) % pkg_command, env=env)
new = list_pkgs()
pkgs = {}
for npkg in new: