mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Minor fixes in terraform module (#38438)
This fix adds following - * Check for None or blank value in project_path * Make terraform binary path as required Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
9ebad79f40
commit
ae7e391dab
1 changed files with 3 additions and 1 deletions
|
@ -138,6 +138,8 @@ module = None
|
||||||
|
|
||||||
|
|
||||||
def preflight_validation(bin_path, project_path, variables_args=None, plan_file=None):
|
def preflight_validation(bin_path, project_path, variables_args=None, plan_file=None):
|
||||||
|
if project_path in [None, ''] or '/' not in project_path:
|
||||||
|
module.fail_json(msg="Path for Terraform project can not be None or ''.")
|
||||||
if not os.path.exists(bin_path):
|
if not os.path.exists(bin_path):
|
||||||
module.fail_json(msg="Path for Terraform binary '{0}' doesn't exist on this host - check the path and try again please.".format(bin_path))
|
module.fail_json(msg="Path for Terraform binary '{0}' doesn't exist on this host - check the path and try again please.".format(bin_path))
|
||||||
if not os.path.isdir(project_path):
|
if not os.path.isdir(project_path):
|
||||||
|
@ -217,7 +219,7 @@ def main():
|
||||||
if bin_path is not None:
|
if bin_path is not None:
|
||||||
command = [bin_path]
|
command = [bin_path]
|
||||||
else:
|
else:
|
||||||
command = [module.get_bin_path('terraform')]
|
command = [module.get_bin_path('terraform', required=True)]
|
||||||
|
|
||||||
if force_init:
|
if force_init:
|
||||||
init_plugins(command[0], project_path)
|
init_plugins(command[0], project_path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue