summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardon <jjardon@gnome.org>2015-03-23 23:02:57 +0000
committerJavier Jardón <jjardon@gnome.org>2015-03-24 00:10:17 +0000
commit7af6598f7019f71833bd9362d580ac07abdb92dd (patch)
tree00a4a0bca607f98f68d1918720c64379c4cf8f57
parent65e9f6f45c669b186eee004ce1cd676b8dd434ae (diff)
downloadmorph-7af6598f7019f71833bd9362d580ac07abdb92dd.tar.gz
simple-network: Add functionn to create a path if it doesnt exist
Change-Id: If011a5518fd30914c89b00099b9d05cff5cd3959
-rwxr-xr-xmorphlib/exts/simple-network.configure11
1 files changed, 11 insertions, 0 deletions
diff --git a/morphlib/exts/simple-network.configure b/morphlib/exts/simple-network.configure
index 42bf1b82..b4988125 100755
--- a/morphlib/exts/simple-network.configure
+++ b/morphlib/exts/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.