diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index 97281f94..d3f68647 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -255,12 +255,8 @@ def initialize(cmdset): sys.exit(1) if cmdset.t or cmdset.s or cmdset.a or cmdset.u: neededuid = os.stat('/etc/confluent').st_uid - try: - os.makedirs('/var/lib/confluent') - os.chown('/var/lib/confluent', neededuid, -1) - except OSError as e: - if e.errno != 17: - raise + util.mkdirp('/var/lib/confluent') + os.chown('/var/lib/confluent', neededuid, -1) if cmdset.u: didsomething = True if not glob.glob('/root/.ssh/*.pub'): diff --git a/confluent_server/confluent/util.py b/confluent_server/confluent/util.py index e3f5bfb3..52726302 100644 --- a/confluent_server/confluent/util.py +++ b/confluent_server/confluent/util.py @@ -29,6 +29,14 @@ import struct import eventlet.green.subprocess as subprocess +def mkdirp(path): + try: + os.makedirs(path) + except OSError as e: + if e.errno != 17: + raise + + def run(cmd): process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate()