summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-03-25 13:34:09 +0000
committerGerrit Code Review <gerrit@baserock.org>2015-03-25 13:34:09 +0000
commit53a950fe67039e5c6eb2d948a9a7da096fd3f8b2 (patch)
treecfa2cf192f1a3784571d3cab1ba4c55293279f52
parent40afdf1b28c497954d615b85cf2a53823723e34a (diff)
parent43ca2492036b8f38769674f34682e3a1cd14ffe9 (diff)
downloaddefinitions-53a950fe67039e5c6eb2d948a9a7da096fd3f8b2.tar.gz
Merge "simple-network: Add functionn to create a path if it doesnt exist"
-rwxr-xr-xsimple-network.configure11
1 files changed, 11 insertions, 0 deletions
diff --git a/simple-network.configure b/simple-network.configure
index 42bf1b82..b4988125 100755
--- a/simple-network.configure
+++ b/simple-network.configure
@@ -27,6 +27,7 @@ for DHCP
import os
import sys
+import errno
import cliapp
import morphlib
@@ -256,6 +257,16 @@ class SimpleNetworkConfigurationExtension(cliapp.Application):
return output_stanza
+ def make_sure_path_exists(self, path):
+ try:
+ os.makedirs(path)
+ except OSError as e:
+ if e.errno == errno.EEXIST and os.path.isdir(path):
+ pass
+ else:
+ raise SimpleNetworkError("Unable to create directory '%s'"
+ % path)
+
def status(self, **kwargs):
'''Provide status output.