Provide a boolean switch to enable/disable publisher refresh
This commit is contained in:
parent
2cb9ec9f0e
commit
0622f387c4
1 changed files with 18 additions and 1 deletions
|
@ -44,12 +44,23 @@ options:
|
|||
- creates a new boot environment with the given name
|
||||
version_added: "2.8"
|
||||
type: str
|
||||
refresh:
|
||||
description:
|
||||
- refresh publishers before execution
|
||||
version_added: "2.8"
|
||||
type: bool
|
||||
default: 'yes'
|
||||
'''
|
||||
EXAMPLES = '''
|
||||
- name: Install Vim
|
||||
pkg5:
|
||||
name: editor/vim
|
||||
|
||||
- name: Install Vim without refreshing publishers
|
||||
pkg5:
|
||||
name: editor/vim
|
||||
refresh: no
|
||||
|
||||
- name: Remove finger daemon
|
||||
pkg5:
|
||||
name: service/network/finger
|
||||
|
@ -74,6 +85,7 @@ def main():
|
|||
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'),
|
||||
refresh=dict(type='bool', default=True),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
@ -135,9 +147,14 @@ def ensure(module, state, packages, params):
|
|||
else:
|
||||
beadm = []
|
||||
|
||||
if params['refresh']:
|
||||
no_refresh = []
|
||||
else:
|
||||
no_refresh = ['--no-refresh']
|
||||
|
||||
to_modify = filter(behaviour[state]['filter'], packages)
|
||||
if to_modify:
|
||||
rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + beadm + ['-q', '--'] + to_modify)
|
||||
rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + beadm + no_refresh + ['-q', '--'] + to_modify)
|
||||
response['rc'] = rc
|
||||
response['results'].append(out)
|
||||
response['msg'] += err
|
||||
|
|
Loading…
Reference in a new issue