mirror of https://github.com/ceph/ceph-ansible.git
library: use exit_module from ca_common
pr #6054 got merged but could have been updated to use `ca_common` for `exit_module()` Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>pull/6078/head
parent
0078230f1d
commit
926a1b2f7b
|
@ -16,6 +16,10 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
try:
|
||||||
|
from ansible.module_utils.ca_common import exit_module
|
||||||
|
except ImportError:
|
||||||
|
from module_utils.ca_common import exit_module
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -93,23 +97,6 @@ EXAMPLES = '''
|
||||||
RETURN = '''# '''
|
RETURN = '''# '''
|
||||||
|
|
||||||
|
|
||||||
def exit_module(module, out, rc, cmd, err, startd, changed=False):
|
|
||||||
endd = datetime.datetime.now()
|
|
||||||
delta = endd - startd
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
cmd=cmd,
|
|
||||||
start=str(startd),
|
|
||||||
end=str(endd),
|
|
||||||
delta=str(delta),
|
|
||||||
rc=rc,
|
|
||||||
stdout=out.rstrip("\r\n"),
|
|
||||||
stderr=err.rstrip("\r\n"),
|
|
||||||
changed=changed,
|
|
||||||
)
|
|
||||||
module.exit_json(**result)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
|
|
|
@ -16,6 +16,10 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
try:
|
||||||
|
from ansible.module_utils.ca_common import exit_module
|
||||||
|
except ImportError:
|
||||||
|
from module_utils.ca_common import exit_module
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -85,23 +89,6 @@ EXAMPLES = '''
|
||||||
RETURN = '''# '''
|
RETURN = '''# '''
|
||||||
|
|
||||||
|
|
||||||
def exit_module(module, out, rc, cmd, err, startd, changed=False):
|
|
||||||
endd = datetime.datetime.now()
|
|
||||||
delta = endd - startd
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
cmd=cmd,
|
|
||||||
start=str(startd),
|
|
||||||
end=str(endd),
|
|
||||||
delta=str(delta),
|
|
||||||
rc=rc,
|
|
||||||
stdout=out.rstrip("\r\n"),
|
|
||||||
stderr=err.rstrip("\r\n"),
|
|
||||||
changed=changed,
|
|
||||||
)
|
|
||||||
module.exit_json(**result)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
|
|
|
@ -4,9 +4,7 @@ from ansible.module_utils._text import to_bytes
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
import sys
|
import ceph_volume_simple_activate
|
||||||
sys.path.append('./library')
|
|
||||||
import ceph_volume_simple_activate # noqa : E402
|
|
||||||
|
|
||||||
fake_cluster = 'ceph'
|
fake_cluster = 'ceph'
|
||||||
fake_container_binary = 'podman'
|
fake_container_binary = 'podman'
|
||||||
|
|
|
@ -4,9 +4,7 @@ from ansible.module_utils._text import to_bytes
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
import sys
|
import ceph_volume_simple_scan
|
||||||
sys.path.append('./library')
|
|
||||||
import ceph_volume_simple_scan # noqa : E402
|
|
||||||
|
|
||||||
fake_cluster = 'ceph'
|
fake_cluster = 'ceph'
|
||||||
fake_container_binary = 'podman'
|
fake_container_binary = 'podman'
|
||||||
|
|
Loading…
Reference in New Issue