Using module.fail_json(msg=missing_required_lib('requests'))
format
* testing with new fail * Updating all modules with `missing_required_lib` * Fixing indentation Co-authored-by: Ishan Jain <ishan.jain@gmail.com>
This commit is contained in:
parent
14659d6caf
commit
993776a3a8
@ -123,7 +123,7 @@ output:
|
||||
sample: email
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -213,7 +213,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
@ -161,7 +161,7 @@ output:
|
||||
]
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -208,7 +208,7 @@ def main():
|
||||
module = AnsibleModule(argument_spec=module_args)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = alert_notification_policy(module)
|
||||
|
||||
|
@ -71,7 +71,7 @@ EXAMPLES = '''
|
||||
state: absent
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -132,7 +132,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
@ -92,7 +92,7 @@ RETURN = r'''
|
||||
sample: "grafana-github-datasource"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -156,7 +156,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
@ -125,7 +125,7 @@ RETURN = r'''
|
||||
sample: "https://stackname.grafana.net"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -199,7 +199,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
@ -106,7 +106,7 @@ output:
|
||||
sample: "Ansible Integration Test"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -162,7 +162,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
@ -107,7 +107,7 @@ output:
|
||||
sample: "Datasource added"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -171,7 +171,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
@ -154,7 +154,7 @@ output:
|
||||
sample: "Folder foldername deleted"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
@ -226,7 +226,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
module.fail_json(msg=missing_required_lib('requests'))
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
Loading…
Reference in New Issue
Block a user