Various small fixes to MSC modules and tests (#48417)

This commit is contained in:
Dag Wieers 2018-11-13 09:01:45 +01:00 committed by GitHub
commit 24d7b4a660
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 76 additions and 61 deletions

View file

@ -29,9 +29,6 @@ options:
- The name of the label.
required: yes
aliases: [ label_name, name ]
display_name:
description:
- The name of the label displayed in the web UI.
type:
description:
- The type of the label.
@ -99,7 +96,6 @@ def main():
argument_spec.update(
label=dict(type='str', required=False, aliases=['name', 'label_name']),
label_id=dict(type='str', required=False),
display_name=dict(type='str'),
type=dict(type='str', default='site', choices=['site']),
state=dict(type='str', default='present', choices=['absent', 'present', 'query']),
)
@ -116,7 +112,6 @@ def main():
label = module.params['label']
label_id = module.params['label_id']
label_type = module.params['type']
display_name = module.params['display_name']
state = module.params['state']
msc = MSCModule(module)
@ -158,7 +153,7 @@ def main():
msc.sanitize(dict(
id=label_id,
displayName=display_name,
displayName=label,
type=label_type,
), collate=True)

View file

@ -23,20 +23,28 @@ options:
apic_password:
description:
- The password for the APICs.
type: str
required: yes
apic_site_id:
description:
- The site ID of the APICs.
type: str
required: yes
apic_username:
description:
- The username for the APICs.
type: str
required: yes
default: admin
site_id:
description:
- The ID of the site.
type: str
required: yes
site:
description:
- The name of the site.
type: str
required: yes
aliases: [ name, site_name ]
labels:
@ -51,6 +59,7 @@ options:
description:
- Use C(present) or C(absent) for adding or removing.
- Use C(query) for listing an object or multiple objects.
type: str
choices: [ absent, present, query ]
default: present
extends_documentation_fragment: msc
@ -122,7 +131,7 @@ def main():
supports_check_mode=True,
required_if=[
['state', 'absent', ['site']],
['state', 'present', ['site']],
['state', 'present', ['apic_site_id', 'site']],
],
)
@ -178,7 +187,7 @@ def main():
urls=urls,
username=apic_username,
password=apic_password,
))
), collate=True)
if msc.existing:
if not issubset(msc.sent, msc.existing):

View file

@ -23,22 +23,28 @@ options:
tenant_id:
description:
- The ID of the tenant.
type: str
required: yes
tenant:
description:
- The name of the tenant.
type: str
required: yes
aliases: [ name, tenant_name ]
display_name:
description:
- The name of the tenant to be displayed in the web UI.
type: str
required: yes
description:
description:
- The description for this tenant.
type: str
state:
description:
- Use C(present) or C(absent) for adding or removing.
- Use C(query) for listing an object or multiple objects.
type: str
choices: [ absent, present, query ]
default: present
extends_documentation_fragment: msc
@ -52,7 +58,8 @@ EXAMPLES = r'''
password: SomeSecretPassword
tenant: north_europe
tenant_id: 101
description: North European Datacenter
display_name: North European Datacenter
description: This tenant manages the NEDC environment.
state: present
delegate_to: localhost
@ -161,7 +168,7 @@ def main():
displayName=display_name,
siteAssociations=[],
userAssociations=[dict(userId="0000ffff0000000000000020")],
))
), collate=True)
if msc.existing:
if not issubset(msc.sent, msc.existing):