1
0
mirror of https://github.com/newnius/YAO-agent.git synced 2025-06-06 21:31:55 +00:00
This commit is contained in:
Newnius 2020-05-05 15:10:31 +08:00
parent f4925f25a5
commit afc5b55a93

View File

@ -118,7 +118,7 @@ class MyHandler(BaseHTTPRequestHandler):
'hostname': container.attrs['Config']['Hostname'], 'hostname': container.attrs['Config']['Hostname'],
'state': container.attrs['State'] 'state': container.attrs['State']
} }
#if container_id in pending_tasks: # if container_id in pending_tasks:
# status['status'] = 'ready' # status['status'] = 'ready'
if status['command'] is not None: if status['command'] is not None:
status['command'] = ' '.join(container.attrs['Config']['Cmd']) status['command'] = ' '.join(container.attrs['Config']['Cmd'])
@ -190,6 +190,7 @@ class MyHandler(BaseHTTPRequestHandler):
if exit_code != 0: if exit_code != 0:
msg["code"] = 1 msg["code"] = 1
msg["error"] = output.decode('utf-8').rstrip('\n') msg["error"] = output.decode('utf-8').rstrip('\n')
print(msg["error"])
except Exception as e: except Exception as e:
msg = {"code": 1, "error": str(e)} msg = {"code": 1, "error": str(e)}
print(str(e)) print(str(e))
@ -363,7 +364,7 @@ def report_msg(stats):
producer = KafkaProducer(bootstrap_servers=KafkaBrokers) producer = KafkaProducer(bootstrap_servers=KafkaBrokers)
future = producer.send('yao', value=data.encode(), partition=0) future = producer.send('yao', value=data.encode(), partition=0)
result = future.get(timeout=10) result = future.get(timeout=10)
print(result) # print(result)
def listener(): def listener():