mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Converted unittest to pytest.
While we were at it we did a little bit of refactoring.
This commit is contained in:
parent
fca842b071
commit
a2e2b796e5
2 changed files with 839 additions and 749 deletions
|
@ -172,6 +172,14 @@ def _microtime():
|
|||
return "{:f}{}".format(val1, val2)
|
||||
|
||||
|
||||
def _context_or_config(key):
|
||||
"""
|
||||
Return the value corresponding to the key in __context__ or if not present,
|
||||
fallback to config.option.
|
||||
"""
|
||||
return __context__.get(key, __salt__["config.option"](key))
|
||||
|
||||
|
||||
def cert_base_path(cacert_path=None):
|
||||
"""
|
||||
Return the base path for certs from CLI or from options
|
||||
|
@ -185,16 +193,11 @@ def cert_base_path(cacert_path=None):
|
|||
|
||||
salt '*' tls.cert_base_path
|
||||
"""
|
||||
if not cacert_path:
|
||||
cacert_path = __context__.get(
|
||||
"ca.contextual_cert_base_path",
|
||||
__salt__["config.option"]("ca.contextual_cert_base_path"),
|
||||
)
|
||||
if not cacert_path:
|
||||
cacert_path = __context__.get(
|
||||
"ca.cert_base_path", __salt__["config.option"]("ca.cert_base_path")
|
||||
)
|
||||
return cacert_path
|
||||
return (
|
||||
cacert_path
|
||||
or _context_or_config("ca.contextual_cert_base_path")
|
||||
or _context_or_config("ca.cert_base_path")
|
||||
)
|
||||
|
||||
|
||||
def _cert_base_path(cacert_path=None):
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue