def single_stat_update(args, container_dir, filename):
pipe = os.popen("docker exec " + args.container + " cat " + container_dir + "/" + filename + " 2>&1")
for line in pipe:
stat = line
pipe.close()
# test that the docker command succeeded and pipe contained data
if not 'stat' in locals():
stat = ""
try:
f = open(args.container + "/" + filename,"w")
f.write(stat)
f.close()
except Exception, e:
if not os.path.isdir(args.container):
os.mkdir(args.container)
with open(args.container + "/" + filename, "w") as f:
f.write(stat)
return stat
# helper function to gather stat type data (multiple rows of key value pairs)
discover.py 文件源码
python
阅读 46
收藏 0
点赞 0
评论 0
评论列表
文章目录