diff --git a/lib/ansible/modules/cloud/misc/serverless.py b/lib/ansible/modules/cloud/misc/serverless.py index 44557d941a2..e77d7519aaa 100644 --- a/lib/ansible/modules/cloud/misc/serverless.py +++ b/lib/ansible/modules/cloud/misc/serverless.py @@ -58,7 +58,7 @@ options: default: true notes: - Currently, the `serverless` command must be in the path of the node executing the task. In the future this may be a flag. -requirements: [ "serverless" ] +requirements: [ "serverless", "yaml" ] author: "Ryan Scott Brown @ryansb" ''' @@ -116,7 +116,12 @@ command: import os import traceback -import yaml + +try: + import yaml + HAS_YAML = True +except ImportError: + HAS_YAML = False from ansible.module_utils.basic import AnsibleModule @@ -159,6 +164,9 @@ def main(): ), ) + if not HAS_YAML: + module.fail_json(msg='yaml is required for this module') + service_path = module.params.get('service_path') state = module.params.get('state') functions = module.params.get('functions') diff --git a/test/sanity/import/skip.txt b/test/sanity/import/skip.txt index 99ec588cce9..acd1b6bfa12 100644 --- a/test/sanity/import/skip.txt +++ b/test/sanity/import/skip.txt @@ -43,7 +43,6 @@ lib/ansible/modules/cloud/dimensiondata/dimensiondata_network.py lib/ansible/modules/cloud/google/gc_storage.py lib/ansible/modules/cloud/google/gcdns_record.py lib/ansible/modules/cloud/google/gcdns_zone.py -lib/ansible/modules/cloud/misc/serverless.py lib/ansible/modules/cloud/ovirt/ovirt_disks.py lib/ansible/modules/cloud/univention/udm_user.py lib/ansible/modules/cloud/webfaction/webfaction_app.py