from __future__ import with_statement
+from __future__ import absolute_import
import json
from invirt.common import *
import os
def load_master():
config = dict()
for filename in list_files():
- with closing(file(filename)) as f:
+ with closing(open(filename)) as f:
augment(config, yaml.load(f, loader))
return config
# lock with other concurrent reads). This isolation is accomplished
# using an atomic filesystem rename in the refreshing stage.
try:
- with closing(file(cache_path)) as f:
+ with closing(open(cache_path)) as f:
ns.cfg = json.read(f.read())
except: do_refresh = True
with lock_file(lock_path):
ns.cfg = load_master()
try:
- with closing(file(cache_path + '.tmp', 'w')) as f:
+ with closing(open(cache_path + '.tmp', 'w')) as f:
f.write(json.write(ns.cfg))
except: pass # silent failure
else: rename(cache_path + '.tmp', cache_path)
return ns.cfg
dicts = load()
-structs = dicts2struct(dicts)
-
-# vim:et:sw=4:ts=4
+structs = dicts2struct(dicts, '')
+safestructs = dicts2struct(dicts, '', '')