propertycacher: make parent directories
Change-Id: I4557ddab56f4cbea5b177e3b05ef28c367c6e602
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/obmc/dbuslib/propertycacher.py b/obmc/dbuslib/propertycacher.py
index 701a413..ce83195 100644
--- a/obmc/dbuslib/propertycacher.py
+++ b/obmc/dbuslib/propertycacher.py
@@ -29,8 +29,11 @@
def save(obj_path, iface_name, properties):
print "Caching: "+obj_path
+ filename = getCacheFilename(obj_path, iface_name)
+ parent = os.path.dirname(filename)
try:
- filename = getCacheFilename(obj_path, iface_name)
+ if not os.path.exists(parent):
+ os.makedirs(parent)
output = open(filename, 'wb')
try:
## use json module to convert dbus datatypes