-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial logic for printing logs on failure
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python | ||
from ansible.errors import AnsibleError | ||
from ansible.plugins.lookup import LookupBase | ||
from ansible.module_utils.common.text.converters import to_text, to_native | ||
|
||
|
||
class LookupModule(LookupBase): | ||
def run(self, texts, variables=None, **kwargs): | ||
ret = [] | ||
|
||
try: | ||
for text in texts: | ||
ret.append(to_text(text).decode("UTF-16")) | ||
except Exception as e: | ||
raise AnsibleError(to_native(repr(e))) | ||
|
||
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python | ||
from ansible.errors import AnsibleError | ||
from ansible.plugins.lookup import LookupBase | ||
from ansible.module_utils.common.text.converters import to_text, to_native | ||
|
||
|
||
class LookupModule(LookupBase): | ||
def run(self, terms, variables=None, **kwargs): | ||
ret = [] | ||
|
||
try: | ||
for path in terms: | ||
with open(path, "rb") as byte_stream: | ||
text = byte_stream.read() | ||
ret.append(to_text(text.decode("UTF-16"))) | ||
except Exception as e: | ||
raise AnsibleError(to_native(repr(e))) | ||
|
||
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters