Skip to content

Commit

Permalink
Error if shade is too old for domain_id on os_project (ansible#2806)
Browse files Browse the repository at this point in the history
* 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 ansible#2805 os_project requires python-shade 1.8.1 or higher

* What I really meant was 1.8.0
  • Loading branch information
emonty authored and mattclay committed Dec 8, 2016
1 parent 91abacf commit 510e114
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/ansible/modules/extras/cloud/openstack/os_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
except ImportError:
HAS_SHADE = False

from distutils.version import StrictVersion

DOCUMENTATION = '''
---
module: os_project
Expand All @@ -46,7 +48,8 @@
default: None
domain_id:
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
default: None
aliases: ['domain']
Expand Down Expand Up @@ -160,6 +163,9 @@ def main():
enabled = module.params['enabled']
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:
if domain:
opcloud = shade.operator_cloud(**module.params)
Expand Down

0 comments on commit 510e114

Please sign in to comment.