Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
b7f563a6
Commit
b7f563a6
authored
Feb 17, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ansible: remove old action subdirectory.
parent
5f45c2d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
ansible_mitogen/action/__init__.py
ansible_mitogen/action/__init__.py
+0
-0
ansible_mitogen/helpers.py
ansible_mitogen/helpers.py
+18
-5
No files found.
ansible_mitogen/action/__init__.py
deleted
100644 → 0
View file @
5f45c2d4
ansible_mitogen/helpers.py
View file @
b7f563a6
...
...
@@ -51,7 +51,7 @@ class ModuleError(Exception):
self
.
dct
=
dct
def
wtf
_exit_json
(
self
,
**
kwargs
):
def
monkey
_exit_json
(
self
,
**
kwargs
):
"""
Replace AnsibleModule.exit_json() with something that doesn't try to kill
the process or JSON-encode the result dictionary. Instead, cause Exit to be
...
...
@@ -67,7 +67,7 @@ def wtf_exit_json(self, **kwargs):
raise
Exit
(
kwargs
)
def
wtf
_fail_json
(
self
,
**
kwargs
):
def
monkey
_fail_json
(
self
,
**
kwargs
):
"""
Replace AnsibleModule.fail_json() with something that raises ModuleError,
which includes a `dct` attribute.
...
...
@@ -94,8 +94,8 @@ def run_module(module, raw_params=None, args=None):
if
raw_params
is
not
None
:
args
[
'_raw_params'
]
=
raw_params
ansible
.
module_utils
.
basic
.
AnsibleModule
.
exit_json
=
wtf
_exit_json
ansible
.
module_utils
.
basic
.
AnsibleModule
.
fail_json
=
wtf
_fail_json
ansible
.
module_utils
.
basic
.
AnsibleModule
.
exit_json
=
monkey
_exit_json
ansible
.
module_utils
.
basic
.
AnsibleModule
.
fail_json
=
monkey
_fail_json
ansible
.
module_utils
.
basic
.
_ANSIBLE_ARGS
=
json
.
dumps
({
'ANSIBLE_MODULE_ARGS'
:
args
})
...
...
@@ -112,7 +112,14 @@ def run_module(module, raw_params=None, args=None):
return
json
.
dumps
(
e
.
dct
)
def
exec_command
(
cmd
,
in_data
=
None
):
def
exec_command
(
cmd
,
in_data
=
''
):
"""
Run a command in subprocess, arranging for `in_data` to be supplied on its
standard input.
:return:
(return code, stdout bytes, stderr bytes)
"""
proc
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
...
...
@@ -123,8 +130,14 @@ def exec_command(cmd, in_data=None):
def
read_path
(
path
):
"""
Fetch the contents of a filesystem `path` as bytes.
"""
return
open
(
path
,
'rb'
).
read
()
def
write_path
(
path
,
s
):
"""
Writes bytes `s` to a filesystem `path`.
"""
open
(
path
,
'wb'
).
write
(
s
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment