Handle paths for multiple operating systems

This commit is contained in:
Joseph Hall 2017-02-28 11:41:29 -07:00
parent 3f92184b14
commit 6c5bc20344
3 changed files with 15 additions and 2 deletions

View File

@ -1621,7 +1621,7 @@ DEFAULT_SPM_OPTS = {
# If set, spm_node_type will be either master or minion, but they should
# NOT be a default
'spm_node_type': '',
'spm_share_dir': '/usr/share/salt/spm'
'spm_share_dir': os.path.join(salt.syspaths.SHARE_DIR, 'spm'),
# <---- Salt master settings overridden by SPM ----------------------
}

View File

@ -74,6 +74,19 @@ if CONFIG_DIR is None:
else:
CONFIG_DIR = os.path.join(ROOT_DIR, 'etc', 'salt')
SHARE_DIR = __generated_syspaths.SHARE_DIR
if SHARE_DIR is None:
if __PLATFORM.startswith('win'):
SHARE_DIR = os.path.join(ROOT_DIR, 'share')
elif 'freebsd' in __PLATFORM:
SHARE_DIR = os.path.join(ROOT_DIR, 'usr', 'local', 'share', 'salt')
elif 'netbsd' in __PLATFORM:
SHARE_DIR = os.path.join(ROOT_DIR, 'usr', 'share', 'salt')
elif 'sunos5' in __PLATFORM:
SHARE_DIR = os.path.join(ROOT_DIR, 'usr', 'share', 'salt')
else:
SHARE_DIR = os.path.join(ROOT_DIR, 'usr', 'share', 'salt')
CACHE_DIR = __generated_syspaths.CACHE_DIR
if CACHE_DIR is None:
CACHE_DIR = os.path.join(ROOT_DIR, 'var', 'cache', 'salt')

View File

@ -41,7 +41,7 @@ __opts__ = {
'verbose': False,
'cache': 'localfs',
'spm_repo_dups': 'ignore',
'spm_share_dir': '/usr/share/salt/spm',
'spm_share_dir': os.path.join(_TMP_SPM, 'share'),
}
_F1 = {