Pass arbitrary kwargs along, for apt.install()

also return the result
This commit is contained in:
Lance Edgar 2020-09-18 15:38:20 -05:00
parent 6cb6ddaba7
commit 6cf17a054b

View file

@ -36,12 +36,12 @@ def install(c, *packages, **kwargs):
"""
Install one or more packages via ``apt-get install``.
"""
frontend = kwargs.get('frontend', 'noninteractive')
target = kwargs.get('target_release')
frontend = kwargs.pop('frontend', 'noninteractive')
target = kwargs.pop('target_release', None)
target = '--target-release={}'.format(target) if target else ''
force_yes = ' --force-yes' if kwargs.get('force_yes') else ''
c.sudo('DEBIAN_FRONTEND={} apt-get --assume-yes {}{} install {}'.format(
frontend, target, force_yes, ' '.join(packages)))
force_yes = ' --force-yes' if kwargs.pop('force_yes', False) else ''
return c.sudo('DEBIAN_FRONTEND={} apt-get --assume-yes {}{} install {}'.format(
frontend, target, force_yes, ' '.join(packages)), **kwargs)
def purge(c, *packages):