Error if shade is too old for domain_id on os_project (#2806)

* Error if shade is too old for domain_id on os_project

os_project's domain_id parameter requires shade >= 1.8.1 to work. Be
explicit.

Fixes #2805 os_project requires python-shade 1.8.1 or higher

* What I really meant was 1.8.0
reviewable/pr18780/r1
Monty Taylor 8 years ago committed by David Shrewsbury
parent 3867cc71a6
commit ae5852449c

@ -21,6 +21,8 @@ try:
except ImportError: except ImportError:
HAS_SHADE = False HAS_SHADE = False
from distutils.version import StrictVersion
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: os_project module: os_project
@ -46,7 +48,8 @@ options:
default: None default: None
domain_id: domain_id:
description: description:
- Domain id to create the project in if the cloud supports domains - Domain id to create the project in if the cloud supports domains.
The domain_id parameter requires shade >= 1.8.0
required: false required: false
default: None default: None
aliases: ['domain'] aliases: ['domain']
@ -160,6 +163,9 @@ def main():
enabled = module.params['enabled'] enabled = module.params['enabled']
state = module.params['state'] state = module.params['state']
if domain and StrictVersion(shade.__version__) < StrictVersion('1.8.0'):
module.fail_json(msg="The domain argument requires shade >=1.8.0")
try: try:
if domain: if domain:
opcloud = shade.operator_cloud(**module.params) opcloud = shade.operator_cloud(**module.params)

Loading…
Cancel
Save