mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
minor refactors on plugins/modules/cloud/misc (#2557)
* minor refactors on plugins/modules/cloud/misc * added changelog fragment * removed unreachable statement * Update plugins/modules/cloud/misc/terraform.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/cloud/misc/rhevm.py Co-authored-by: Felix Fontein <felix@fontein.de> * adjusted per PR comment Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
43c12b82fa
commit
3afcf7e75d
7 changed files with 32 additions and 29 deletions
|
@ -139,16 +139,14 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def read_serverless_config(module):
|
||||
path = module.params.get('service_path')
|
||||
full_path = os.path.join(path, 'serverless.yml')
|
||||
|
||||
try:
|
||||
with open(os.path.join(path, 'serverless.yml')) as sls_config:
|
||||
with open(full_path) as sls_config:
|
||||
config = yaml.safe_load(sls_config.read())
|
||||
return config
|
||||
except IOError as e:
|
||||
module.fail_json(msg="Could not open serverless.yml in {0}. err: {1}".format(path, str(e)))
|
||||
|
||||
module.fail_json(msg="Failed to open serverless config at {0}".format(
|
||||
os.path.join(path, 'serverless.yml')))
|
||||
module.fail_json(msg="Could not open serverless.yml in {0}. err: {1}".format(full_path, str(e)))
|
||||
|
||||
|
||||
def get_service_name(module, stage):
|
||||
|
@ -182,7 +180,6 @@ def main():
|
|||
|
||||
service_path = module.params.get('service_path')
|
||||
state = module.params.get('state')
|
||||
functions = module.params.get('functions')
|
||||
region = module.params.get('region')
|
||||
stage = module.params.get('stage')
|
||||
deploy = module.params.get('deploy', True)
|
||||
|
@ -193,7 +190,7 @@ def main():
|
|||
if serverless_bin_path is not None:
|
||||
command = serverless_bin_path + " "
|
||||
else:
|
||||
command = "serverless "
|
||||
command = module.get_bin_path("serverless") + " "
|
||||
|
||||
if state == 'present':
|
||||
command += 'deploy '
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue