<s> import json <EOL> __author__ = '<STR_LIT>' <EOL> try : <EOL> from smolder import Charcoal <EOL> HAS_SMOLDER = True <EOL> except ImportError : <EOL> HAS_SMOLDER = False <EOL> DOCUMENTATION = '''<STR_LIT>''' <EOL> EXAMPLES = '''<STR_LIT>''' <EOL> RETURN = '''<STR_LIT>''' <EOL> def main ( ) : <EOL> argument_spec = dict ( <EOL> host = dict ( required = True ) , <EOL> test = dict ( required = True , type = '<STR_LIT>' ) <EOL> ) <EOL> module = AnsibleModule ( argument_spec ) <EOL> test_input = module . params [ "<STR_LIT:test>" ] <EOL> if not HAS_SMOLDER : <EOL> module . fail_json ( msg = '<STR_LIT>' ) <EOL> test_obj = Charcoal ( test = test_input , host = module . params [ "<STR_LIT:host>" ] , output_format = '<STR_LIT>' ) <EOL> test_output = json . loads ( str ( test_obj ) ) <EOL> if test_obj . failed > <NUM_LIT:0> : <EOL> module . fail_json ( msg = "<STR_LIT>" . format ( <EOL> str ( test_obj . failed ) , str ( test_obj . passed + test_obj . failed ) ) , <EOL> stdout = '<STR_LIT>' + test_output [ '<STR_LIT>' ] ) <EOL> elif test_obj . failed == <NUM_LIT:0> and test_obj . passed == <NUM_LIT:0> : <EOL> module . fail_json ( msg = "<STR_LIT>" , stdout = '<STR_LIT>' + test_output [ '<STR_LIT>' ] ) <EOL> else : <EOL> module . exit_json ( msg = "<STR_LIT>" , stdout = '<STR_LIT>' + <EOL> test_output [ '<STR_LIT>' ] , <EOL> response_headers = test_output [ '<STR_LIT>' ] , <EOL> response_status_code = test_output [ '<STR_LIT>' ] , <EOL> request_inputs = test_output [ '<STR_LIT>' ] ) <EOL> from ansible . module_utils . basic import * <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
