mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Fix pre-commit
This commit is contained in:
parent
3f2b63f5bc
commit
b5b850167b
6 changed files with 24 additions and 41 deletions
|
@ -280,27 +280,16 @@ class SaltLoggingClass(LOGGING_LOGGER_CLASS, metaclass=LoggingMixinMeta):
|
||||||
else:
|
else:
|
||||||
extra["exc_info_on_loglevel"] = exc_info_on_loglevel
|
extra["exc_info_on_loglevel"] = exc_info_on_loglevel
|
||||||
|
|
||||||
if sys.version_info < (3, 8):
|
LOGGING_LOGGER_CLASS._log(
|
||||||
LOGGING_LOGGER_CLASS._log(
|
self,
|
||||||
self,
|
level,
|
||||||
level,
|
msg,
|
||||||
msg,
|
args,
|
||||||
args,
|
exc_info=exc_info,
|
||||||
exc_info=exc_info,
|
extra=extra,
|
||||||
extra=extra,
|
stack_info=stack_info,
|
||||||
stack_info=stack_info,
|
stacklevel=stacklevel,
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
LOGGING_LOGGER_CLASS._log(
|
|
||||||
self,
|
|
||||||
level,
|
|
||||||
msg,
|
|
||||||
args,
|
|
||||||
exc_info=exc_info,
|
|
||||||
extra=extra,
|
|
||||||
stack_info=stack_info,
|
|
||||||
stacklevel=stacklevel,
|
|
||||||
)
|
|
||||||
|
|
||||||
def makeRecord(
|
def makeRecord(
|
||||||
self,
|
self,
|
||||||
|
|
|
@ -10,7 +10,6 @@ import ast
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Dict, List
|
|
||||||
|
|
||||||
import salt.utils.doc
|
import salt.utils.doc
|
||||||
import salt.utils.files
|
import salt.utils.files
|
||||||
|
@ -36,7 +35,7 @@ def _get_module_name(tree, filename: str) -> str:
|
||||||
return module_name
|
return module_name
|
||||||
|
|
||||||
|
|
||||||
def _get_func_aliases(tree) -> Dict:
|
def _get_func_aliases(tree) -> dict:
|
||||||
"""
|
"""
|
||||||
Get __func_alias__ dict for mapping function names
|
Get __func_alias__ dict for mapping function names
|
||||||
"""
|
"""
|
||||||
|
@ -54,7 +53,7 @@ def _get_func_aliases(tree) -> Dict:
|
||||||
return fun_aliases
|
return fun_aliases
|
||||||
|
|
||||||
|
|
||||||
def _get_args(function: str) -> Dict:
|
def _get_args(function: str) -> dict:
|
||||||
"""
|
"""
|
||||||
Given a function def, returns arguments and defaults
|
Given a function def, returns arguments and defaults
|
||||||
"""
|
"""
|
||||||
|
@ -128,7 +127,7 @@ def _parse_module_docs(module_path, mod_name=None):
|
||||||
return salt.utils.doc.strip_rst(ret)
|
return salt.utils.doc.strip_rst(ret)
|
||||||
|
|
||||||
|
|
||||||
def _parse_module_functions(module_py: str, return_type: str) -> Dict:
|
def _parse_module_functions(module_py: str, return_type: str) -> dict:
|
||||||
"""
|
"""
|
||||||
Parse module files for proper module_name and function name, then gather
|
Parse module files for proper module_name and function name, then gather
|
||||||
functions and possibly arguments
|
functions and possibly arguments
|
||||||
|
@ -161,7 +160,7 @@ def _parse_module_functions(module_py: str, return_type: str) -> Dict:
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def _get_files(name=False, type="states", return_type="args") -> List:
|
def _get_files(name=False, type="states", return_type="args") -> list:
|
||||||
"""
|
"""
|
||||||
Determine if modules/states directories or files are requested
|
Determine if modules/states directories or files are requested
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ def cluster_create(
|
||||||
cmd += ["--data-checksums"]
|
cmd += ["--data-checksums"]
|
||||||
if wal_segsize:
|
if wal_segsize:
|
||||||
cmd += ["--wal-segsize", wal_segsize]
|
cmd += ["--wal-segsize", wal_segsize]
|
||||||
cmdstr = " ".join([shlex.quote(c) for c in cmd])
|
cmdstr = shlex.join(cmd)
|
||||||
ret = __salt__["cmd.run_all"](cmdstr, python_shell=False)
|
ret = __salt__["cmd.run_all"](cmdstr, python_shell=False)
|
||||||
if ret.get("retcode", 0) != 0:
|
if ret.get("retcode", 0) != 0:
|
||||||
log.error("Error creating a Postgresql cluster %s/%s", version, name)
|
log.error("Error creating a Postgresql cluster %s/%s", version, name)
|
||||||
|
@ -96,7 +96,7 @@ def cluster_list(verbose=False):
|
||||||
salt '*' postgres.cluster_list verbose=True
|
salt '*' postgres.cluster_list verbose=True
|
||||||
"""
|
"""
|
||||||
cmd = [salt.utils.path.which("pg_lsclusters"), "--no-header"]
|
cmd = [salt.utils.path.which("pg_lsclusters"), "--no-header"]
|
||||||
ret = __salt__["cmd.run_all"](" ".join([shlex.quote(c) for c in cmd]))
|
ret = __salt__["cmd.run_all"](shlex.join(cmd))
|
||||||
if ret.get("retcode", 0) != 0:
|
if ret.get("retcode", 0) != 0:
|
||||||
log.error("Error listing clusters")
|
log.error("Error listing clusters")
|
||||||
cluster_dict = _parse_pg_lscluster(ret["stdout"])
|
cluster_dict = _parse_pg_lscluster(ret["stdout"])
|
||||||
|
@ -140,7 +140,7 @@ def cluster_remove(version, name="main", stop=False):
|
||||||
if stop:
|
if stop:
|
||||||
cmd += ["--stop"]
|
cmd += ["--stop"]
|
||||||
cmd += [str(version), name]
|
cmd += [str(version), name]
|
||||||
cmdstr = " ".join([shlex.quote(c) for c in cmd])
|
cmdstr = shlex.join(cmd)
|
||||||
ret = __salt__["cmd.run_all"](cmdstr, python_shell=False)
|
ret = __salt__["cmd.run_all"](cmdstr, python_shell=False)
|
||||||
# FIXME - return Boolean ?
|
# FIXME - return Boolean ?
|
||||||
if ret.get("retcode", 0) != 0:
|
if ret.get("retcode", 0) != 0:
|
||||||
|
|
|
@ -643,7 +643,7 @@ def query(
|
||||||
decode_body=decode_body,
|
decode_body=decode_body,
|
||||||
)
|
)
|
||||||
return ret
|
return ret
|
||||||
except (socket.herror, OSError, socket.timeout, socket.gaierror) as exc:
|
except (socket.herror, OSError, TimeoutError, socket.gaierror) as exc:
|
||||||
if status is True:
|
if status is True:
|
||||||
ret["status"] = 0
|
ret["status"] = 0
|
||||||
ret["error"] = str(exc)
|
ret["error"] = str(exc)
|
||||||
|
|
|
@ -864,12 +864,7 @@ def integration_files_dir(salt_factories):
|
||||||
for child in (PYTESTS_DIR / "integration" / "files").iterdir():
|
for child in (PYTESTS_DIR / "integration" / "files").iterdir():
|
||||||
destpath = dirname / child.name
|
destpath = dirname / child.name
|
||||||
if child.is_dir():
|
if child.is_dir():
|
||||||
if sys.version_info >= (3, 8):
|
shutil.copytree(str(child), str(destpath), dirs_exist_ok=True)
|
||||||
shutil.copytree(str(child), str(destpath), dirs_exist_ok=True)
|
|
||||||
else:
|
|
||||||
if destpath.exists():
|
|
||||||
shutil.rmtree(str(destpath), ignore_errors=True)
|
|
||||||
shutil.copytree(str(child), str(destpath))
|
|
||||||
else:
|
else:
|
||||||
shutil.copyfile(str(child), str(destpath))
|
shutil.copyfile(str(child), str(destpath))
|
||||||
return dirname
|
return dirname
|
||||||
|
|
|
@ -8,7 +8,7 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Dict, List
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import distro
|
import distro
|
||||||
|
@ -50,7 +50,7 @@ class SaltPkgInstall:
|
||||||
ssm_bin: pathlib.Path = attr.ib(default=None)
|
ssm_bin: pathlib.Path = attr.ib(default=None)
|
||||||
bin_dir: pathlib.Path = attr.ib(default=None)
|
bin_dir: pathlib.Path = attr.ib(default=None)
|
||||||
install_dir: pathlib.Path = attr.ib(init=False)
|
install_dir: pathlib.Path = attr.ib(init=False)
|
||||||
binary_paths: Dict[str, List[pathlib.Path]] = attr.ib(init=False)
|
binary_paths: dict[str, list[pathlib.Path]] = attr.ib(init=False)
|
||||||
config_path: str = attr.ib(init=False)
|
config_path: str = attr.ib(init=False)
|
||||||
conf_dir: pathlib.Path = attr.ib()
|
conf_dir: pathlib.Path = attr.ib()
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ class SaltPkgInstall:
|
||||||
pkg_mngr: str = attr.ib(init=False)
|
pkg_mngr: str = attr.ib(init=False)
|
||||||
rm_pkg: str = attr.ib(init=False)
|
rm_pkg: str = attr.ib(init=False)
|
||||||
dbg_pkg: str = attr.ib(init=False)
|
dbg_pkg: str = attr.ib(init=False)
|
||||||
salt_pkgs: List[str] = attr.ib(init=False)
|
salt_pkgs: list[str] = attr.ib(init=False)
|
||||||
pkgs: List[str] = attr.ib(factory=list)
|
pkgs: list[str] = attr.ib(factory=list)
|
||||||
file_ext: bool = attr.ib(default=None)
|
file_ext: bool = attr.ib(default=None)
|
||||||
relenv: bool = attr.ib(default=True)
|
relenv: bool = attr.ib(default=True)
|
||||||
|
|
||||||
|
@ -1558,7 +1558,7 @@ class ApiRequest:
|
||||||
account: TestAccount = attr.ib(repr=False)
|
account: TestAccount = attr.ib(repr=False)
|
||||||
session: requests.Session = attr.ib(init=False, repr=False)
|
session: requests.Session = attr.ib(init=False, repr=False)
|
||||||
api_uri: str = attr.ib(init=False)
|
api_uri: str = attr.ib(init=False)
|
||||||
auth_data: Dict[str, str] = attr.ib(init=False)
|
auth_data: dict[str, str] = attr.ib(init=False)
|
||||||
|
|
||||||
@session.default
|
@session.default
|
||||||
def _default_session(self):
|
def _default_session(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue