def collect_win_bios_stats(host=node(), is_threaded=0, queue=None): """Create business logic of the module. This module orchestrates the business logic for this module Returns: return_body(dict): A key, value object that contains the response that is sent to the requester """ reports = { 'messages': [], 'start_time': datetime.now().strftime('%d-%m-%Y %H:%M:%S'), 'capability_name': str(os.path.basename(__file__)[:-3]), 'version': '0', 'host': node(), 'project_dir': os.getcwd(), 'log_path': 'logs', 'outcome': 'Failed', 'content': {}, 'return_body': {} } if is_threaded: pythoncom.CoInitialize() # pylint: disable=E1101 try: _run_process(reports, host) reports['outcome'] = 'Successful' queue.put(utility.reporting(reports)['content']) return utility.reporting(reports) finally: pythoncom.CoUninitialize() # pylint: disable=E1101 else: _run_process(reports, host) reports['outcome'] = 'Successful' return utility.reporting(reports)
def collect_system_stats(machine_name=node()): """Create business logic of the module. This module orchestrates the business logic for this module Returns: return_body(dict): A key, value object that contains the response that is sent to the requester """ reports = { 'messages': [], 'start_time': datetime.now().strftime('%Y-%m-%d %H:%M:%S'), 'capability_name': str(os.path.basename(__file__)[:-3]), 'version': '0', 'host': node(), 'project_dir': os.getcwd(), 'log_path': 'logs/', 'outcome': 'Failed', 'content': {}, 'return_body': {} } print(reports['start_time']) # reports['content'] = get_hardware_information(machine_name) reports['content'] = get_system_information(machine_name) utility.reporting(reports) print('start time: {0}'.format(reports['start_time'])) print('end time: {0}'.format(reports['end_time'])) reports['outcome'] = 'Successful' return utility.reporting(reports)