mirror of https://github.com/ceph/ceph-ansible.git
30 lines
636 B
Python
30 lines
636 B
Python
|
from ansible.module_utils import basic
|
||
|
from ansible.module_utils._text import to_bytes
|
||
|
import json
|
||
|
|
||
|
|
||
|
def set_module_args(args):
|
||
|
if '_ansible_remote_tmp' not in args:
|
||
|
args['_ansible_remote_tmp'] = '/tmp'
|
||
|
if '_ansible_keep_remote_files' not in args:
|
||
|
args['_ansible_keep_remote_files'] = False
|
||
|
|
||
|
args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
|
||
|
basic._ANSIBLE_ARGS = to_bytes(args)
|
||
|
|
||
|
|
||
|
class AnsibleExitJson(Exception):
|
||
|
pass
|
||
|
|
||
|
|
||
|
class AnsibleFailJson(Exception):
|
||
|
pass
|
||
|
|
||
|
|
||
|
def exit_json(*args, **kwargs):
|
||
|
raise AnsibleExitJson(kwargs)
|
||
|
|
||
|
|
||
|
def fail_json(*args, **kwargs):
|
||
|
raise AnsibleFailJson(kwargs)
|