add support for the --be-name option (#43030)

* add support for the --be-name option
This commit is contained in:
e-taylor 2018-11-05 07:27:38 -07:00 committed by Brian Coca
parent 6c987a13f9
commit 90ea6c8d12

View file

@ -39,6 +39,11 @@ options:
type: bool
default: 'no'
aliases: [ accept, accept_licences ]
be_name:
description:
- creates a new boot environment with the given name
version_added: "2.8"
type: str
'''
EXAMPLES = '''
- name: Install Vim
@ -68,6 +73,7 @@ def main():
name=dict(type='list', required=True),
state=dict(type='str', default='present', choices=['absent', 'installed', 'latest', 'present', 'removed', 'uninstalled']),
accept_licenses=dict(type='bool', default=False, aliases=['accept', 'accept_licences']),
be_name=dict(type='str'),
),
supports_check_mode=True,
)
@ -124,9 +130,14 @@ def ensure(module, state, packages, params):
else:
accept_licenses = []
if params['be_name']:
beadm = ['--be-name=' + module.params['be_name']]
else:
beadm = []
to_modify = filter(behaviour[state]['filter'], packages)
if to_modify:
rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + ['-q', '--'] + to_modify)
rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + beadm + ['-q', '--'] + to_modify)
response['rc'] = rc
response['results'].append(out)
response['msg'] += err