summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-12-03 19:44:47 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-12-03 19:44:47 +0000
commit607b1607e060ea27a693e7922af58a26ba51d1a0 (patch)
treea0b88568275bdfc52987158807427f04465cde54
parentbdc8183a0c37312af80fa9347b84f60c2fa624c3 (diff)
downloadbcfg2-607b1607e060ea27a693e7922af58a26ba51d1a0.tar.gz
bcfg2-607b1607e060ea27a693e7922af58a26ba51d1a0.tar.bz2
bcfg2-607b1607e060ea27a693e7922af58a26ba51d1a0.zip
fix mkdir -p case
(Logical change 1.157) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@699 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Client/Toolset.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py
index 390c560bd..ec41620b7 100644
--- a/src/lib/Client/Toolset.py
+++ b/src/lib/Client/Toolset.py
@@ -271,17 +271,18 @@ class Toolset(object):
return False
parent = "/".join(entry.get('name').split('/')[:-1])
if parent:
- try:
- sloc = lstat(parent)
+ for idx in xrange(len(parent.split('/')[:-1])):
+ current = '/'+'/'.join(parent.split('/')[1:2+idx])
try:
- if not S_ISDIR(sloc[ST_MODE]):
- unlink(parent)
- mkdir(parent)
+ sloc = lstat(current)
+ try:
+ if not S_ISDIR(sloc[ST_MODE]):
+ unlink(current)
+ mkdir(current)
+ except OSError:
+ return False
except OSError:
- return False
- except OSError:
- # need to handle mkdir -p case
- mkdir(parent)
+ mkdir(current)
# If we get here, then the parent directory should exist
try: