mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Some more cleanup
This commit is contained in:
parent
253eb49eae
commit
8a0e2ec338
3 changed files with 8 additions and 39 deletions
|
@ -373,8 +373,6 @@ def salt_master(salt_factories, install_salt, state_tree, pillar_tree):
|
|||
if platform.is_windows():
|
||||
if install_salt.classic:
|
||||
master_script = True
|
||||
# this check will need to be changed to install_salt.relenv
|
||||
# once the package version returns 3006 and not 3005 on master
|
||||
if install_salt.relenv:
|
||||
master_script = True
|
||||
elif not install_salt.upgrade:
|
||||
|
|
|
@ -6,11 +6,9 @@ import pathlib
|
|||
import pprint
|
||||
import re
|
||||
import shutil
|
||||
import tarfile
|
||||
import textwrap
|
||||
import time
|
||||
from typing import TYPE_CHECKING, Any, Dict, List
|
||||
from zipfile import ZipFile
|
||||
from typing import TYPE_CHECKING, Dict, List
|
||||
|
||||
import attr
|
||||
import distro
|
||||
|
@ -30,12 +28,6 @@ from saltfactories.cli import call, key, salt
|
|||
from saltfactories.daemons import api, master, minion
|
||||
from saltfactories.utils import cli_scripts
|
||||
|
||||
try:
|
||||
import crypt
|
||||
|
||||
HAS_CRYPT = True
|
||||
except ImportError:
|
||||
HAS_CRYPT = False
|
||||
try:
|
||||
import pwd
|
||||
|
||||
|
@ -43,13 +35,6 @@ try:
|
|||
except ImportError:
|
||||
HAS_PWD = False
|
||||
|
||||
try:
|
||||
import winreg
|
||||
|
||||
HAS_WINREG = True
|
||||
except ImportError:
|
||||
HAS_WINREG = False
|
||||
|
||||
TESTS_DIR = pathlib.Path(__file__).resolve().parent.parent
|
||||
CODE_DIR = TESTS_DIR.parent
|
||||
ARTIFACTS_DIR = CODE_DIR / "artifacts"
|
||||
|
@ -182,23 +167,6 @@ class SaltPkgInstall:
|
|||
# make it to this python session, so we need to update that
|
||||
os.environ["PATH"] = ";".join([str(self.install_dir), os.getenv("path")])
|
||||
|
||||
# When the MSI installer is run from self.proc.run, it doesn't update
|
||||
# the registry. When run from a normal command prompt it does. Until we
|
||||
# figure that out, we will update the process path as above. This
|
||||
# doesn't really check that the path is being set though... but I see
|
||||
# no other way around this
|
||||
# if HAS_WINREG:
|
||||
# log.debug("Refreshing the path")
|
||||
# # Get the updated system path from the registry
|
||||
# path_key = winreg.OpenKeyEx(
|
||||
# winreg.HKEY_LOCAL_MACHINE,
|
||||
# r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment",
|
||||
# )
|
||||
# current_path = winreg.QueryValueEx(path_key, "path")[0]
|
||||
# path_key.Close()
|
||||
# # Update the path for the current running process
|
||||
# os.environ["PATH"] = current_path
|
||||
|
||||
def get_version(self, version_only=False):
|
||||
"""
|
||||
Return the version information needed to install a previous version of Salt.
|
||||
|
@ -219,6 +187,8 @@ class SaltPkgInstall:
|
|||
else:
|
||||
# This is an upgrade, start on the previous version
|
||||
major, minor = self.prev_version.split(".", 1)
|
||||
if version_only:
|
||||
return version
|
||||
return major, minor
|
||||
|
||||
def __attrs_post_init__(self):
|
||||
|
@ -387,10 +357,10 @@ class SaltPkgInstall:
|
|||
|
||||
def package_python_version(self):
|
||||
return self.proc.run(
|
||||
self.binary_paths["python"],
|
||||
str(self.binary_paths["python"][0]),
|
||||
"-c",
|
||||
"import sys; print('{}.{}'.format(*sys.version_info))",
|
||||
).stdout
|
||||
).stdout.strip()
|
||||
|
||||
def install(self, upgrade=False):
|
||||
self._install_pkgs(upgrade=upgrade)
|
||||
|
@ -429,6 +399,7 @@ class SaltPkgInstall:
|
|||
root_url = "py3/"
|
||||
|
||||
if self.distro_name in ["redhat", "centos", "amazon", "fedora", "vmware"]:
|
||||
# Removing EPEL repo files
|
||||
for fp in pathlib.Path("/etc", "yum.repos.d").glob("epel*"):
|
||||
fp.unlink()
|
||||
gpg_key = "SALTSTACK-GPG-KEY.pub"
|
||||
|
|
|
@ -26,15 +26,15 @@ def test_salt_upgrade(salt_call_cli, install_salt):
|
|||
assert "Authentication information could" in use_lib.stderr
|
||||
|
||||
# Upgrade Salt from previous version and test
|
||||
new_py_version = install_salt.package_python_version()
|
||||
install_salt.install(upgrade=True)
|
||||
new_py_version = install_salt.package_python_version()
|
||||
ret = salt_call_cli.run("test.ping")
|
||||
assert ret.returncode == 0
|
||||
assert ret.data
|
||||
|
||||
# Install dep following upgrade
|
||||
# TODO: This should be removed when we stop testing against versions < 3006.0
|
||||
if not install_salt.relenv and original_py_version == new_py_version:
|
||||
if not install_salt.relenv or original_py_version != new_py_version:
|
||||
install = salt_call_cli.run("--local", "pip.install", dep)
|
||||
assert install.returncode == 0
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue