[cloud] ovirt: add headers param to auth (#27881)

* Add filter param to ovirt module auth

* Update docs to include new filter param

* Fix broken YAML

* Replace filter param with headers
This commit is contained in:
Michele Zuccala 2017-08-11 15:31:20 +02:00 committed by Ryan Brown
commit 7d1308b0d8
4 changed files with 17 additions and 0 deletions

View file

@ -143,6 +143,7 @@ def create_connection(auth):
insecure=auth.get('insecure', False), insecure=auth.get('insecure', False),
token=auth.get('token', None), token=auth.get('token', None),
kerberos=auth.get('kerberos', None), kerberos=auth.get('kerberos', None),
headers=auth.get('headers', None),
) )

View file

@ -84,6 +84,13 @@ options:
description: description:
- "A boolean flag indicating if Kerberos authentication - "A boolean flag indicating if Kerberos authentication
should be used instead of the default basic authentication." should be used instead of the default basic authentication."
headers:
required: False
description:
- "A dictionary of HTTP headers to be added to each API call."
version_added: "2.4"
requirements: requirements:
- python >= 2.7 - python >= 2.7
- ovirt-engine-sdk-python >= 4.0.0 - ovirt-engine-sdk-python >= 4.0.0
@ -168,6 +175,10 @@ ovirt_auth:
returned: success returned: success
type: bool type: bool
sample: False sample: False
headers:
description: Dictionary of HTTP headers to be added to each API call.
returned: success
type: dict
''' '''
import traceback import traceback
@ -192,6 +203,7 @@ def main():
timeout=dict(required=False, type='int', default=0), timeout=dict(required=False, type='int', default=0),
compress=dict(required=False, type='bool', default=True), compress=dict(required=False, type='bool', default=True),
kerberos=dict(required=False, type='bool', default=False), kerberos=dict(required=False, type='bool', default=False),
headers=dict(required=False, type='dict'),
state=dict(default='present', choices=['present', 'absent']), state=dict(default='present', choices=['present', 'absent']),
ovirt_auth=dict(required=None, type='dict'), ovirt_auth=dict(required=None, type='dict'),
), ),
@ -218,6 +230,7 @@ def main():
timeout=params.get('timeout'), timeout=params.get('timeout'),
compress=params.get('compress'), compress=params.get('compress'),
kerberos=params.get('kerberos'), kerberos=params.get('kerberos'),
headers=params.get('headers'),
token=params.get('token'), token=params.get('token'),
) )
try: try:
@ -233,6 +246,7 @@ def main():
timeout=params.get('timeout'), timeout=params.get('timeout'),
compress=params.get('compress'), compress=params.get('compress'),
kerberos=params.get('kerberos'), kerberos=params.get('kerberos'),
headers=params.get('headers'),
) if state == 'present' else dict() ) if state == 'present' else dict()
) )
) )

View file

@ -56,6 +56,7 @@ options:
CA certificate store is used. Default value is set by I(OVIRT_CAFILE) environment variable." CA certificate store is used. Default value is set by I(OVIRT_CAFILE) environment variable."
- "C(kerberos) - A boolean flag indicating if Kerberos authentication - "C(kerberos) - A boolean flag indicating if Kerberos authentication
should be used instead of the default basic authentication." should be used instead of the default basic authentication."
- "C(headers) - Dictionary of HTTP headers to be added to each API call."
timeout: timeout:
description: description:
- "The amount of time in seconds the module should wait for the instance to - "The amount of time in seconds the module should wait for the instance to

View file

@ -53,6 +53,7 @@ options:
CA certificate store is used. Default value is set by I(OVIRT_CAFILE) environment variable." CA certificate store is used. Default value is set by I(OVIRT_CAFILE) environment variable."
- "C(kerberos) - A boolean flag indicating if Kerberos authentication - "C(kerberos) - A boolean flag indicating if Kerberos authentication
should be used instead of the default basic authentication." should be used instead of the default basic authentication."
- "C(headers) - Dictionary of HTTP headers to be added to each API call."
requirements: requirements:
- python >= 2.7 - python >= 2.7
- ovirt-engine-sdk-python >= 4.0.0 - ovirt-engine-sdk-python >= 4.0.0