Merge pull request #3363 from rcarrillocruz/check_default_project_if_present
Only check default_project on resource creation
This commit is contained in:
commit
99659036ca
1 changed files with 7 additions and 7 deletions
|
@ -169,13 +169,6 @@ def main():
|
|||
cloud = shade.openstack_cloud(**module.params)
|
||||
user = cloud.get_user(name)
|
||||
|
||||
project_id = None
|
||||
if default_project:
|
||||
project = cloud.get_project(default_project)
|
||||
if not project:
|
||||
module.fail_json(msg='Default project %s is not valid' % default_project)
|
||||
project_id = project['id']
|
||||
|
||||
if domain:
|
||||
opcloud = shade.operator_cloud(**module.params)
|
||||
try:
|
||||
|
@ -193,6 +186,13 @@ def main():
|
|||
pass
|
||||
|
||||
if state == 'present':
|
||||
project_id = None
|
||||
if default_project:
|
||||
project = cloud.get_project(default_project)
|
||||
if not project:
|
||||
module.fail_json(msg='Default project %s is not valid' % default_project)
|
||||
project_id = project['id']
|
||||
|
||||
if user is None:
|
||||
user = cloud.create_user(
|
||||
name=name, password=password, email=email,
|
||||
|
|
Loading…
Reference in a new issue