mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Remove some duplicate fixtures
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
b092ad5b6e
commit
0a69ad7d1e
2 changed files with 26 additions and 12 deletions
|
@ -21,7 +21,6 @@ from tests.pytests.pkg.support.helpers import (
|
|||
SaltPkgInstall,
|
||||
TestUser,
|
||||
)
|
||||
from tests.support.sminion import create_sminion
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -37,16 +36,6 @@ def version(install_salt):
|
|||
return install_salt.version
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def sminion():
|
||||
return create_sminion()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def grains(sminion):
|
||||
return sminion.opts["grains"].copy()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def _system_up_to_date(
|
||||
grains,
|
||||
|
@ -510,7 +499,7 @@ def salt_minion(salt_factories, salt_master, install_salt):
|
|||
subprocess.run(["chown", "-R", "salt:salt", str(_dir)], check=True)
|
||||
|
||||
factory.after_terminate(
|
||||
pytest.helpers.remove_stale_minion_key_pkg, salt_master, factory.id
|
||||
pytest.helpers.remove_stale_minion_key, salt_master, factory.id
|
||||
)
|
||||
with factory.started(start_timeout=start_timeout):
|
||||
yield factory
|
||||
|
|
|
@ -174,6 +174,31 @@ def remove_stale_minion_key(master, minion_id):
|
|||
log.debug("The minion(id=%r) key was not found at %s", minion_id, key_path)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def remove_stale_master_key(master):
|
||||
keys_path = os.path.join(master.config["pki_dir"], "master")
|
||||
for key_name in ("master.pem", "master.pub"):
|
||||
key_path = os.path.join(keys_path, key_name)
|
||||
if os.path.exists(key_path):
|
||||
os.unlink(key_path)
|
||||
else:
|
||||
log.debug(
|
||||
"The master(id=%r) %s key was not found at %s",
|
||||
master.id,
|
||||
key_name,
|
||||
key_path,
|
||||
)
|
||||
key_path = os.path.join(master.config["pki_dir"], "minion", "minion_master.pub")
|
||||
if os.path.exists(key_path):
|
||||
os.unlink(key_path)
|
||||
else:
|
||||
log.debug(
|
||||
"The master(id=%r) minion_master.pub key was not found at %s",
|
||||
master.id,
|
||||
key_path,
|
||||
)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def remove_stale_proxy_minion_cache_file(proxy_minion, minion_id=None):
|
||||
cachefile = os.path.join(
|
||||
|
|
Loading…
Add table
Reference in a new issue