mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #24886 from alprs/fix-root_dir_bug
Be more careful about stripping away root_dir from directory options
This commit is contained in:
commit
4ebc01e662
1 changed files with 5 additions and 6 deletions
|
@ -911,14 +911,13 @@ def prepend_root_dir(opts, path_options):
|
|||
'root_dir' option.
|
||||
'''
|
||||
root_dir = os.path.abspath(opts['root_dir'])
|
||||
root_opt = opts['root_dir'].rstrip(os.sep)
|
||||
for path_option in path_options:
|
||||
if path_option in opts:
|
||||
if opts[path_option].startswith(opts['root_dir']):
|
||||
opts[path_option] = opts[path_option][len(opts['root_dir']):]
|
||||
opts[path_option] = salt.utils.path_join(
|
||||
root_dir,
|
||||
opts[path_option]
|
||||
)
|
||||
path = opts[path_option]
|
||||
if path == root_opt or path.startswith(root_opt + os.sep):
|
||||
path = path[len(root_opt):]
|
||||
opts[path_option] = salt.utils.path_join(root_dir, path)
|
||||
|
||||
|
||||
def insert_system_path(opts, paths):
|
||||
|
|
Loading…
Add table
Reference in a new issue