Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def save(self):
"""
Saves the node state
"""
self.log(DETAIL, "save: saving site config to %s" % self.path)
try:
self.log(DEBUG, "save: waiting for lock")
self.fileLock.acquire()
self.log(DEBUG, "save: got lock")
confDir = os.path.split(self.path)[0]
tmpFile = os.path.join(self.basedir, ".tmp-%s" % self.name)
f = file(tmpFile, "w")
self.log(DETAIL, "save: writing to temp file %s" % tmpFile)
pp = pprint.PrettyPrinter(width=72, indent=2, stream=f)
js = json.JSONEncoder(indent=2)
w = f.write
def save(self):
"""
Saves the node state
"""
self.log(DETAIL, "save: saving site config to %s" % self.path)
try:
self.log(DEBUG, "save: waiting for lock")
self.fileLock.acquire()
self.log(DEBUG, "save: got lock")
confDir = os.path.split(self.path)[0]
tmpFile = os.path.join(self.basedir, ".tmp-%s" % self.name)
f = file(tmpFile, "w")
self.log(DETAIL, "save: writing to temp file %s" % tmpFile)
pp = pprint.PrettyPrinter(width=72, indent=2, stream=f)
js = json.JSONEncoder(indent=2)
w = f.write
def writeVars(comment="", tail="", **kw):
"""
Pretty-print a 'name=value' line, with optional tail string
"""
def runTest():
mgr = SiteMgr(verbosity=DEBUG)
mgr.insert()