mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
I realized that the coercion to oct string I was doing was incorrect.
>>> oct(int(str('744'), 8)) '0744' >>> oct(int(str(744), 8)) '0744' The second should be '1305'. I just went ahead and made the coercion very explicit with an if switch. I verified that all the unit tests and the previously affected integration test succeed.
This commit is contained in:
parent
30e9864d66
commit
8cd50a92ea
@ -2795,12 +2795,20 @@ def makedirs_perms(name,
|
||||
raise
|
||||
if tail == os.curdir: # xxx/newdir/. exists if xxx/newdir exists
|
||||
return
|
||||
|
||||
if type(mode) == int:
|
||||
mode = oct(mode)
|
||||
elif type(mode) == str:
|
||||
mode = oct(int(mode, 8))
|
||||
else:
|
||||
mode = None
|
||||
|
||||
os.mkdir(name)
|
||||
check_perms(name,
|
||||
None,
|
||||
user,
|
||||
group,
|
||||
oct(int(str(mode), 8)) if mode else None)
|
||||
mode)
|
||||
|
||||
|
||||
def get_devmm(name):
|
||||
|
@ -1703,6 +1703,13 @@ def recurse(name,
|
||||
)
|
||||
return ret
|
||||
|
||||
if type(dir_mode) == int:
|
||||
dir_mode = oct(dir_mode)
|
||||
elif type(dir_mode) == str:
|
||||
dir_mode = oct(int(dir_mode, 8))
|
||||
else:
|
||||
dir_mode = None
|
||||
|
||||
# Verify the target directory
|
||||
if not os.path.isdir(name):
|
||||
if os.path.exists(name):
|
||||
@ -1711,7 +1718,7 @@ def recurse(name,
|
||||
ret, 'The path {0} exists and is not a directory'.format(name))
|
||||
if not __opts__['test']:
|
||||
__salt__['file.makedirs_perms'](
|
||||
name, user, group, oct(int(str(dir_mode), 8)) if dir_mode else None)
|
||||
name, user, group, dir_mode)
|
||||
|
||||
def add_comment(path, comment):
|
||||
comments = ret['comment'].setdefault(path, [])
|
||||
|
Loading…
Reference in New Issue
Block a user