mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Salt path options are now global and default to None.
Since we now evaluate each `salt.syspath` entry one by one, we only set the passed settings in the generated `_syspaths` module. The default values will mandate unless explicitly overridden in the setup stage. Refs #19157, #19160, #19161 Fixes #19514 Closes #19515
This commit is contained in:
parent
86ca0bcb13
commit
b2c710e375
1 changed files with 70 additions and 17 deletions
87
setup.py
87
setup.py
|
@ -14,6 +14,7 @@ from __future__ import print_function, with_statement
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
import glob
|
||||||
|
import time
|
||||||
try:
|
try:
|
||||||
from urllib2 import urlopen
|
from urllib2 import urlopen
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -410,6 +411,7 @@ class Build(build):
|
||||||
|
|
||||||
|
|
||||||
class Install(install):
|
class Install(install):
|
||||||
|
# XXX: Remove the Salt Specific Options In Salt Boron. They are now global options
|
||||||
user_options = install.user_options + [
|
user_options = install.user_options + [
|
||||||
('salt-root-dir=', None,
|
('salt-root-dir=', None,
|
||||||
'Salt\'s pre-configured root directory'),
|
'Salt\'s pre-configured root directory'),
|
||||||
|
@ -435,34 +437,51 @@ class Install(install):
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
install.initialize_options(self)
|
install.initialize_options(self)
|
||||||
# pylint: disable=undefined-variable
|
self.salt_root_dir = None
|
||||||
self.salt_root_dir = ROOT_DIR
|
self.salt_config_dir = None
|
||||||
self.salt_config_dir = CONFIG_DIR
|
self.salt_cache_dir = None
|
||||||
self.salt_cache_dir = CACHE_DIR
|
self.salt_sock_dir = None
|
||||||
self.salt_sock_dir = SOCK_DIR
|
self.salt_srv_root_dir = None
|
||||||
self.salt_srv_root_dir = SRV_ROOT_DIR
|
self.salt_base_file_roots_dir = None
|
||||||
self.salt_base_file_roots_dir = BASE_FILE_ROOTS_DIR
|
self.salt_base_pillar_roots_dir = None
|
||||||
self.salt_base_pillar_roots_dir = BASE_PILLAR_ROOTS_DIR
|
self.salt_base_master_roots_dir = None
|
||||||
self.salt_base_master_roots_dir = BASE_MASTER_ROOTS_DIR
|
self.salt_logs_dir = None
|
||||||
self.salt_logs_dir = LOGS_DIR
|
self.salt_pidfile_dir = None
|
||||||
self.salt_pidfile_dir = PIDFILE_DIR
|
|
||||||
# pylint: enable=undefined-variable
|
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
install.finalize_options(self)
|
install.finalize_options(self)
|
||||||
|
|
||||||
|
logged_warnings = False
|
||||||
for optname in ('root_dir', 'config_dir', 'cache_dir', 'sock_dir',
|
for optname in ('root_dir', 'config_dir', 'cache_dir', 'sock_dir',
|
||||||
'srv_root_dir', 'base_file_roots_dir',
|
'srv_root_dir', 'base_file_roots_dir',
|
||||||
'base_pillar_roots_dir', 'base_master_roots_dir',
|
'base_pillar_roots_dir', 'base_master_roots_dir',
|
||||||
'logs_dir', 'pidfile_dir'):
|
'logs_dir', 'pidfile_dir'):
|
||||||
optvalue = getattr(self, 'salt_{0}'.format(optname))
|
optvalue = getattr(self, 'salt_{0}'.format(optname))
|
||||||
if not optvalue:
|
if optvalue is not None:
|
||||||
raise DistutilsArgError(
|
dist_opt_value = getattr(self.distribution, 'salt_{0}'.format(optname))
|
||||||
'The value of --salt-{0} needs a proper path value'.format(
|
logged_warnings = True
|
||||||
|
log.warn(
|
||||||
|
'The \'--salt-{0}\' setting is now a global option just pass it '
|
||||||
|
'right after \'setup.py\'. This install setting will still work '
|
||||||
|
'until Salt Boron but please migrate to the global setting as '
|
||||||
|
'soon as possible.'.format(
|
||||||
optname.replace('_', '-')
|
optname.replace('_', '-')
|
||||||
)
|
)
|
||||||
|
|
||||||
)
|
)
|
||||||
setattr(self.distribution, 'salt_{0}'.format(optname), optvalue)
|
if dist_opt_value is not None:
|
||||||
|
raise DistutilsArgError(
|
||||||
|
'The \'--salt-{0}\' setting was passed as a global option '
|
||||||
|
'and as an option to the install command. Please only pass '
|
||||||
|
'one of them, preferrably the global option since the other '
|
||||||
|
'is now deprecated and will be removed in Salt Boron.'.format(
|
||||||
|
optname.replace('_', '-')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
setattr(self.distribution, 'salt_{0}'.format(optname), optvalue)
|
||||||
|
|
||||||
|
if logged_warnings is True:
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Let's set the running_salt_install attribute so we can add
|
# Let's set the running_salt_install attribute so we can add
|
||||||
|
@ -527,7 +546,28 @@ class SaltDistribution(distutils.dist.Distribution):
|
||||||
global_options = distutils.dist.Distribution.global_options + [
|
global_options = distutils.dist.Distribution.global_options + [
|
||||||
('ssh-packaging', None, 'Run in SSH packaging mode'),
|
('ssh-packaging', None, 'Run in SSH packaging mode'),
|
||||||
('salt-transport=', None, 'The transport to prepare salt for. Choices are \'zeromq\' '
|
('salt-transport=', None, 'The transport to prepare salt for. Choices are \'zeromq\' '
|
||||||
'\'raet\' or \'both\'. Defaults to \'zeromq\'', 'zeromq')
|
'\'raet\' or \'both\'. Defaults to \'zeromq\'', 'zeromq')] + [
|
||||||
|
# Salt's Paths Configuration Settings
|
||||||
|
('salt-root-dir=', None,
|
||||||
|
'Salt\'s pre-configured root directory'),
|
||||||
|
('salt-config-dir=', None,
|
||||||
|
'Salt\'s pre-configured configuration directory'),
|
||||||
|
('salt-cache-dir=', None,
|
||||||
|
'Salt\'s pre-configured cache directory'),
|
||||||
|
('salt-sock-dir=', None,
|
||||||
|
'Salt\'s pre-configured socket directory'),
|
||||||
|
('salt-srv-root-dir=', None,
|
||||||
|
'Salt\'s pre-configured service directory'),
|
||||||
|
('salt-base-file-roots-dir=', None,
|
||||||
|
'Salt\'s pre-configured file roots directory'),
|
||||||
|
('salt-base-pillar-roots-dir=', None,
|
||||||
|
'Salt\'s pre-configured pillar roots directory'),
|
||||||
|
('salt-base-master-roots-dir=', None,
|
||||||
|
'Salt\'s pre-configured master roots directory'),
|
||||||
|
('salt-logs-dir=', None,
|
||||||
|
'Salt\'s pre-configured logs directory'),
|
||||||
|
('salt-pidfile-dir=', None,
|
||||||
|
'Salt\'s pre-configured pidfiles directory'),
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, attrs=None):
|
def __init__(self, attrs=None):
|
||||||
|
@ -536,6 +576,19 @@ class SaltDistribution(distutils.dist.Distribution):
|
||||||
self.ssh_packaging = PACKAGED_FOR_SALT_SSH
|
self.ssh_packaging = PACKAGED_FOR_SALT_SSH
|
||||||
self.salt_transport = None
|
self.salt_transport = None
|
||||||
|
|
||||||
|
# Salt Paths Configuration Settings
|
||||||
|
self.salt_root_dir = None
|
||||||
|
self.salt_config_dir = None
|
||||||
|
self.salt_cache_dir = None
|
||||||
|
self.salt_sock_dir = None
|
||||||
|
self.salt_srv_root_dir = None
|
||||||
|
self.salt_base_file_roots_dir = None
|
||||||
|
self.salt_base_pillar_roots_dir = None
|
||||||
|
self.salt_base_master_roots_dir = None
|
||||||
|
self.salt_logs_dir = None
|
||||||
|
self.salt_pidfile_dir = None
|
||||||
|
|
||||||
|
|
||||||
self.name = 'salt-ssh' if PACKAGED_FOR_SALT_SSH else 'salt'
|
self.name = 'salt-ssh' if PACKAGED_FOR_SALT_SSH else 'salt'
|
||||||
self.version = __version__ # pylint: disable=undefined-variable
|
self.version = __version__ # pylint: disable=undefined-variable
|
||||||
self.description = 'Portable, distributed, remote execution and configuration management system'
|
self.description = 'Portable, distributed, remote execution and configuration management system'
|
||||||
|
|
Loading…
Add table
Reference in a new issue