python to flatten dhrp / sshd:sudo python flatten.py 2bbfe079a94259b229ae66962d9d06b97fcdce7a5449775
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python to flatten dhrp / sshd:sudo python flatten.py 2bbfe079a94259b229ae66962d9d06b97fcdce7a5449775相关的知识,希望对你有一定的参考价值。
import os
from StringIO import StringIO
import json
import sys
import subprocess
import shutil
def getParent(rootid, id):
print "--> ", id
with open("/var/lib/docker/graph/"+id+"/json") as data_file:
data = json.load(data_file)
if "parent" in data:
parent = data["parent"]
getParent(rootid, parent)
print "[cp -r /var/lib/docker/graph/"+id+"/* /var/lib/docker/graph/4242"+rootid+"/]"
os.system("cp -r /var/lib/docker/graph/"+id+"/* /var/lib/docker/graph/4242"+rootid+"/")
rootid = sys.argv[-1]
shutil.rmtree(path="/var/lib/docker/graph/4242"+rootid,ignore_errors=True)
print "[mkdir /var/lib/docker/graph/4242"+rootid+"]"
os.mkdir("/var/lib/docker/graph/4242"+rootid)
getParent(rootid, rootid)
data = []
with open("/var/lib/docker/graph/4242"+rootid+"/json", "r") as data_file:
data = json.load(data_file)
data["id"] = "4242" + data["id"]
del data["parent"]
del data["Size"]
with open("/var/lib/docker/graph/4242"+rootid+"/json", "w") as data_file:
json.dump(data, data_file)
shutil.rmtree(path="/var/lib/docker/graph/4242"+rootid+"/layersize",ignore_errors=True)
print "==> 4242"+rootid
以上是关于python to flatten dhrp / sshd:sudo python flatten.py 2bbfe079a94259b229ae66962d9d06b97fcdce7a5449775的主要内容,如果未能解决你的问题,请参考以下文章
leetcode 114. Flatten Binary Tree to Linked List (Python版)
[ERROR ]Failed to execute goal org.codehaus.mojo:flatten-maven-plugin:1.1.0:flatten (flatten) on pro
114. Flatten Binary Tree to Linked List
Flatten Binary Tree to Linked List
LeetCode 114. Flatten Binary Tree to Linked List
Flatten Binary Tree to Linked List