cs_user: fix E325 (#38158)
This commit is contained in:
parent
8b98c29afd
commit
b06dfbec54
2 changed files with 23 additions and 35 deletions
|
@ -1,22 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# (c) 2015, René Moser <mail@renemoser.net>
|
# Copyright (c) 2015, René Moser <mail@renemoser.net>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['stableinterface'],
|
'status': ['stableinterface'],
|
||||||
|
@ -65,27 +52,29 @@ options:
|
||||||
- If API keys of the user should be generated.
|
- If API keys of the user should be generated.
|
||||||
- "Note: Keys can not be removed by the API again."
|
- "Note: Keys can not be removed by the API again."
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
|
type: bool
|
||||||
|
default: no
|
||||||
domain:
|
domain:
|
||||||
description:
|
description:
|
||||||
- Domain the user is related to.
|
- Domain the user is related to.
|
||||||
default: 'ROOT'
|
default: ROOT
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the user.
|
- State of the user.
|
||||||
- C(unlocked) is an alias for C(enabled).
|
- C(unlocked) is an alias for C(enabled).
|
||||||
default: 'present'
|
default: present
|
||||||
choices: [ 'present', 'absent', 'enabled', 'disabled', 'locked', 'unlocked' ]
|
choices: [ present, absent, enabled, disabled, locked, unlocked ]
|
||||||
poll_async:
|
poll_async:
|
||||||
description:
|
description:
|
||||||
- Poll async jobs until job has finished.
|
- Poll async jobs until job has finished.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'yes'
|
default: yes
|
||||||
extends_documentation_fragment: cloudstack
|
extends_documentation_fragment: cloudstack
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# create an user in domain 'CUSTOMERS'
|
- name: Create an user in domain 'CUSTOMERS'
|
||||||
- local_action:
|
local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
account: developers
|
account: developers
|
||||||
username: johndoe
|
username: johndoe
|
||||||
|
@ -95,29 +84,29 @@ EXAMPLES = '''
|
||||||
email: john.doe@example.com
|
email: john.doe@example.com
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
|
|
||||||
# Lock an existing user in domain 'CUSTOMERS'
|
- name: Lock an existing user in domain 'CUSTOMERS'
|
||||||
- local_action:
|
local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
username: johndoe
|
username: johndoe
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: locked
|
state: locked
|
||||||
|
|
||||||
# Disable an existing user in domain 'CUSTOMERS'
|
- name: Disable an existing user in domain 'CUSTOMERS'
|
||||||
- local_action:
|
local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
username: johndoe
|
username: johndoe
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: disabled
|
state: disabled
|
||||||
|
|
||||||
# Enable/unlock an existing user in domain 'CUSTOMERS'
|
- name: Enable/unlock an existing user in domain 'CUSTOMERS'
|
||||||
- local_action:
|
local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
username: johndoe
|
username: johndoe
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: enabled
|
state: enabled
|
||||||
|
|
||||||
# Remove an user in domain 'CUSTOMERS'
|
- name: Remove an user in domain 'CUSTOMERS'
|
||||||
- local_action:
|
local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
name: customer_xy
|
name: customer_xy
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
|
@ -406,7 +395,7 @@ def main():
|
||||||
last_name=dict(),
|
last_name=dict(),
|
||||||
password=dict(no_log=True),
|
password=dict(no_log=True),
|
||||||
timezone=dict(),
|
timezone=dict(),
|
||||||
keys_registered=dict(type='bool'),
|
keys_registered=dict(type='bool', default=False),
|
||||||
poll_async=dict(type='bool', default=True),
|
poll_async=dict(type='bool', default=True),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -420,16 +409,16 @@ def main():
|
||||||
|
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
|
||||||
if state in ['absent']:
|
if state == 'absent':
|
||||||
user = acs_acc.absent_user()
|
user = acs_acc.absent_user()
|
||||||
|
|
||||||
elif state in ['enabled', 'unlocked']:
|
elif state in ['enabled', 'unlocked']:
|
||||||
user = acs_acc.enable_user()
|
user = acs_acc.enable_user()
|
||||||
|
|
||||||
elif state in ['disabled']:
|
elif state == 'disabled':
|
||||||
user = acs_acc.disable_user()
|
user = acs_acc.disable_user()
|
||||||
|
|
||||||
elif state in ['locked']:
|
elif state == 'locked':
|
||||||
user = acs_acc.lock_user()
|
user = acs_acc.lock_user()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -294,7 +294,6 @@ lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py E326
|
||||||
lib/ansible/modules/cloud/cloudstack/cs_template.py E324
|
lib/ansible/modules/cloud/cloudstack/cs_template.py E324
|
||||||
lib/ansible/modules/cloud/cloudstack/cs_template.py E325
|
lib/ansible/modules/cloud/cloudstack/cs_template.py E325
|
||||||
lib/ansible/modules/cloud/cloudstack/cs_template.py E326
|
lib/ansible/modules/cloud/cloudstack/cs_template.py E326
|
||||||
lib/ansible/modules/cloud/cloudstack/cs_user.py E325
|
|
||||||
lib/ansible/modules/cloud/cloudstack/cs_vmsnapshot.py E325
|
lib/ansible/modules/cloud/cloudstack/cs_vmsnapshot.py E325
|
||||||
lib/ansible/modules/cloud/cloudstack/cs_volume.py E322
|
lib/ansible/modules/cloud/cloudstack/cs_volume.py E322
|
||||||
lib/ansible/modules/cloud/cloudstack/cs_volume.py E324
|
lib/ansible/modules/cloud/cloudstack/cs_volume.py E324
|
||||||
|
|
Loading…
Reference in a new issue