mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Only open master file if it exists
This commit is contained in:
parent
ddc8f4c232
commit
741918923d
1 changed files with 25 additions and 22 deletions
|
@ -285,28 +285,31 @@ def salt_master(salt_factories, install_salt, state_tree, pillar_tree):
|
|||
"external_auth": {"auto": {"saltdev": [".*"]}},
|
||||
}
|
||||
master_config = install_salt.config_path / "master"
|
||||
with open(master_config) as fp:
|
||||
data = yaml.safe_load(fp)
|
||||
if data and "user" in data:
|
||||
# We are testing a different user, so we need to test the system
|
||||
# configs, or else permissions will not be correct.
|
||||
config_overrides["user"] = data["user"]
|
||||
config_overrides["log_file"] = salt.config.DEFAULT_MASTER_OPTS.get(
|
||||
"log_file"
|
||||
)
|
||||
config_overrides["root_dir"] = salt.config.DEFAULT_MASTER_OPTS.get(
|
||||
"root_dir"
|
||||
)
|
||||
config_overrides["key_logfile"] = salt.config.DEFAULT_MASTER_OPTS.get(
|
||||
"key_logfile"
|
||||
)
|
||||
config_overrides["pki_dir"] = salt.config.DEFAULT_MASTER_OPTS.get("pki_dir")
|
||||
config_overrides["api_logfile"] = salt.config.DEFAULT_API_OPTS.get(
|
||||
"api_logfile"
|
||||
)
|
||||
config_overrides["api_pidfile"] = salt.config.DEFAULT_API_OPTS.get(
|
||||
"api_pidfile"
|
||||
)
|
||||
if master_config.exists():
|
||||
with open(master_config) as fp:
|
||||
data = yaml.safe_load(fp)
|
||||
if data and "user" in data:
|
||||
# We are testing a different user, so we need to test the system
|
||||
# configs, or else permissions will not be correct.
|
||||
config_overrides["user"] = data["user"]
|
||||
config_overrides["log_file"] = salt.config.DEFAULT_MASTER_OPTS.get(
|
||||
"log_file"
|
||||
)
|
||||
config_overrides["root_dir"] = salt.config.DEFAULT_MASTER_OPTS.get(
|
||||
"root_dir"
|
||||
)
|
||||
config_overrides["key_logfile"] = salt.config.DEFAULT_MASTER_OPTS.get(
|
||||
"key_logfile"
|
||||
)
|
||||
config_overrides["pki_dir"] = salt.config.DEFAULT_MASTER_OPTS.get(
|
||||
"pki_dir"
|
||||
)
|
||||
config_overrides["api_logfile"] = salt.config.DEFAULT_API_OPTS.get(
|
||||
"api_logfile"
|
||||
)
|
||||
config_overrides["api_pidfile"] = salt.config.DEFAULT_API_OPTS.get(
|
||||
"api_pidfile"
|
||||
)
|
||||
|
||||
if (platform.is_windows() or platform.is_darwin()) and install_salt.singlebin:
|
||||
start_timeout = 240
|
||||
|
|
Loading…
Add table
Reference in a new issue