Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable use of empty manageiq arguments #31774

Merged
merged 2 commits into from
Oct 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/ansible/module_utils/manageiq.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@


def manageiq_argument_spec():
return dict(
options = dict(
url=dict(default=os.environ.get('MIQ_URL', None)),
username=dict(default=os.environ.get('MIQ_USERNAME', None)),
password=dict(default=os.environ.get('MIQ_PASSWORD', None), no_log=True),
Expand All @@ -46,6 +46,12 @@ def manageiq_argument_spec():
ca_bundle_path=dict(required=False, default=None),
)

return dict(
manageiq_connection=dict(type='dict',
default=dict(verify_ssl=True),
options=options),
)


def check_client(module):
if not HAS_CLIENT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,14 @@ def main():
zone_id = None
endpoints = []
argument_spec = dict(
manageiq_connection=dict(required=True, type='dict',
options=manageiq_argument_spec()),
state=dict(choices=['absent', 'present'], default='present'),
name=dict(required=True),
zone=dict(default='default'),
provider_region=dict(),
type=dict(choices=supported_providers().keys()),
)
# add the manageiq connection arguments to the arguments
argument_spec.update(manageiq_argument_spec())
# add the endpoint arguments to the arguments
argument_spec.update(endpoint_list_spec())

Expand Down
21 changes: 11 additions & 10 deletions lib/ansible/modules/remote_management/manageiq/manageiq_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,19 @@ def assign_or_unassign_tags(self, tags, action):

def main():
actions = {'present': 'assign', 'absent': 'unassign', 'list': 'list'}
argument_spec = dict(
tags=dict(type='list'),
resource_name=dict(required=True, type='str'),
resource_type=dict(required=True, type='str',
choices=manageiq_entities().keys()),
state=dict(required=False, type='str',
choices=['present', 'absent', 'list'], default='present'),
)
# add the manageiq connection arguments to the arguments
argument_spec.update(manageiq_argument_spec())

module = AnsibleModule(
argument_spec=dict(
manageiq_connection=dict(required=True, type='dict',
options=manageiq_argument_spec()),
tags=dict(type='list'),
resource_name=dict(required=True, type='str'),
resource_type=dict(required=True, type='str',
choices=manageiq_entities().keys()),
state=dict(required=False, type='str',
choices=['present', 'absent', 'list'], default='present'),
),
argument_spec=argument_spec,
required_if=[
('state', 'present', ['tags']),
('state', 'absent', ['tags'])
Expand Down
26 changes: 14 additions & 12 deletions lib/ansible/modules/remote_management/manageiq/manageiq_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,21 @@ def create_user(self, userid, name, group, password, email):


def main():
argument_spec = dict(
userid=dict(required=True, type='str'),
name=dict(),
password=dict(no_log=True),
group=dict(),
email=dict(),
state=dict(choices=['absent', 'present'], default='present'),
update_password=dict(choices=['always', 'on_create'],
default='always'),
)
# add the manageiq connection arguments to the arguments
argument_spec.update(manageiq_argument_spec())

module = AnsibleModule(
argument_spec=dict(
manageiq_connection=dict(required=True, type='dict',
options=manageiq_argument_spec()),
userid=dict(required=True, type='str'),
name=dict(),
password=dict(no_log=True),
group=dict(),
email=dict(),
state=dict(choices=['absent', 'present'], default='present'),
update_password=dict(choices=['always', 'on_create'],
default='always'),
),
argument_spec=argument_spec,
)

userid = module.params['userid']
Expand Down