mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Define defaults for cluster config settings
This commit is contained in:
parent
46eb7f783f
commit
caa5e39303
2 changed files with 16 additions and 5 deletions
|
@ -1653,6 +1653,9 @@ DEFAULT_MASTER_OPTS = immutabletypes.freeze(
|
|||
"netapi_enable_clients": [],
|
||||
"maintenance_interval": 3600,
|
||||
"fileserver_interval": 3600,
|
||||
"cluster_id": None,
|
||||
"cluster_peers": [],
|
||||
"cluster_pki_dir": None,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -4051,12 +4054,20 @@ def apply_master_config(overrides=None, defaults=None):
|
|||
opts["cluster_id"] = None
|
||||
if opts["cluster_id"] is not None:
|
||||
if not opts.get("cluster_peers", None):
|
||||
log.warning("Cluster id defined without defining cluster peers")
|
||||
opts["cluster_peers"] = []
|
||||
if not opts.get("cluster_pki_dir", None):
|
||||
log.warning(
|
||||
"Cluster id defined without defining cluster pki, falling back to pki_dir"
|
||||
)
|
||||
opts["cluster_pki_dir"] = opts["pki_dir"]
|
||||
else:
|
||||
opts["cluster_peers"] = []
|
||||
opts["cluster_pki_dir"] = None
|
||||
if opts.get("cluster_peers", None):
|
||||
log.warning("Cluster peers defined without a cluster_id, ignoring.")
|
||||
opts["cluster_peers"] = []
|
||||
if opts.get("cluster_pki_dir", None):
|
||||
log.warning("Cluster pki defined without a cluster_id, ignoring.")
|
||||
opts["cluster_pki_dir"] = None
|
||||
|
||||
# Enabling open mode requires that the value be set to True, and
|
||||
# nothing else!
|
||||
|
|
|
@ -3,7 +3,7 @@ import salt.config
|
|||
|
||||
def test_apply_no_cluster_id():
|
||||
defaults = salt.config.DEFAULT_MASTER_OPTS.copy()
|
||||
assert "cluster_id" not in defaults
|
||||
assert defaults["cluster_id"] is None
|
||||
|
||||
overrides = {}
|
||||
|
||||
|
@ -16,7 +16,7 @@ def test_apply_no_cluster_id():
|
|||
|
||||
def test_apply_default_for_cluster():
|
||||
defaults = salt.config.DEFAULT_MASTER_OPTS.copy()
|
||||
assert "cluster_id" not in defaults
|
||||
assert defaults["cluster_id"] is None
|
||||
|
||||
overrides = {"cluster_id": "test-cluster"}
|
||||
|
||||
|
@ -35,7 +35,7 @@ def test_apply_default_for_cluster():
|
|||
|
||||
def test_apply_for_cluster():
|
||||
defaults = salt.config.DEFAULT_MASTER_OPTS.copy()
|
||||
assert "cluster_id" not in defaults
|
||||
assert defaults["cluster_id"] is None
|
||||
|
||||
cluster_dir = "/tmp/cluster"
|
||||
overrides = {
|
||||
|
|
Loading…
Add table
Reference in a new issue