Fix strings

This commit is contained in:
Pedro Algarvio 2021-08-03 08:40:21 +01:00 committed by Gareth J. Greenaway
parent 9ff84d1315
commit 76e50885b0
911 changed files with 9681 additions and 7099 deletions

View file

@ -25,7 +25,7 @@ from sphinx.util.docfields import GroupedField, TypedField
from sphinx.util.nodes import make_refnode
class DocRef(object):
class DocRef:
"""Represents a link to an RFC which defines an HTTP method."""
def __init__(self, base_url, anchor, section):
@ -42,7 +42,7 @@ class DocRef(object):
location of the RFC which defines some HTTP method.
"""
return "{0}#{1}{2}".format(self.base_url, self.anchor, self.section)
return "{}#{}{}".format(self.base_url, self.anchor, self.section)
#: The URL of the HTTP/1.1 RFC which defines the HTTP methods OPTIONS, GET,
@ -293,10 +293,11 @@ def http_statuscode_role(name, rawtext, text, lineno, inliner, options={}, conte
if code == 418:
url = "http://www.ietf.org/rfc/rfc2324.txt"
if code == 449:
url = "http://msdn.microsoft.com/en-us/library" "/dd891478(v=prot.10).aspx"
url = "http://msdn.microsoft.com/en-us/library/dd891478(v=prot.10).aspx"
elif code in HTTP_STATUS_CODES:
url = "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" "#sec10." + (
"%d.%d" % (code // 100, 1 + code % 100)
url = (
"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10."
+ "%d.%d" % (code // 100, 1 + code % 100)
)
else:
url = ""
@ -338,7 +339,7 @@ class HTTPIndex(Index):
shortname = "routing table"
def __init__(self, *args, **kwargs):
super(HTTPIndex, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.ignore = [
[l for l in x.split("/") if l]
@ -351,7 +352,7 @@ class HTTPIndex(Index):
for prefix in self.ignore:
if letters[: len(prefix)] == prefix:
return "/" + "/".join(letters[: len(prefix) + 1])
return "/%s" % (letters[0] if letters else "",)
return "/{}".format(letters[0] if letters else "")
def generate(self, docnames=None):
content = {}
@ -435,7 +436,7 @@ class HTTPDomain(Domain):
@property
def routes(self):
return dict((key, self.data[key]) for key in self.object_types)
return {key: self.data[key] for key in self.object_types}
def clear_doc(self, docname):
for typ, routes in self.routes.items():

View file

@ -107,7 +107,7 @@ def _get_session_python_version_info(session):
session._runner.global_config.install_only = False
session_py_version = session.run(
"python",
"-c"
"-c",
'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))',
silent=True,
log=False,
@ -133,7 +133,7 @@ def _get_session_python_site_packages_dir(session):
session._runner.global_config.install_only = False
site_packages_dir = session.run(
"python",
"-c"
"-c",
"import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())",
silent=True,
log=False,
@ -314,8 +314,8 @@ def _install_requirements(
if EXTRA_REQUIREMENTS_INSTALL:
session.log(
"Installing the following extra requirements because the EXTRA_REQUIREMENTS_INSTALL environment variable "
"was set: %s",
"Installing the following extra requirements because the"
" EXTRA_REQUIREMENTS_INSTALL environment variable was set: %s",
EXTRA_REQUIREMENTS_INSTALL,
)
# We pass --constraint in this step because in case any of these extra dependencies has a requirement

View file

@ -264,7 +264,7 @@ class SaltLoggingClass(
# If both exc_info and exc_info_on_loglevel are both passed, let's fail
if exc_info and exc_info_on_loglevel:
raise LoggingRuntimeError(
"Only one of 'exc_info' and 'exc_info_on_loglevel' is " "permitted"
"Only one of 'exc_info' and 'exc_info_on_loglevel' is permitted"
)
if exc_info_on_loglevel is not None:
if isinstance(exc_info_on_loglevel, str):

View file

@ -453,8 +453,9 @@ class LoadAuth:
if not self.authenticate_eauth(load):
ret["error"] = {
"name": "EauthAuthenticationError",
"message": 'Authentication failure of type "eauth" occurred for '
"user {}.".format(username),
"message": 'Authentication failure of type "eauth" occurred for user {}.'.format(
username
),
}
return ret
@ -528,10 +529,9 @@ class Resolver:
fstr = "{}.auth".format(eauth)
if fstr not in self.auth:
print(
(
'The specified external authentication system "{}" is '
"not available"
).format(eauth)
'The specified external authentication system "{}" is not available'.format(
eauth
)
)
print(
"Available eauth types: {}".format(

View file

@ -170,7 +170,7 @@ def _text(username, password, **kwargs):
this_username = fields[username_field]
except IndexError:
log.error(
"salt.auth.file: username field (%s) does not exist " "in file %s",
"salt.auth.file: username field (%s) does not exist in file %s",
username_field,
filename,
)
@ -179,7 +179,7 @@ def _text(username, password, **kwargs):
this_password = fields[password_field]
except IndexError:
log.error(
"salt.auth.file: password field (%s) does not exist " "in file %s",
"salt.auth.file: password field (%s) does not exist in file %s",
password_field,
filename,
)
@ -252,7 +252,7 @@ def _htfile(username, password, **kwargs):
kwargs["passlib_version"] = passlib.__version__
except ImportError:
log.error(
"salt.auth.file: The python-passlib library is required " "for %s filetype",
"salt.auth.file: The python-passlib library is required for %s filetype",
filetype,
)
return False

View file

@ -273,7 +273,7 @@ def _bind(username, password, anonymous=False, opts=None):
# search for the user's DN to be used for the actual authentication
_ldap = _LDAPConnection(**connargs).ldap
log.debug(
"Running LDAP user dn search with filter:%s, dn:%s, " "scope:%s",
"Running LDAP user dn search with filter:%s, dn:%s, scope:%s",
paramvalues["filter"],
basedn,
scope,

View file

@ -119,7 +119,7 @@ class Beacon:
if not valid:
log.info(
"Beacon %s configuration invalid, " "not running.\n%s",
"Beacon %s configuration invalid, not running.\n%s",
mod,
vcomment,
)
@ -338,7 +338,7 @@ class Beacon:
complete = False
else:
if name in self.opts["beacons"]:
comment = "Updating settings for beacon " "item: {}".format(name)
comment = "Updating settings for beacon item: {}".format(name)
else:
comment = "Added new beacon item: {}".format(name)
complete = True
@ -367,12 +367,11 @@ class Beacon:
if name in self._get_beacons(include_opts=False):
comment = (
"Cannot modify beacon item {}, "
"it is configured in pillar.".format(name)
"Cannot modify beacon item {}, it is configured in pillar.".format(name)
)
complete = False
else:
comment = "Updating settings for beacon " "item: {}".format(name)
comment = "Updating settings for beacon item: {}".format(name)
complete = True
self.opts["beacons"].update(data)
@ -395,8 +394,7 @@ class Beacon:
if name in self._get_beacons(include_opts=False):
comment = (
"Cannot delete beacon item {}, "
"it is configured in pillar.".format(name)
"Cannot delete beacon item {}, it is configured in pillar.".format(name)
)
complete = False
else:
@ -459,8 +457,7 @@ class Beacon:
if name in self._get_beacons(include_opts=False):
comment = (
"Cannot enable beacon item {}, "
"it is configured in pillar.".format(name)
"Cannot enable beacon item {}, it is configured in pillar.".format(name)
)
complete = False
else:
@ -488,8 +485,9 @@ class Beacon:
if name in self._get_beacons(include_opts=False):
comment = (
"Cannot disable beacon item {}, "
"it is configured in pillar.".format(name)
"Cannot disable beacon item {}, it is configured in pillar.".format(
name
)
)
complete = False
else:

View file

@ -30,18 +30,18 @@ def validate(config):
# Configuration for adb beacon should be a dictionary with states array
if not isinstance(config, list):
log.info("Configuration for adb beacon must be a list.")
return False, ("Configuration for adb beacon must be a list.")
return False, "Configuration for adb beacon must be a list."
_config = {}
list(map(_config.update, config))
if "states" not in _config:
log.info("Configuration for adb beacon must include a states array.")
return False, ("Configuration for adb beacon must include a states array.")
return False, "Configuration for adb beacon must include a states array."
else:
if not isinstance(_config["states"], list):
log.info("Configuration for adb beacon must include a states array.")
return False, ("Configuration for adb beacon must include a states array.")
return False, "Configuration for adb beacon must include a states array."
else:
states = [
"offline",
@ -57,13 +57,12 @@ def validate(config):
]
if any(s not in states for s in _config["states"]):
log.info(
"Need a one of the following adb " "states: %s", ", ".join(states)
"Need a one of the following adb states: %s", ", ".join(states)
)
return (
False,
(
"Need a one of the following adb "
"states: {}".format(", ".join(states))
"Need a one of the following adb states: {}".format(
", ".join(states)
),
)
return True, "Valid beacon configuration"

View file

@ -16,13 +16,12 @@ def __virtual__():
"""
Only load if kernel is AIX
"""
if __grains__["kernel"] == ("AIX"):
if __grains__["kernel"] == "AIX":
return __virtualname__
return (
False,
"The aix_account beacon module failed to load: "
"only available on AIX systems.",
"The aix_account beacon module failed to load: only available on AIX systems.",
)
@ -32,14 +31,11 @@ def validate(config):
"""
# Configuration for aix_account beacon should be a dictionary
if not isinstance(config, dict):
return False, ("Configuration for aix_account beacon must be a dict.")
return False, "Configuration for aix_account beacon must be a dict."
if "user" not in config:
return (
False,
(
"Configuration for aix_account beacon must "
"include a user or ALL for all users."
),
"Configuration for aix_account beacon must include a user or ALL for all users.",
)
return True, "Valid beacon configuration"

View file

@ -55,13 +55,15 @@ def __virtual__():
return __virtualname__
return (
False,
"The {} beacon cannot be loaded. The "
"'python-dbus' dependency is missing.".format(__virtualname__),
"The {} beacon cannot be loaded. The 'python-dbus' dependency is missing.".format(
__virtualname__
),
)
return (
False,
"The {} beacon cannot be loaded. The "
"'python-avahi' dependency is missing.".format(__virtualname__),
"The {} beacon cannot be loaded. The 'python-avahi' dependency is missing.".format(
__virtualname__
),
)
@ -73,15 +75,12 @@ def validate(config):
list(map(_config.update, config))
if not isinstance(config, list):
return False, ("Configuration for avahi_announce beacon must be a list.")
return False, "Configuration for avahi_announce beacon must be a list."
elif not all(x in _config for x in ("servicetype", "port", "txt")):
return (
False,
(
"Configuration for avahi_announce beacon "
"must contain servicetype, port and txt items."
),
"Configuration for avahi_announce beacon must contain servicetype, port and txt items.",
)
return True, "Valid beacon configuration."

View file

@ -55,15 +55,12 @@ def validate(config):
list(map(_config.update, config))
if not isinstance(config, list):
return False, ("Configuration for bonjour_announce beacon must be a list.")
return False, "Configuration for bonjour_announce beacon must be a list."
elif not all(x in _config for x in ("servicetype", "port", "txt")):
return (
False,
(
"Configuration for bonjour_announce beacon "
"must contain servicetype, port and txt items."
),
"Configuration for bonjour_announce beacon must contain servicetype, port and txt items.",
)
return True, "Valid beacon configuration."

View file

@ -142,14 +142,12 @@ def _validate_time_range(trange, status, msg):
if not isinstance(trange, dict):
status = False
msg = "The time_range parameter for " "btmp beacon must " "be a dictionary."
msg = "The time_range parameter for btmp beacon must be a dictionary."
if not all(k in trange for k in ("start", "end")):
status = False
msg = (
"The time_range parameter for "
"btmp beacon must contain "
"start & end options."
"The time_range parameter for btmp beacon must contain start & end options."
)
return status, msg
@ -202,7 +200,7 @@ def validate(config):
# Configuration for load beacon should be a list of dicts
if not isinstance(config, list):
vstatus = False
vmsg = "Configuration for btmp beacon must " "be a list."
vmsg = "Configuration for btmp beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
@ -210,7 +208,7 @@ def validate(config):
if "users" in _config:
if not isinstance(_config["users"], dict):
vstatus = False
vmsg = "User configuration for btmp beacon must " "be a dictionary."
vmsg = "User configuration for btmp beacon must be a dictionary."
else:
for user in _config["users"]:
_time_range = _config["users"][user].get("time_range", {})
@ -222,7 +220,7 @@ def validate(config):
if "groups" in _config:
if not isinstance(_config["groups"], dict):
vstatus = False
vmsg = "Group configuration for btmp beacon must " "be a dictionary."
vmsg = "Group configuration for btmp beacon must be a dictionary."
else:
for group in _config["groups"]:
_time_range = _config["groups"][group].get("time_range", {})
@ -233,7 +231,7 @@ def validate(config):
if "defaults" in _config:
if not isinstance(_config["defaults"], dict):
vstatus = False
vmsg = "Defaults configuration for btmp beacon must " "be a dictionary."
vmsg = "Defaults configuration for btmp beacon must be a dictionary."
else:
_time_range = _config["defaults"].get("time_range", {})
vstatus, vmsg = _validate_time_range(_time_range, vstatus, vmsg)

View file

@ -42,12 +42,12 @@ def validate(config):
# Configuration for cert_info beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for cert_info beacon must be a list.")
return False, "Configuration for cert_info beacon must be a list."
if "files" not in _config:
return (
False,
("Configuration for cert_info beacon must contain files option."),
"Configuration for cert_info beacon must contain files option.",
)
return True, "Valid beacon configuration"

View file

@ -36,7 +36,7 @@ def validate(config):
"""
# Configuration for diskusage beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for diskusage beacon must be a list.")
return False, "Configuration for diskusage beacon must be a list."
return True, "Valid beacon configuration"

View file

@ -29,7 +29,7 @@ def validate(config):
"""
# Configuration for glxinfo beacon should be a dictionary
if not isinstance(config, list):
return False, ("Configuration for glxinfo beacon must be a list.")
return False, "Configuration for glxinfo beacon must be a list."
_config = {}
list(map(_config.update, config))
@ -37,10 +37,7 @@ def validate(config):
if "user" not in _config:
return (
False,
(
"Configuration for glxinfo beacon must "
"include a user as glxinfo is not available to root."
),
"Configuration for glxinfo beacon must include a user as glxinfo is not available to root.",
)
return True, "Valid beacon configuration"

View file

@ -27,30 +27,30 @@ def validate(config):
Validate the beacon configuration
"""
if not isinstance(config, list):
return False, ("Configuration for haproxy beacon must be a list.")
return False, "Configuration for haproxy beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
if "backends" not in _config:
return False, ("Configuration for haproxy beacon requires backends.")
return False, "Configuration for haproxy beacon requires backends."
else:
if not isinstance(_config["backends"], dict):
return False, ("Backends for haproxy beacon must be a dictionary.")
return False, "Backends for haproxy beacon must be a dictionary."
else:
for backend in _config["backends"]:
log.debug("_config %s", _config["backends"][backend])
if "servers" not in _config["backends"][backend]:
return (
False,
("Backends for haproxy beacon require servers."),
"Backends for haproxy beacon require servers.",
)
else:
_servers = _config["backends"][backend]["servers"]
if not isinstance(_servers, list):
return (
False,
("Servers for haproxy beacon must be a list."),
"Servers for haproxy beacon must be a list.",
)
return True, "Valid beacon configuration"
@ -90,7 +90,7 @@ def beacon(config):
"threshold": threshold,
}
log.debug(
"Emit because %s > %s" " for %s in %s",
"Emit because %s > %s for %s in %s",
scur,
threshold,
server,

View file

@ -118,10 +118,7 @@ def validate(config):
if not isinstance(_config["files"], dict):
return (
False,
(
"Configuration for inotify beacon invalid, "
"files must be a dict."
),
"Configuration for inotify beacon invalid, files must be a dict.",
)
for path in _config.get("files"):
@ -129,10 +126,8 @@ def validate(config):
if not isinstance(_config["files"][path], dict):
return (
False,
(
"Configuration for inotify beacon must "
"be a list of dictionaries."
),
"Configuration for inotify beacon must be a list of"
" dictionaries.",
)
else:
if not any(
@ -141,49 +136,38 @@ def validate(config):
):
return (
False,
(
"Configuration for inotify beacon must "
"contain mask, recurse or auto_add items."
),
"Configuration for inotify beacon must contain mask,"
" recurse or auto_add items.",
)
if "auto_add" in _config["files"][path]:
if not isinstance(_config["files"][path]["auto_add"], bool):
return (
False,
(
"Configuration for inotify beacon "
"auto_add must be boolean."
),
"Configuration for inotify beacon auto_add must be"
" boolean.",
)
if "recurse" in _config["files"][path]:
if not isinstance(_config["files"][path]["recurse"], bool):
return (
False,
(
"Configuration for inotify beacon "
"recurse must be boolean."
),
"Configuration for inotify beacon recurse must be"
" boolean.",
)
if "mask" in _config["files"][path]:
if not isinstance(_config["files"][path]["mask"], list):
return (
False,
(
"Configuration for inotify beacon "
"mask must be list."
),
"Configuration for inotify beacon mask must be list.",
)
for mask in _config["files"][path]["mask"]:
if mask not in VALID_MASK:
return (
False,
(
"Configuration for inotify beacon "
"invalid mask option {}.".format(mask)
),
"Configuration for inotify beacon invalid mask"
" option {}.".format(mask),
)
return True, "Valid beacon configuration"

View file

@ -52,10 +52,8 @@ def validate(config):
if not isinstance(_config["services"][name], dict):
return (
False,
(
"Services configuration for journald beacon "
"must be a list of dictionaries."
),
"Services configuration for journald beacon must be a list of"
" dictionaries.",
)
return True, "Valid beacon configuration"

View file

@ -27,7 +27,7 @@ def validate(config):
# Configuration for load beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for load beacon must be a list.")
return False, "Configuration for load beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
@ -36,54 +36,42 @@ def validate(config):
if not isinstance(_config["emitatstartup"], bool):
return (
False,
(
"Configuration for load beacon option "
"emitatstartup must be a boolean."
),
"Configuration for load beacon option emitatstartup must be a"
" boolean.",
)
if "onchangeonly" in _config:
if not isinstance(_config["onchangeonly"], bool):
return (
False,
(
"Configuration for load beacon option "
"onchangeonly must be a boolean."
),
"Configuration for load beacon option onchangeonly must be a"
" boolean.",
)
if "averages" not in _config:
return False, ("Averages configuration is required for load beacon.")
return False, "Averages configuration is required for load beacon."
else:
if not any(j in ["1m", "5m", "15m"] for j in _config.get("averages", {})):
return (
False,
(
"Averages configuration for load beacon "
"must contain 1m, 5m or 15m items."
),
"Averages configuration for load beacon must contain 1m, 5m or 15m"
" items.",
)
for item in ["1m", "5m", "15m"]:
if not isinstance(_config["averages"][item], list):
return (
False,
(
"Averages configuration for load beacon: "
"1m, 5m and 15m items must be "
"a list of two items."
),
"Averages configuration for load beacon: 1m, 5m and 15m items"
" must be a list of two items.",
)
else:
if len(_config["averages"][item]) != 2:
return (
False,
(
"Configuration for load beacon: "
"1m, 5m and 15m items must be "
"a list of two items."
),
"Configuration for load beacon: 1m, 5m and 15m items must"
" be a list of two items.",
)
return True, "Valid beacon configuration"
@ -159,7 +147,7 @@ def beacon(config):
LAST_STATUS[k]
) < float(_config["averages"][k][1]):
log.debug(
"Emit because %f > %f and last was " "%f",
"Emit because %f > %f and last was %f",
float(avg_dict[k]),
float(_config["averages"][k][1]),
float(LAST_STATUS[k]),
@ -172,7 +160,7 @@ def beacon(config):
LAST_STATUS[k]
) > float(_config["averages"][k][0]):
log.debug(
"Emit because %f < %f and last was" "%f",
"Emit because %f < %f and last was%f",
float(avg_dict[k]),
float(_config["averages"][k][0]),
float(LAST_STATUS[k]),
@ -185,7 +173,7 @@ def beacon(config):
avg_dict[k]
) > float(_config["averages"][k][1]):
log.debug(
"Emit because %f < %f or > " "%f",
"Emit because %f < %f or > %f",
float(avg_dict[k]),
float(_config["averages"][k][0]),
float(_config["averages"][k][1]),

View file

@ -52,10 +52,10 @@ def validate(config):
# Configuration for log beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for log beacon must be a list.")
return False, "Configuration for log beacon must be a list."
if "file" not in _config:
return False, ("Configuration for log beacon must contain file option.")
return False, "Configuration for log beacon must contain file option."
return True, "Valid beacon configuration"

View file

@ -33,13 +33,13 @@ def validate(config):
"""
# Configuration for memusage beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for memusage beacon must be a list.")
return False, "Configuration for memusage beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
if "percent" not in _config:
return False, ("Configuration for memusage beacon requires percent.")
return False, "Configuration for memusage beacon requires percent."
return True, "Valid beacon configuration"

View file

@ -289,9 +289,8 @@ def validate(config):
if not isinstance(fun_cfg, dict):
return (
False,
"The match structure for the {} execution function output must be a dictionary".format(
fun
),
"The match structure for the {} execution function output must be a"
" dictionary".format(fun),
)
if fun not in __salt__:
return False, "Execution function {} is not availabe!".format(fun)

View file

@ -66,7 +66,7 @@ def validate(config):
# Configuration for load beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for network_info beacon must be a list.")
return False, "Configuration for network_info beacon must be a list."
else:
_config = {}
@ -76,16 +76,14 @@ def validate(config):
if not isinstance(_config["interfaces"][item], dict):
return (
False,
(
"Configuration for network_info beacon must "
"be a list of dictionaries."
),
"Configuration for network_info beacon must "
"be a list of dictionaries.",
)
else:
if not any(j in VALID_ITEMS for j in _config["interfaces"][item]):
return (
False,
("Invalid configuration item in Beacon configuration."),
"Invalid configuration item in Beacon configuration.",
)
return True, "Valid beacon configuration"

View file

@ -75,7 +75,7 @@ def validate(config):
Validate the beacon configuration
"""
if not isinstance(config, list):
return False, ("Configuration for network_settings beacon must be a list.")
return False, "Configuration for network_settings beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
@ -85,23 +85,18 @@ def validate(config):
# Old syntax
return (
False,
(
"interfaces section for network_settings beacon"
" must be a dictionary."
),
"interfaces section for network_settings beacon must be a dictionary.",
)
for item in interfaces:
if not isinstance(_config["interfaces"][item], dict):
return (
False,
(
"Interface attributes for network_settings beacon"
" must be a dictionary."
),
"Interface attributes for network_settings beacon"
" must be a dictionary.",
)
if not all(j in ATTRS for j in _config["interfaces"][item]):
return False, ("Invalid attributes in beacon configuration.")
return False, "Invalid attributes in beacon configuration."
return True, "Valid beacon configuration"

View file

@ -23,7 +23,7 @@ def validate(config):
"""
# Configuration for pkg beacon should be a list
if not isinstance(config, list):
return False, ("Configuration for pkg beacon must be a list.")
return False, "Configuration for pkg beacon must be a list."
# Configuration for pkg beacon should contain pkgs
pkgs_found = False

View file

@ -33,7 +33,7 @@ def validate(config):
Validate the beacon configuration
"""
if not isinstance(config, list):
return False, ("Configuration for proxy_example beacon must be a list.")
return False, "Configuration for proxy_example beacon must be a list."
return True, "Valid beacon configuration"

View file

@ -28,16 +28,16 @@ def validate(config):
"""
# Configuration for ps beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for ps beacon must be a list.")
return False, "Configuration for ps beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
if "processes" not in _config:
return False, ("Configuration for ps beacon requires processes.")
return False, "Configuration for ps beacon requires processes."
else:
if not isinstance(_config["processes"], dict):
return False, ("Processes for ps beacon must be a dictionary.")
return False, "Processes for ps beacon must be a dictionary."
return True, "Valid beacon configuration"

View file

@ -36,17 +36,17 @@ def validate(config):
# Configuration for adb beacon should be a dictionary with states array
if not isinstance(config, list):
log.info("Configuration for salt_proxy beacon must be a list.")
return False, ("Configuration for salt_proxy beacon must be a list.")
return False, "Configuration for salt_proxy beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
if "proxies" not in _config:
return False, ("Configuration for salt_proxy beacon requires proxies.")
return False, "Configuration for salt_proxy beacon requires proxies."
else:
if not isinstance(_config["proxies"], dict):
return False, ("Proxies for salt_proxy beacon must be a dictionary.")
return False, "Proxies for salt_proxy beacon must be a dictionary."
return True, "Valid beacon configuration"

View file

@ -24,13 +24,13 @@ def validate(config):
"""
# Configuration for sensehat beacon should be a list
if not isinstance(config, list):
return False, ("Configuration for sensehat beacon must be a list.")
return False, "Configuration for sensehat beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
if "sensors" not in _config:
return False, ("Configuration for sensehat beacon requires sensors.")
return False, "Configuration for sensehat beacon requires sensors."
return True, "Valid beacon configuration"

View file

@ -18,30 +18,26 @@ def validate(config):
"""
# Configuration for service beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for service beacon must be a list.")
return False, "Configuration for service beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
if "services" not in _config:
return False, ("Configuration for service beacon requires services.")
return False, "Configuration for service beacon requires services."
else:
if not isinstance(_config["services"], dict):
return (
False,
(
"Services configuration item for service beacon must "
"be a dictionary."
),
"Services configuration item for service beacon must "
"be a dictionary.",
)
for config_item in _config["services"]:
if not isinstance(_config["services"][config_item], dict):
return (
False,
(
"Configuration for service beacon must "
"be a list of dictionaries."
),
"Configuration for service beacon must "
"be a list of dictionaries.",
)
return True, "Valid beacon configuration"

View file

@ -42,7 +42,7 @@ def validate(config):
"""
# Configuration for sh beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for sh beacon must be a list.")
return False, "Configuration for sh beacon must be a list."
return True, "Valid beacon configuration"

View file

@ -104,7 +104,7 @@ def validate(config):
Validate the config is a dict
"""
if not isinstance(config, list):
return False, ("Configuration for status beacon must be a list.")
return False, "Configuration for status beacon must be a list."
return True, "Valid beacon configuration"

View file

@ -33,13 +33,13 @@ def validate(config):
"""
# Configuration for swapusage beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for swapusage beacon must be a list.")
return False, "Configuration for swapusage beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
if "percent" not in _config:
return False, ("Configuration for swapusage beacon requires percent.")
return False, "Configuration for swapusage beacon requires percent."
return True, "Valid beacon configuration"

View file

@ -32,7 +32,7 @@ def validate(config):
Validate the beacon configuration
"""
if not isinstance(config, list):
return False, ("Configuration for telegram_bot_msg beacon must be a list.")
return False, "Configuration for telegram_bot_msg beacon must be a list."
_config = {}
list(map(_config.update, config))
@ -42,16 +42,14 @@ def validate(config):
):
return (
False,
("Not all required configuration for telegram_bot_msg are set."),
"Not all required configuration for telegram_bot_msg are set.",
)
if not isinstance(_config.get("accept_from"), list):
return (
False,
(
"Configuration for telegram_bot_msg, "
"accept_from must be a list of usernames."
),
"Configuration for telegram_bot_msg, "
"accept_from must be a list of usernames.",
)
return True, "Valid beacon configuration."

View file

@ -34,7 +34,7 @@ def validate(config):
"""
# Configuration for twilio_txt_msg beacon should be a list of dicts
if not isinstance(config, list):
return False, ("Configuration for twilio_txt_msg beacon must be a list.")
return False, "Configuration for twilio_txt_msg beacon must be a list."
else:
_config = {}
list(map(_config.update, config))
@ -44,11 +44,9 @@ def validate(config):
):
return (
False,
(
"Configuration for twilio_txt_msg beacon "
"must contain account_sid, auth_token "
"and twilio_number items."
),
"Configuration for twilio_txt_msg beacon "
"must contain account_sid, auth_token "
"and twilio_number items.",
)
return True, "Valid beacon configuration"

View file

@ -124,7 +124,7 @@ def _validate(config):
if not isinstance(_config["directories"], dict):
raise ValidationError(
"Configuration for watchdog beacon directories must be a " "dictionary."
"Configuration for watchdog beacon directories must be a dictionary."
)
for path in _config["directories"]:
@ -134,7 +134,7 @@ def _validate(config):
def _validate_path(path_config):
if not isinstance(path_config, dict):
raise ValidationError(
"Configuration for watchdog beacon directory path must be " "a dictionary."
"Configuration for watchdog beacon directory path must be a dictionary."
)
if "mask" in path_config:

View file

@ -171,14 +171,12 @@ def _validate_time_range(trange, status, msg):
if not isinstance(trange, dict):
status = False
msg = "The time_range parameter for " "wtmp beacon must " "be a dictionary."
msg = "The time_range parameter for wtmp beacon must be a dictionary."
if not all(k in trange for k in ("start", "end")):
status = False
msg = (
"The time_range parameter for "
"wtmp beacon must contain "
"start & end options."
"The time_range parameter for wtmp beacon must contain start & end options."
)
return status, msg
@ -239,7 +237,7 @@ def validate(config):
if "users" in _config:
if not isinstance(_config["users"], dict):
vstatus = False
vmsg = "User configuration for wtmp beacon must " "be a dictionary."
vmsg = "User configuration for wtmp beacon must be a dictionary."
else:
for user in _config["users"]:
_time_range = _config["users"][user].get("time_range", {})
@ -251,7 +249,7 @@ def validate(config):
if "groups" in _config:
if not isinstance(_config["groups"], dict):
vstatus = False
vmsg = "Group configuration for wtmp beacon must " "be a dictionary."
vmsg = "Group configuration for wtmp beacon must be a dictionary."
else:
for group in _config["groups"]:
_time_range = _config["groups"][group].get("time_range", {})
@ -262,7 +260,7 @@ def validate(config):
if "defaults" in _config:
if not isinstance(_config["defaults"], dict):
vstatus = False
vmsg = "Defaults configuration for wtmp beacon must " "be a dictionary."
vmsg = "Defaults configuration for wtmp beacon must be a dictionary."
else:
_time_range = _config["defaults"].get("time_range", {})
vstatus, vmsg = _validate_time_range(_time_range, vstatus, vmsg)

View file

@ -94,7 +94,8 @@ def __virtual__():
except AttributeError:
return (
False,
"Failed to invoke consul.Consul, please make sure you have python-consul >= 0.2.0 installed",
"Failed to invoke consul.Consul, please make sure you have python-consul >="
" 0.2.0 installed",
)
return __virtualname__

View file

@ -184,9 +184,8 @@ def store(bank, key, data):
"""
_init_client()
data = __context__["serial"].dumps(data)
query = (
b"REPLACE INTO {} (bank, etcd_key, data) values('{}', '{}', "
b"'{}')".format(_table_name, bank, key, data)
query = b"REPLACE INTO {} (bank, etcd_key, data) values('{}', '{}', '{}')".format(
_table_name, bank, key, data
)
cur, cnt = run_query(client, query)
@ -242,7 +241,7 @@ def contains(bank, key):
Checks if the specified bank contains the specified key.
"""
_init_client()
query = "SELECT COUNT(data) FROM {} WHERE bank='{}' " "AND etcd_key='{}'".format(
query = "SELECT COUNT(data) FROM {} WHERE bank='{}' AND etcd_key='{}'".format(
_table_name, bank, key
)
cur, _ = run_query(client, query)

View file

@ -241,9 +241,8 @@ class Batch:
)
else:
salt.utils.stringutils.print_cli(
"minion {} was already deleted from tracker, probably a duplicate key".format(
part["id"]
)
"minion {} was already deleted from tracker,"
" probably a duplicate key".format(part["id"])
)
else:
parts.update(part)
@ -252,9 +251,8 @@ class Batch:
minion_tracker[queue]["minions"].remove(id)
else:
salt.utils.stringutils.print_cli(
"minion {} was already deleted from tracker, probably a duplicate key".format(
id
)
"minion {} was already deleted from tracker,"
" probably a duplicate key".format(id)
)
except StopIteration:
# if a iterator is done:

View file

@ -120,9 +120,9 @@ class SaltCP:
files.update(self._file_dict(fn_))
elif os.path.isdir(fn_):
salt.utils.stringutils.print_cli(
fn_ + " is a directory, only files are supported "
"{} is a directory, only files are supported "
'in non-chunked mode. Use "--chunked" command '
"line argument."
"line argument.".format(fn_)
)
sys.exit(1)
return files

View file

@ -39,7 +39,8 @@ warnings.filterwarnings(
# Filter the backports package UserWarning about being re-imported
warnings.filterwarnings(
"ignore",
"^Module backports was already imported from (.*), but (.*) is being added to sys.path$",
"^Module backports was already imported from (.*), but (.*) is being added to"
" sys.path$",
UserWarning,
append=True,
)

View file

@ -330,7 +330,7 @@ class LocalClient:
elif "jid" not in pub_data:
return {}
if pub_data["jid"] == "0":
print("Failed to connect to the Master, " "is the Salt Master running?")
print("Failed to connect to the Master, is the Salt Master running?")
return {}
# If we order masters (via a syndic), don't short circuit if no minions
@ -1451,8 +1451,9 @@ class LocalClient:
)
except Exception as exc: # pylint: disable=broad-except
raise SaltClientError(
"Returner {} could not fetch jid data. "
"Exception details: {}".format(self.opts["master_job_cache"], exc)
"Returner {} could not fetch jid data. Exception details: {}".format(
self.opts["master_job_cache"], exc
)
)
for minion in data:
m_data = {}
@ -1696,12 +1697,16 @@ class LocalClient:
yield {
id_: {
"out": "no_return",
"ret": "Minion did not return. [No response]"
"\nThe minions may not have all finished running and any "
"remaining minions will return upon completion. To look "
"up the return data for this job later, run the following "
"command:\n\n"
"salt-run jobs.lookup_jid {}".format(jid),
"ret": (
"Minion did not return. [No response]\nThe"
" minions may not have all finished running and"
" any remaining minions will return upon"
" completion. To look up the return data for"
" this job later, run the following"
" command:\n\nsalt-run jobs.lookup_jid {}".format(
jid
)
),
"retcode": salt.defaults.exitcodes.EX_GENERIC,
}
}

View file

@ -223,7 +223,10 @@ class SSH:
if not salt.utils.path.which("ssh"):
raise salt.exceptions.SaltSystemExit(
code=-1,
msg="No ssh binary found in path -- ssh must be installed for salt-ssh to run. Exiting.",
msg=(
"No ssh binary found in path -- ssh must be installed for salt-ssh"
" to run. Exiting."
),
)
self.opts["_ssh_version"] = ssh_version()
self.tgt_type = (
@ -260,11 +263,12 @@ class SSH:
salt.client.ssh.shell.gen_key(priv)
except OSError:
raise salt.exceptions.SaltClientError(
"salt-ssh could not be run because it could not generate keys.\n\n"
"You can probably resolve this by executing this script with "
"increased permissions via sudo or by running as root.\n"
"You could also use the '-c' option to supply a configuration "
"directory that you have permissions to read and write to."
"salt-ssh could not be run because it could not generate"
" keys.\n\nYou can probably resolve this by executing this"
" script with increased permissions via sudo or by running as"
" root.\nYou could also use the '-c' option to supply a"
" configuration directory that you have permissions to read and"
" write to."
)
self.defaults = {
"user": self.opts.get(
@ -386,9 +390,8 @@ class SSH:
if self.__parsed_rosters[self.ROSTER_UPDATE_FLAG]:
with salt.utils.files.fopen(roster_file, "a") as roster_fp:
roster_fp.write(
'# Automatically added by "{s_user}" at {s_time}\n{hostname}:\n host: '
"{hostname}\n user: {user}"
"\n passwd: {passwd}\n".format(
'# Automatically added by "{s_user}" at {s_time}\n{hostname}:\n'
" host: {hostname}\n user: {user}\n passwd: {passwd}\n".format(
s_user=getpass.getuser(),
s_time=datetime.datetime.utcnow().isoformat(),
hostname=self.opts.get("tgt", ""),
@ -455,10 +458,8 @@ class SSH:
target = self.targets[host]
# permission denied, attempt to auto deploy ssh key
print(
(
"Permission denied for host {}, do you want to deploy "
"the salt-ssh key? (password required):"
).format(host)
"Permission denied for host {}, do you want to deploy "
"the salt-ssh key? (password required):".format(host)
)
deploy = input("[Y/n] ")
if deploy.startswith(("n", "N")):
@ -581,7 +582,10 @@ class SSH:
if self.targets[host].get("winrm") and not HAS_WINSHELL:
returned.add(host)
rets.add(host)
log_msg = "Please contact sales@saltstack.com for access to the enterprise saltwinshell module."
log_msg = (
"Please contact sales@saltstack.com for access to the"
" enterprise saltwinshell module."
)
log.debug(log_msg)
no_ret = {
"fun_args": [],
@ -633,8 +637,8 @@ class SSH:
if host not in returned:
error = (
"Target '{}' did not return any data, "
"probably due to an error."
).format(host)
"probably due to an error.".format(host)
)
ret = {"id": host, "ret": error}
log.error(error)
yield {ret["id"]: ret["ret"]}
@ -1518,7 +1522,7 @@ ARGS = {arguments}\n'''.format(
return None
perm_error_fmt = (
"Permissions problem, target user may need " "to be root or use sudo:\n {0}"
"Permissions problem, target user may need to be root or use sudo:\n {0}"
)
errors = [

View file

@ -430,8 +430,8 @@ class Shell:
ret_stdout = (
"The host key needs to be accepted, to "
"auto accept run salt-ssh with the -i "
"flag:\n{}"
).format(stdout)
"flag:\n{}".format(stdout)
)
return ret_stdout, "", 254
elif buff and buff.endswith("_||ext_mods||_"):
mods_raw = (

View file

@ -136,8 +136,9 @@ def need_deployment():
)
except OSError:
sys.stdout.write(
"\n\nUnable to set permissions on thin directory.\nIf sudo_user is set "
"and is not root, be certain the user is in the same group\nas the login user"
"\n\nUnable to set permissions on thin directory.\nIf sudo_user is"
" set and is not root, be certain the user is in the same group\nas"
" the login user"
)
sys.exit(1)
@ -248,7 +249,7 @@ def get_executable():
stdout, _ = subprocess.Popen(
[
py_cmd,
"-c"
"-c",
"import sys; sys.stdout.write('%s:%s' % (sys.version_info[0], sys.version_info[1]))",
],
stdout=subprocess.PIPE,
@ -292,8 +293,9 @@ def main(argv): # pylint: disable=W0613
if os.path.exists(OPTIONS.saltdir) and not os.path.isdir(OPTIONS.saltdir):
sys.stderr.write(
'ERROR: salt path "{0}" exists but is'
" not a directory\n".format(OPTIONS.saltdir)
'ERROR: salt path "{0}" exists but is not a directory\n'.format(
OPTIONS.saltdir
)
)
sys.exit(EX_CANTCREAT)

View file

@ -151,7 +151,7 @@ class FunctionWrapper:
# containing only 'cmd' module calls, in that case. We don't
# support assigning directly to prefixes in this way
raise KeyError(
"Cannot assign to module key {} in the " "FunctionWrapper".format(cmd)
"Cannot assign to module key {} in the FunctionWrapper".format(cmd)
)
if self.cmd_prefix:

View file

@ -24,7 +24,7 @@ def get_file(path, dest, saltenv="base", makedirs=False, template=None, gzip=Non
cp.get_file. The argument is only accepted for interface compatibility.
"""
if gzip is not None:
log.warning("The gzip argument to cp.get_file in salt-ssh is " "unsupported")
log.warning("The gzip argument to cp.get_file in salt-ssh is unsupported")
if template is not None:
(path, dest) = _render_filenames(path, dest, saltenv, template)
@ -102,8 +102,7 @@ def _render_filenames(path, dest, saltenv, template):
# render the path as a template using path_template_engine as the engine
if template not in salt.utils.templates.TEMPLATE_REGISTRY:
raise CommandExecutionError(
"Attempted to render file paths with unavailable engine "
"{}".format(template)
"Attempted to render file paths with unavailable engine {}".format(template)
)
kwargs = {}

View file

@ -272,13 +272,13 @@ def running(concurrent=False):
active = __salt__["saltutil.is_running"]("state.*")
for data in active:
err = (
'The function "{}" is running as PID {} and was started at '
"{} with jid {}"
).format(
data["fun"],
data["pid"],
salt.utils.jid.jid_to_time(data["jid"]),
data["jid"],
'The function "{}" is running as PID {} and was started at {} '
"with jid {}".format(
data["fun"],
data["pid"],
salt.utils.jid.jid_to_time(data["jid"]),
data["jid"],
)
)
ret.append(err)
return ret
@ -918,8 +918,9 @@ def sls_id(id_, mods, test=None, queue=False, **kwargs):
if not chunk:
raise SaltInvocationError(
"No matches for ID '{}' found in SLS '{}' within saltenv "
"'{}'".format(id_, mods, opts["saltenv"])
"No matches for ID '{}' found in SLS '{}' within saltenv '{}'".format(
id_, mods, opts["saltenv"]
)
)
ret = _ssh_state(chunk, st_kwargs, kwargs, test=test)

View file

@ -559,8 +559,7 @@ class Cloud:
if not providers:
raise SaltCloudSystemExit(
"No cloud providers matched '{}'. "
"Available selections: {}".format(
"No cloud providers matched '{}'. Available selections: {}".format(
lookup, ", ".join(self.get_configured_providers())
)
)
@ -624,8 +623,7 @@ class Cloud:
pmap[alias][driver] = self.clouds[fun]()
except Exception as err: # pylint: disable=broad-except
log.debug(
"Failed to execute '%s()' while querying for "
"running nodes: %s",
"Failed to execute '%s()' while querying for running nodes: %s",
fun,
err,
exc_info_on_loglevel=logging.DEBUG,
@ -1325,8 +1323,7 @@ class Cloud:
output = self.clouds[fun](**extra_)
except KeyError as exc:
log.exception(
"Failed to perform %s.%s on %s. "
"Configuration value %s needs to be set",
"Failed to perform %s.%s on %s. Configuration value %s needs to be set",
extra_["provider"],
extra_["action"],
extra_["name"],
@ -1395,8 +1392,9 @@ class Cloud:
process = multiprocessing.Process(target=self.create, args=(vm_,))
process.start()
ret[name] = {
"Provisioning": "VM being provisioned in parallel. "
"PID: {}".format(process.pid)
"Provisioning": "VM being provisioned in parallel. PID: {}".format(
process.pid
)
}
continue
@ -1447,7 +1445,7 @@ class Cloud:
vm_name = vm_details["id"]
else:
log.debug(
"vm:%s in provider:%s is not in name " "list:'%s'",
"vm:%s in provider:%s is not in name list:'%s'",
vm_name,
driver,
names,
@ -1521,8 +1519,7 @@ class Cloud:
matches = self.lookup_providers(prov)
if len(matches) > 1:
raise SaltCloudSystemExit(
"More than one results matched '{}'. Please specify "
"one of: {}".format(
"More than one results matched '{}'. Please specify one of: {}".format(
prov,
", ".join(
["{}:{}".format(alias, driver) for (alias, driver) in matches]
@ -1784,9 +1781,9 @@ class Map(Cloud):
overrides.setdefault("name", name)
except AttributeError:
log.error(
"Cannot use 'name' as a minion id in a cloud map as it "
"is a reserved word. Please change 'name' to a different "
"minion id reference."
"Cannot use 'name' as a minion id in a cloud map as it"
" is a reserved word. Please change 'name' to a"
" different minion id reference."
)
return {}
entries[name] = overrides
@ -2134,8 +2131,9 @@ class Map(Cloud):
)
if master_host is None:
raise SaltCloudSystemExit(
"Host for new master {} was not found, "
"aborting map".format(master_name)
"Host for new master {} was not found, aborting map".format(
master_name
)
)
output[master_name] = out
except StopIteration:

View file

@ -163,10 +163,10 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
if map_file is not None:
if names != ():
msg = (
"Supplying a mapfile, '{}', in addition to instance names {} "
"with the '--destroy' or '-d' function is not supported. "
"Please choose to delete either the entire map file or individual "
"instances.".format(map_file, names)
"Supplying a mapfile, '{}', in addition to instance names {}"
" with the '--destroy' or '-d' function is not supported."
" Please choose to delete either the entire map file or"
" individual instances.".format(map_file, names)
)
self.handle_exception(msg, SaltCloudSystemExit)
@ -296,14 +296,12 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
msg += " {}\n".format(name)
if dmap["create"]:
msg += "The following virtual machines are set to be " "created:\n"
msg += "The following virtual machines are set to be created:\n"
for name in dmap["create"]:
msg += " {}\n".format(name)
if "destroy" in dmap:
msg += (
"The following virtual machines are set to be " "destroyed:\n"
)
msg += "The following virtual machines are set to be destroyed:\n"
for name in dmap["destroy"]:
msg += " {}\n".format(name)
@ -326,7 +324,10 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
if dmap.get("existing", None):
for name in dmap["existing"]:
if "ec2" in dmap["existing"][name]["provider"]:
msg = "Instance already exists, or is terminated and has the same name."
msg = (
"Instance already exists, or is terminated and has the"
" same name."
)
else:
msg = "Already running."
ret[name] = {"Message": msg}

View file

@ -293,7 +293,7 @@ def list_nodes_full(call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called with -f " "or --function."
"The list_nodes_full function must be called with -f or --function."
)
ret = {}
@ -914,7 +914,7 @@ def _get_node(name):
except KeyError:
attempts -= 1
log.debug(
"Failed to get the data for node '%s'. Remaining " "attempts: %s",
"Failed to get the data for node '%s'. Remaining attempts: %s",
name,
attempts,
)
@ -929,7 +929,7 @@ def show_image(kwargs, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The show_images function must be called with " "-f or --function"
"The show_images function must be called with -f or --function"
)
if not isinstance(kwargs, dict):
@ -976,7 +976,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -550,7 +550,7 @@ def list_resource_groups(call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_hosted_services function must be called with " "-f or --function"
"The list_hosted_services function must be called with -f or --function"
)
resconn = get_conn(client_type="resource")
@ -936,8 +936,9 @@ def request_instance(vm_):
ssh_publickeyfile_contents = spkc_.read()
except Exception as exc: # pylint: disable=broad-except
raise SaltCloudConfigError(
"Failed to read ssh publickey file '{}': "
"{}".format(ssh_publickeyfile, exc.args[-1])
"Failed to read ssh publickey file '{}': {}".format(
ssh_publickeyfile, exc.args[-1]
)
)
disable_password_authentication = config.get_cloud_config_value(
@ -1393,7 +1394,7 @@ def destroy(name, call=None, kwargs=None): # pylint: disable=unused-argument
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
compconn = get_conn(client_type="compute")
@ -1543,7 +1544,7 @@ def list_storage_accounts(call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_storage_accounts function must be called with " "-f or --function"
"The list_storage_accounts function must be called with -f or --function"
)
storconn = get_conn(client_type="storage")
@ -1696,7 +1697,7 @@ def list_virtual_networks(call=None, kwargs=None):
if call == "action":
raise SaltCloudSystemExit(
"The avail_sizes function must be called with " "-f or --function"
"The avail_sizes function must be called with -f or --function"
)
netconn = get_conn(client_type="network")
@ -1727,7 +1728,7 @@ def list_subnets(call=None, kwargs=None):
if call == "action":
raise SaltCloudSystemExit(
"The avail_sizes function must be called with " "-f or --function"
"The avail_sizes function must be called with -f or --function"
)
netconn = get_conn(client_type="network")
@ -1829,7 +1830,8 @@ def create_or_update_vmextension(
raise SaltCloudSystemExit("VM extension settings are not valid")
elif "commandToExecute" not in settings and "script" not in settings:
raise SaltCloudSystemExit(
"VM extension settings are not valid. Either commandToExecute or script must be specified."
"VM extension settings are not valid. Either commandToExecute or script"
" must be specified."
)
log.info("Creating VM extension %s", kwargs["extension_name"])

View file

@ -131,7 +131,7 @@ def get_conn():
libcloud.security.VERIFY_SSL_CERT = False
except (ImportError, AttributeError):
raise SaltCloudSystemExit(
"Could not disable SSL certificate verification. " "Not loading module."
"Could not disable SSL certificate verification. Not loading module."
)
return driver(
@ -467,7 +467,7 @@ def destroy(name, conn=None, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -351,7 +351,8 @@ def create(vm_):
kwargs["ssh_interface"] = ssh_interface
else:
raise SaltCloudConfigError(
"The DigitalOcean driver requires ssh_interface to be defined as 'public' or 'private'."
"The DigitalOcean driver requires ssh_interface to be defined as 'public'"
" or 'private'."
)
private_networking = config.get_cloud_config_value(
@ -444,7 +445,8 @@ def create(vm_):
dns_domain_name = vm_["name"].split(".")
if len(dns_domain_name) > 2:
log.debug(
"create_dns_record: inferring default dns_hostname, dns_domain from minion name as FQDN"
"create_dns_record: inferring default dns_hostname, dns_domain from"
" minion name as FQDN"
)
default_dns_hostname = ".".join(dns_domain_name[:-2])
default_dns_domain = ".".join(dns_domain_name[-2:])
@ -699,7 +701,7 @@ def _get_node(name):
except KeyError:
attempts -= 1
log.debug(
"Failed to get the data for node '%s'. Remaining " "attempts: %s",
"Failed to get the data for node '%s'. Remaining attempts: %s",
name,
attempts,
)
@ -861,7 +863,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -309,9 +309,9 @@ def query(
if endpoint == "":
endpoint_err = (
"Could not find a valid endpoint in the "
"requesturl: {}. Looking for something "
"like https://some.ec2.endpoint/?args"
).format(requesturl)
"requesturl: {}. Looking for something like "
"https://some.ec2.endpoint/?args".format(requesturl)
)
log.error(endpoint_err)
if return_url is True:
return {"error": endpoint_err}, requesturl
@ -515,7 +515,7 @@ def _wait_for_spot_instance(
duration = timeout
while True:
log.debug(
"Waiting for spot instance reservation. Giving up in " "00:%02d:%02d",
"Waiting for spot instance reservation. Giving up in 00:%02d:%02d",
int(timeout // 60),
int(timeout % 60),
)
@ -547,7 +547,7 @@ def _wait_for_spot_instance(
interval *= interval_multiplier
if interval > timeout:
interval = timeout + 1
log.info("Interval multiplier in effect; interval is " "now %ss", interval)
log.info("Interval multiplier in effect; interval is now %ss", interval)
def avail_sizes(call=None):
@ -567,13 +567,13 @@ def avail_sizes(call=None):
"Cluster Compute": {
"cc2.8xlarge": {
"id": "cc2.8xlarge",
"cores": "16 (2 x Intel Xeon E5-2670, eight-core with " "hyperthread)",
"cores": "16 (2 x Intel Xeon E5-2670, eight-core with hyperthread)",
"disk": "3360 GiB (4 x 840 GiB)",
"ram": "60.5 GiB",
},
"cc1.4xlarge": {
"id": "cc1.4xlarge",
"cores": "8 (2 x Intel Xeon X5570, quad-core with " "hyperthread)",
"cores": "8 (2 x Intel Xeon X5570, quad-core with hyperthread)",
"disk": "1690 GiB (2 x 840 GiB)",
"ram": "22.5 GiB",
},
@ -581,8 +581,10 @@ def avail_sizes(call=None):
"Cluster CPU": {
"cg1.4xlarge": {
"id": "cg1.4xlarge",
"cores": "8 (2 x Intel Xeon X5570, quad-core with "
"hyperthread), plus 2 NVIDIA Tesla M2050 GPUs",
"cores": (
"8 (2 x Intel Xeon X5570, quad-core with "
"hyperthread), plus 2 NVIDIA Tesla M2050 GPUs"
),
"disk": "1680 GiB (2 x 840 GiB)",
"ram": "22.5 GiB",
},
@ -1153,15 +1155,17 @@ def get_availability_zone(vm_):
# Validate user-specified AZ
if avz not in zones:
raise SaltCloudException(
"The specified availability zone isn't valid in this region: "
"{}\n".format(avz)
"The specified availability zone isn't valid in this region: {}\n".format(
avz
)
)
# check specified AZ is available
elif zones[avz] != "available":
raise SaltCloudException(
"The specified availability zone isn't currently available: "
"{}\n".format(avz)
"The specified availability zone isn't currently available: {}\n".format(
avz
)
)
return avz
@ -1785,8 +1789,9 @@ def request_instance(vm_=None, call=None):
if spot_config is not None:
if "spot_price" not in spot_config:
raise SaltCloudSystemExit(
"Spot instance config for {} requires a spot_price "
"attribute.".format(vm_["name"])
"Spot instance config for {} requires a spot_price attribute.".format(
vm_["name"]
)
)
params = {
@ -1974,7 +1979,7 @@ def request_instance(vm_=None, call=None):
# use different device identifiers
log.info(
"Attempting to look up root device name for image id %s on " "VM %s",
"Attempting to look up root device name for image id %s on VM %s",
image_id,
vm_["name"],
)
@ -1993,7 +1998,7 @@ def request_instance(vm_=None, call=None):
log.debug("EC2 Response: '%s'", rd_data)
except Exception as exc: # pylint: disable=broad-except
log.error(
"Error getting root device name for image id %s for " "VM %s: \n%s",
"Error getting root device name for image id %s for VM %s: \n%s",
image_id,
vm_["name"],
exc,
@ -2099,8 +2104,7 @@ def request_instance(vm_=None, call=None):
return data["error"]
except Exception as exc: # pylint: disable=broad-except
log.error(
"Error creating %s on EC2 when trying to run the initial "
"deployment: \n%s",
"Error creating %s on EC2 when trying to run the initial deployment: \n%s",
vm_["name"],
exc,
# Show the traceback if the debug logging level is enabled
@ -2196,7 +2200,7 @@ def request_instance(vm_=None, call=None):
)
log.debug(
"Canceled spot instance request %s. Data " "returned: %s",
"Canceled spot instance request %s. Data returned: %s",
sir_id,
data,
)
@ -2251,13 +2255,13 @@ def query_instance(vm_=None, call=None):
if isinstance(data, dict) and "error" in data:
log.warning(
"There was an error in the query. %s attempts " "remaining: %s",
"There was an error in the query. %s attempts remaining: %s",
attempts,
data["error"],
)
elif isinstance(data, list) and not data:
log.warning(
"Query returned an empty list. %s attempts " "remaining.", attempts
"Query returned an empty list. %s attempts remaining.", attempts
)
else:
break
@ -2961,7 +2965,7 @@ def create_attach_volumes(name, kwargs, call=None, wait_to_finish=True):
"""
if call != "action":
raise SaltCloudSystemExit(
"The create_attach_volumes action must be called with " "-a or --action."
"The create_attach_volumes action must be called with -a or --action."
)
if "instance_id" not in kwargs:
@ -3338,7 +3342,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
node_metadata = _get_node(name)
@ -3375,7 +3379,7 @@ def destroy(name, call=None):
newname = "{}-DEL{}".format(name, uuid.uuid4().hex)
rename(name, kwargs={"newname": newname}, call="action")
log.info(
"Machine will be identified as %s until it has been " "cleaned up.", newname
"Machine will be identified as %s until it has been cleaned up.", newname
)
ret["newname"] = newname
@ -3498,7 +3502,7 @@ def show_instance(name=None, instance_id=None, call=None, kwargs=None):
if not name and not instance_id:
raise SaltCloudSystemExit(
"The show_instance function requires " "either a name or an instance_id"
"The show_instance function requires either a name or an instance_id"
)
node = _get_node(name=name, instance_id=instance_id)
@ -3536,7 +3540,7 @@ def _get_node(name=None, instance_id=None, location=None):
except IndexError:
attempts += 1
log.debug(
"Failed to get the data for node '%s'. Remaining " "attempts: %s",
"Failed to get the data for node '%s'. Remaining attempts: %s",
instance_id or name,
attempts,
)
@ -3550,7 +3554,7 @@ def list_nodes_full(location=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called with -f " "or --function."
"The list_nodes_full function must be called with -f or --function."
)
return _list_nodes_full(location or get_location())
@ -3773,8 +3777,8 @@ def show_detailed_monitoring(name=None, instance_id=None, call=None, quiet=False
if not name and not instance_id:
raise SaltCloudSystemExit(
"The show_detailed_monitoring action must be provided with a name or instance\
ID"
"The show_detailed_monitoring action must be provided with a name or"
" instance ID"
)
matched = _get_node(name=name, instance_id=instance_id, location=location)
log.log(
@ -3822,7 +3826,7 @@ def enable_term_protect(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The enable_term_protect action must be called with " "-a or --action."
"The enable_term_protect action must be called with -a or --action."
)
return _toggle_term_protect(name, "true")
@ -3840,7 +3844,7 @@ def disable_term_protect(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The enable_term_protect action must be called with " "-a or --action."
"The enable_term_protect action must be called with -a or --action."
)
return _toggle_term_protect(name, "false")
@ -3852,7 +3856,7 @@ def disable_detailed_monitoring(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The enable_term_protect action must be called with " "-a or --action."
"The enable_term_protect action must be called with -a or --action."
)
instance_id = _get_node(name)["instanceId"]
@ -3876,7 +3880,7 @@ def enable_detailed_monitoring(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The enable_term_protect action must be called with " "-a or --action."
"The enable_term_protect action must be called with -a or --action."
)
instance_id = _get_node(name)["instanceId"]
@ -3907,7 +3911,7 @@ def show_delvol_on_destroy(name, kwargs=None, call=None):
if call != "action":
raise SaltCloudSystemExit(
"The show_delvol_on_destroy action must be called " "with -a or --action."
"The show_delvol_on_destroy action must be called with -a or --action."
)
if not kwargs:
@ -4091,12 +4095,14 @@ def register_image(kwargs=None, call=None):
if not block_device_mapping:
if "snapshot_id" not in kwargs:
log.error(
"snapshot_id or block_device_mapping must be specified to register an image."
"snapshot_id or block_device_mapping must be specified to register an"
" image."
)
return False
if "root_device_name" not in kwargs:
log.error(
"root_device_name or block_device_mapping must be specified to register an image."
"root_device_name or block_device_mapping must be specified to register"
" an image."
)
return False
block_device_mapping = [
@ -4459,9 +4465,7 @@ def describe_volumes(kwargs=None, call=None):
TODO: Add all of the filters.
"""
if call != "function":
log.error(
"The describe_volumes function must be called with -f " "or --function."
)
log.error("The describe_volumes function must be called with -f or --function.")
return False
if not kwargs:
@ -4634,7 +4638,7 @@ def create_snapshot(kwargs=None, call=None, wait_to_finish=False):
"""
if call != "function":
raise SaltCloudSystemExit(
"The create_snapshot function must be called with -f " "or --function."
"The create_snapshot function must be called with -f or --function."
)
if kwargs is None:
@ -4690,9 +4694,7 @@ def delete_snapshot(kwargs=None, call=None):
Delete a snapshot
"""
if call != "function":
log.error(
"The delete_snapshot function must be called with -f " "or --function."
)
log.error("The delete_snapshot function must be called with -f or --function.")
return False
if "snapshot_id" not in kwargs:
@ -4780,7 +4782,7 @@ def describe_snapshots(kwargs=None, call=None):
"""
if call != "function":
log.error(
"The describe_snapshot function must be called with -f " "or --function."
"The describe_snapshot function must be called with -f or --function."
)
return False
@ -4833,7 +4835,7 @@ def get_console_output(
"""
if call != "action":
raise SaltCloudSystemExit(
"The get_console_output action must be called with " "-a or --action."
"The get_console_output action must be called with -a or --action."
)
if location is None:
@ -4899,7 +4901,7 @@ def get_password_data(
"""
if call != "action":
raise SaltCloudSystemExit(
"The get_password_data action must be called with " "-a or --action."
"The get_password_data action must be called with -a or --action."
)
if not instance_id:
@ -5107,8 +5109,10 @@ def show_pricing(kwargs=None, call=None):
raw = ec2_price[region][size]
except KeyError:
return {
"Error": "The size ({}) in the requested profile does not have "
"a price associated with it for the {} region".format(size, region)
"Error": (
"The size ({}) in the requested profile does not have "
"a price associated with it for the {} region".format(size, region)
)
}
ret = {}
@ -5143,7 +5147,7 @@ def ssm_create_association(name=None, kwargs=None, instance_id=None, call=None):
if call != "action":
raise SaltCloudSystemExit(
"The ssm_create_association action must be called with " "-a or --action."
"The ssm_create_association action must be called with -a or --action."
)
if not kwargs:
@ -5196,7 +5200,7 @@ def ssm_describe_association(name=None, kwargs=None, instance_id=None, call=None
"""
if call != "action":
raise SaltCloudSystemExit(
"The ssm_describe_association action must be called with " "-a or --action."
"The ssm_describe_association action must be called with -a or --action."
)
if not kwargs:

View file

@ -2260,7 +2260,7 @@ def create_attach_volumes(name, kwargs, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The create_attach_volumes action must be called with " "-a or --action."
"The create_attach_volumes action must be called with -a or --action."
)
volumes = literal_eval(kwargs["volumes"])
@ -2294,8 +2294,8 @@ def request_instance(vm_):
"""
if not GCE_VM_NAME_REGEX.match(vm_["name"]):
raise SaltCloudSystemExit(
"VM names must start with a letter, only contain letters, numbers, or dashes "
"and cannot end in a dash."
"VM names must start with a letter, only contain letters, numbers, or"
" dashes and cannot end in a dash."
)
try:

View file

@ -411,7 +411,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -107,7 +107,7 @@ def _connect_client():
def avail_locations(call=None):
if call == "action":
raise SaltCloudSystemExit(
"The list_locations function must be called with " "-f or --function"
"The list_locations function must be called with -f or --function"
)
client = _connect_client()
@ -120,7 +120,7 @@ def avail_locations(call=None):
def avail_images(call=None):
if call == "action":
raise SaltCloudSystemExit(
"The avail_images function must be called with " "-f or --function"
"The avail_images function must be called with -f or --function"
)
client = _connect_client()
@ -133,7 +133,7 @@ def avail_images(call=None):
def avail_sizes(call=None):
if call == "action":
raise SaltCloudSystemExit(
"The avail_sizes function must be called with " "-f or --function"
"The avail_sizes function must be called with -f or --function"
)
client = _connect_client()
@ -146,7 +146,7 @@ def avail_sizes(call=None):
def list_ssh_keys(call=None):
if call == "action":
raise SaltCloudSystemExit(
"The list_ssh_keys function must be called with " "-f or --function"
"The list_ssh_keys function must be called with -f or --function"
)
client = _connect_client()
@ -159,7 +159,7 @@ def list_ssh_keys(call=None):
def list_nodes_full(call=None):
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called with " "-f or --function"
"The list_nodes_full function must be called with -f or --function"
)
client = _connect_client()
@ -184,7 +184,7 @@ def list_nodes_full(call=None):
def list_nodes(call=None):
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes function must be called with " "-f or --function"
"The list_nodes function must be called with -f or --function"
)
ret = {}
@ -215,7 +215,7 @@ def wait_until(name, state, timeout=300):
def show_instance(name, call=None):
if call == "action":
raise SaltCloudSystemExit(
"The show_instance function must be called with " "-f or --function"
"The show_instance function must be called with -f or --function"
)
try:
@ -476,7 +476,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
client = _connect_client()

View file

@ -413,7 +413,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](
@ -1091,7 +1091,8 @@ def query(action=None, command=None, args=None, method="GET", location=None, dat
if not user:
log.error(
"username is required for Joyent API requests. Please set one in your provider configuration"
"username is required for Joyent API requests. Please set one in your"
" provider configuration"
)
password = config.get_cloud_config_value(
@ -1116,7 +1117,8 @@ def query(action=None, command=None, args=None, method="GET", location=None, dat
if not ssh_keyfile:
log.error(
"ssh_keyfile is required for Joyent API requests. Please set one in your provider configuration"
"ssh_keyfile is required for Joyent API requests. Please set one in your"
" provider configuration"
)
ssh_keyname = config.get_cloud_config_value(
@ -1129,7 +1131,8 @@ def query(action=None, command=None, args=None, method="GET", location=None, dat
if not ssh_keyname:
log.error(
"ssh_keyname is required for Joyent API requests. Please set one in your provider configuration"
"ssh_keyname is required for Joyent API requests. Please set one in your"
" provider configuration"
)
if not location:

View file

@ -176,7 +176,7 @@ def list_nodes(call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes function must be called " "with -f or --function."
"The list_nodes function must be called with -f or --function."
)
providers = __opts__.get("providers", {})
@ -212,7 +212,7 @@ def list_nodes_full(call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called " "with -f or --function."
"The list_nodes_full function must be called with -f or --function."
)
return list_nodes(call)
@ -224,7 +224,7 @@ def list_nodes_select(call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_select function must be called " "with -f or --function."
"The list_nodes_select function must be called with -f or --function."
)
selection = __opts__.get("query.selection")
@ -598,7 +598,7 @@ def destroy(name, call=None):
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
found = []

View file

@ -392,7 +392,8 @@ def _warn_for_api_v3():
log.warning(
"Linode APIv3 has been deprecated and support will be removed "
"in future releases. Please plan to upgrade to APIv4. For more "
"information, see https://docs.saltstack.com/en/latest/topics/cloud/linode.html#migrating-to-apiv4."
"information, see"
" https://docs.saltstack.com/en/latest/topics/cloud/linode.html#migrating-to-apiv4."
)
HAS_WARNED_FOR_API_V3 = True
@ -1422,8 +1423,7 @@ class LinodeAPIv3(LinodeAPI):
node_id, status=(self._get_status_id_by_name("brand_new"))
):
log.error(
"Error creating %s on LINODE\n\n"
"while waiting for initial ready status",
"Error creating %s on LINODE\n\nwhile waiting for initial ready status",
name,
exc_info_on_loglevel=logging.DEBUG,
)
@ -1703,18 +1703,16 @@ class LinodeAPIv3(LinodeAPI):
if label not in sizes:
if "GB" in label:
raise SaltCloudException(
"Invalid Linode plan ({}) specified - call avail_sizes() for all available options".format(
label
)
"Invalid Linode plan ({}) specified - call avail_sizes() for all"
" available options".format(label)
)
else:
plan = label.split()
if len(plan) != 2:
raise SaltCloudException(
"Invalid Linode plan ({}) specified - call avail_sizes() for all available options".format(
label
)
"Invalid Linode plan ({}) specified - call avail_sizes() for"
" all available options".format(label)
)
plan_type = plan[0]
@ -1734,9 +1732,8 @@ class LinodeAPIv3(LinodeAPI):
if new_label not in sizes:
raise SaltCloudException(
"Invalid Linode plan ({}) specified - call avail_sizes() for all available options".format(
new_label
)
"Invalid Linode plan ({}) specified - call avail_sizes() for"
" all available options".format(new_label)
)
log.warning(
@ -1809,9 +1806,9 @@ class LinodeAPIv3(LinodeAPI):
if not distro_id:
raise SaltCloudNotFound(
"The DistributionID for the '{}' profile could not be found.\n"
"The '{}' instance could not be provisioned. The following distributions "
"are available:\n{}".format(
"The DistributionID for the '{}' profile could not be found.\nThe '{}'"
" instance could not be provisioned. The following distributions are"
" available:\n{}".format(
vm_image_name,
vm_["name"],
pprint.pprint(
@ -2355,7 +2352,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudException(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
return _get_cloud_interface().destroy(name)

View file

@ -343,9 +343,7 @@ last message: {comment}""".format(
keys = list(ret["changes"].items())
keys.sort()
for ch, comment in keys:
sret += ("\n" " {}:\n" " {}").format(
ch, comment.replace("\n", "\n" " ")
)
sret += "\n {}:\n {}".format(ch, comment.replace("\n", "\n "))
if not ret["result"]:
if "changes" in ret:
del ret["changes"]
@ -365,7 +363,7 @@ def destroy(vm_, call=None):
action = __opts__.get("action", "")
if action != "destroy" and not destroy_opt:
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
if not get_configured_provider():
return

View file

@ -286,7 +286,7 @@ def list_hosted_services(conn=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_hosted_services function must be called with " "-f or --function"
"The list_hosted_services function must be called with -f or --function"
)
if not conn:
@ -421,7 +421,8 @@ def show_instance(name, call=None):
)
except TypeError:
log.warning(
"Unable to show cache node data; this may be because the node has been deleted"
"Unable to show cache node data; this may be because the node has been"
" deleted"
)
return nodes[name]
@ -730,7 +731,7 @@ def create_attach_volumes(name, kwargs, call=None, wait_to_finish=True):
"""
if call != "action":
raise SaltCloudSystemExit(
"The create_attach_volumes action must be called with " "-a or --action."
"The create_attach_volumes action must be called with -a or --action."
)
if kwargs is None:
@ -830,7 +831,7 @@ def create_attach_volumes(name, kwargs, call=None, wait_to_finish=True):
"""
if call != "action":
raise SaltCloudSystemExit(
"The create_attach_volumes action must be called with " "-a or --action."
"The create_attach_volumes action must be called with -a or --action."
)
if kwargs is None:
@ -956,7 +957,7 @@ def destroy(name, conn=None, call=None, kwargs=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
if not conn:
@ -1084,8 +1085,7 @@ def list_storage_services(conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_storage_services function must be called "
"with -f or --function."
"The list_storage_services function must be called with -f or --function."
)
if not conn:
@ -1289,7 +1289,7 @@ def create_storage(kwargs=None, conn=None, call=None):
if "location" not in kwargs and "affinity_group" not in kwargs:
raise SaltCloudSystemExit(
"Either a location or an affinity_group " "must be specified (but not both)"
"Either a location or an affinity_group must be specified (but not both)"
)
try:
@ -1306,7 +1306,8 @@ def create_storage(kwargs=None, conn=None, call=None):
return {"Success": "The storage account was successfully created"}
except AzureConflictHttpError:
raise SaltCloudSystemExit(
"There was a conflict. This usually means that the storage account already exists."
"There was a conflict. This usually means that the storage account already"
" exists."
)
@ -1387,7 +1388,8 @@ def regenerate_storage_keys(kwargs=None, conn=None, call=None):
return show_storage_keys(kwargs={"name": kwargs["name"]}, call="function")
except AzureConflictHttpError:
raise SaltCloudSystemExit(
"There was a conflict. This usually means that the storage account already exists."
"There was a conflict. This usually means that the storage account already"
" exists."
)
@ -1516,7 +1518,7 @@ def create_service(kwargs=None, conn=None, call=None):
if "location" not in kwargs and "affinity_group" not in kwargs:
raise SaltCloudSystemExit(
"Either a location or an affinity_group " "must be specified (but not both)"
"Either a location or an affinity_group must be specified (but not both)"
)
try:
@ -1757,7 +1759,8 @@ def list_service_certificates(kwargs=None, conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_service_certificates function must be called with -f or --function."
"The list_service_certificates function must be called with -f or"
" --function."
)
if kwargs is None:
@ -1891,7 +1894,8 @@ def delete_service_certificate(kwargs=None, conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The delete_service_certificate function must be called with -f or --function."
"The delete_service_certificate function must be called with -f or"
" --function."
)
if kwargs is None:
@ -1936,7 +1940,8 @@ def list_management_certificates(kwargs=None, conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_management_certificates function must be called with -f or --function."
"The list_management_certificates function must be called with -f or"
" --function."
)
if not conn:
@ -1964,7 +1969,8 @@ def show_management_certificate(kwargs=None, conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The get_management_certificate function must be called with -f or --function."
"The get_management_certificate function must be called with -f or"
" --function."
)
if not conn:
@ -1999,7 +2005,8 @@ def add_management_certificate(kwargs=None, conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The add_management_certificate function must be called with -f or --function."
"The add_management_certificate function must be called with -f or"
" --function."
)
if not conn:
@ -2046,7 +2053,8 @@ def delete_management_certificate(kwargs=None, conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The delete_management_certificate function must be called with -f or --function."
"The delete_management_certificate function must be called with -f or"
" --function."
)
if kwargs is None:
@ -2121,9 +2129,8 @@ def list_input_endpoints(kwargs=None, conn=None, call=None):
data = query(path)
if data is None:
raise SaltCloudSystemExit(
"There was an error listing endpoints with the {} service on the {} deployment.".format(
kwargs["service"], kwargs["deployment"]
)
"There was an error listing endpoints with the {} service on the {}"
" deployment.".format(kwargs["service"], kwargs["deployment"])
)
ret = {}
@ -2495,7 +2502,8 @@ def create_affinity_group(kwargs=None, conn=None, call=None):
return {"Success": "The affinity group was successfully created"}
except AzureConflictHttpError:
raise SaltCloudSystemExit(
"There was a conflict. This usually means that the affinity group already exists."
"There was a conflict. This usually means that the affinity group already"
" exists."
)
@ -2704,7 +2712,8 @@ def create_storage_container(kwargs=None, storage_conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The create_storage_container function must be called with -f or --function."
"The create_storage_container function must be called with -f or"
" --function."
)
if not storage_conn:
@ -2720,7 +2729,8 @@ def create_storage_container(kwargs=None, storage_conn=None, call=None):
return {"Success": "The storage container was successfully created"}
except AzureConflictHttpError:
raise SaltCloudSystemExit(
"There was a conflict. This usually means that the storage container already exists."
"There was a conflict. This usually means that the storage container"
" already exists."
)
@ -2835,7 +2845,8 @@ def set_storage_container_metadata(kwargs=None, storage_conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The create_storage_container function must be called with -f or --function."
"The create_storage_container function must be called with -f or"
" --function."
)
if kwargs is None:
@ -2933,7 +2944,8 @@ def set_storage_container_acl(kwargs=None, storage_conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The create_storage_container function must be called with -f or --function."
"The create_storage_container function must be called with -f or"
" --function."
)
if not storage_conn:
@ -2973,7 +2985,8 @@ def delete_storage_container(kwargs=None, storage_conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The delete_storage_container function must be called with -f or --function."
"The delete_storage_container function must be called with -f or"
" --function."
)
if kwargs is None:
@ -3163,7 +3176,8 @@ def show_blob_service_properties(kwargs=None, storage_conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The show_blob_service_properties function must be called with -f or --function."
"The show_blob_service_properties function must be called with -f or"
" --function."
)
if not storage_conn:
@ -3201,7 +3215,8 @@ def set_blob_service_properties(kwargs=None, storage_conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The set_blob_service_properties function must be called with -f or --function."
"The set_blob_service_properties function must be called with -f or"
" --function."
)
if kwargs is None:

View file

@ -425,7 +425,7 @@ def list_nodes_full(conn=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called with -f or " "--function."
"The list_nodes_full function must be called with -f or --function."
)
if not conn:
@ -735,7 +735,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -895,10 +895,7 @@ def _get_device_template(disk, disk_info, template=None):
for arg in args:
if arg not in disk_info:
raise SaltCloudSystemExit(
"The disk {} requires a {}\
argument".format(
disk, arg
)
"The disk {} requires a {} argument".format(disk, arg)
)
_require_disk_opts("disk_type", "size")
@ -913,8 +910,7 @@ def _get_device_template(disk, disk_info, template=None):
clone_image = get_template_image(kwargs={"name": template})
clone_image_id = get_image_id(kwargs={"name": clone_image})
temp = "DISK=[IMAGE={}, IMAGE_ID={}, CLONE=YES,\
SIZE={}]".format(
temp = "DISK=[IMAGE={}, IMAGE_ID={}, CLONE=YES, SIZE={}]".format(
clone_image, clone_image_id, size
)
return temp
@ -1030,7 +1026,8 @@ def create(vm_):
)
if "CLONE" not in str(template):
raise SaltCloudSystemExit(
"Missing an image disk to clone. Must define a clone disk alongside all other disk definitions."
"Missing an image disk to clone. Must define a clone disk alongside all"
" other disk definitions."
)
template_args = "\n".join(template)
@ -1174,7 +1171,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](
@ -1596,7 +1593,8 @@ def image_snapshot_delete(call=None, kwargs=None):
if snapshot_id is None:
raise SaltCloudSystemExit(
"The image_snapshot_delete function requires a 'snapshot_id' to be provided."
"The image_snapshot_delete function requires a 'snapshot_id' to be"
" provided."
)
if image_id:
@ -1663,7 +1661,8 @@ def image_snapshot_revert(call=None, kwargs=None):
if snapshot_id is None:
raise SaltCloudSystemExit(
"The image_snapshot_revert function requires a 'snapshot_id' to be provided."
"The image_snapshot_revert function requires a 'snapshot_id' to be"
" provided."
)
if image_id:
@ -3212,8 +3211,8 @@ def vm_disk_snapshot_create(name, kwargs=None, call=None):
if disk_id is None or description is None:
raise SaltCloudSystemExit(
"The vm_disk_snapshot_create function requires a 'disk_id' and a 'description' "
"to be provided."
"The vm_disk_snapshot_create function requires a 'disk_id' and a"
" 'description' to be provided."
)
server, user, password = _get_xml_rpc()
@ -3265,8 +3264,8 @@ def vm_disk_snapshot_delete(name, kwargs=None, call=None):
if disk_id is None or snapshot_id is None:
raise SaltCloudSystemExit(
"The vm_disk_snapshot_create function requires a 'disk_id' and a 'snapshot_id' "
"to be provided."
"The vm_disk_snapshot_create function requires a 'disk_id' and a"
" 'snapshot_id' to be provided."
)
server, user, password = _get_xml_rpc()
@ -3320,8 +3319,8 @@ def vm_disk_snapshot_revert(name, kwargs=None, call=None):
if disk_id is None or snapshot_id is None:
raise SaltCloudSystemExit(
"The vm_disk_snapshot_revert function requires a 'disk_id' and a 'snapshot_id' "
"to be provided."
"The vm_disk_snapshot_revert function requires a 'disk_id' and a"
" 'snapshot_id' to be provided."
)
server, user, password = _get_xml_rpc()
@ -3513,8 +3512,7 @@ def vm_monitoring(name, call=None):
if response[0] is False:
log.error(
"There was an error retrieving the specified VM's monitoring "
"information."
"There was an error retrieving the specified VM's monitoring information."
)
return {}
else:
@ -3882,8 +3880,7 @@ def vn_add_ar(call=None, kwargs=None):
vn_id = get_vn_id(kwargs={"name": vn_name})
else:
raise SaltCloudSystemExit(
"The vn_add_ar function requires a 'vn_id' and a 'vn_name' to "
"be provided."
"The vn_add_ar function requires a 'vn_id' and a 'vn_name' to be provided."
)
if data:
@ -4040,7 +4037,7 @@ def vn_delete(call=None, kwargs=None):
vn_id = get_vn_id(kwargs={"name": name})
else:
raise SaltCloudSystemExit(
"The vn_delete function requires a 'name' or a 'vn_id' " "to be provided."
"The vn_delete function requires a 'name' or a 'vn_id' to be provided."
)
server, user, password = _get_xml_rpc()
@ -4108,8 +4105,7 @@ def vn_free_ar(call=None, kwargs=None):
vn_id = get_vn_id(kwargs={"name": vn_name})
else:
raise SaltCloudSystemExit(
"The vn_free_ar function requires a 'vn_id' or a 'vn_name' to "
"be provided."
"The vn_free_ar function requires a 'vn_id' or a 'vn_name' to be provided."
)
server, user, password = _get_xml_rpc()
@ -4179,7 +4175,7 @@ def vn_hold(call=None, kwargs=None):
vn_id = get_vn_id(kwargs={"name": vn_name})
else:
raise SaltCloudSystemExit(
"The vn_hold function requires a 'vn_id' or a 'vn_name' to " "be provided."
"The vn_hold function requires a 'vn_id' or a 'vn_name' to be provided."
)
if data:
@ -4193,7 +4189,7 @@ def vn_hold(call=None, kwargs=None):
data = rfh.read()
else:
raise SaltCloudSystemExit(
"The vn_hold function requires either 'data' or a 'path' to " "be provided."
"The vn_hold function requires either 'data' or a 'path' to be provided."
)
server, user, password = _get_xml_rpc()
@ -4252,8 +4248,7 @@ def vn_info(call=None, kwargs=None):
vn_id = get_vn_id(kwargs={"name": name})
else:
raise SaltCloudSystemExit(
"The vn_info function requires either a 'name' or a 'vn_id' "
"to be provided."
"The vn_info function requires either a 'name' or a 'vn_id' to be provided."
)
server, user, password = _get_xml_rpc()
@ -4322,8 +4317,7 @@ def vn_release(call=None, kwargs=None):
vn_id = get_vn_id(kwargs={"name": vn_name})
else:
raise SaltCloudSystemExit(
"The vn_release function requires a 'vn_id' or a 'vn_name' to "
"be provided."
"The vn_release function requires a 'vn_id' or a 'vn_name' to be provided."
)
if data:
@ -4337,8 +4331,7 @@ def vn_release(call=None, kwargs=None):
data = rfh.read()
else:
raise SaltCloudSystemExit(
"The vn_release function requires either 'data' or a 'path' to "
"be provided."
"The vn_release function requires either 'data' or a 'path' to be provided."
)
server, user, password = _get_xml_rpc()
@ -4409,8 +4402,7 @@ def vn_reserve(call=None, kwargs=None):
vn_id = get_vn_id(kwargs={"name": vn_name})
else:
raise SaltCloudSystemExit(
"The vn_reserve function requires a 'vn_id' or a 'vn_name' to "
"be provided."
"The vn_reserve function requires a 'vn_id' or a 'vn_name' to be provided."
)
if data:
@ -4459,7 +4451,7 @@ def _get_node(name):
except KeyError:
attempts -= 1
log.debug(
"Failed to get the data for node '%s'. Remaining " "attempts: %s",
"Failed to get the data for node '%s'. Remaining attempts: %s",
name,
attempts,
)

View file

@ -608,7 +608,7 @@ def list_networks(conn=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_networks function must be called with " "-f or --function"
"The list_networks function must be called with -f or --function"
)
if conn is None:
conn = get_conn()
@ -629,7 +629,7 @@ def list_subnets(conn=None, call=None, kwargs=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_subnets function must be called with " "-f or --function."
"The list_subnets function must be called with -f or --function."
)
if conn is None:
conn = get_conn()
@ -841,7 +841,7 @@ def destroy(name, conn=None, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](
@ -901,7 +901,7 @@ def call(conn=None, call=None, kwargs=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The call function must be called with " "-f or --function."
"The call function must be called with -f or --function."
)
if "func" not in kwargs:

View file

@ -375,7 +375,7 @@ def create(vm_):
if device.state != "active":
log.error(
"Error creating %s on PACKET\n\n" "while waiting for initial ready status",
"Error creating %s on PACKET\n\nwhile waiting for initial ready status",
name,
exc_info_on_loglevel=logging.DEBUG,
)
@ -427,8 +427,7 @@ def create(vm_):
if volume.state != "active":
log.error(
"Error creating %s on PACKET\n\n"
"while waiting for initial ready status",
"Error creating %s on PACKET\n\nwhile waiting for initial ready status",
name,
exc_info_on_loglevel=logging.DEBUG,
)
@ -575,7 +574,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudException(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -520,7 +520,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -258,13 +258,12 @@ def list_images(call=None, kwargs=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_images function must be called with " "-f or --function."
"The list_images function must be called with -f or --function."
)
if not version_compatible("4.0"):
raise SaltCloudNotFound(
"The 'image_alias' feature requires the profitbricks "
"SDK v4.0.0 or greater."
"The 'image_alias' feature requires the profitbricks SDK v4.0.0 or greater."
)
ret = {}
@ -506,7 +505,7 @@ def list_datacenters(conn=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_datacenters function must be called with " "-f or --function."
"The list_datacenters function must be called with -f or --function."
)
datacenters = []
@ -540,7 +539,7 @@ def list_nodes(conn=None, call=None):
try:
nodes = conn.list_servers(datacenter_id=datacenter_id)
except PBNotFoundError:
log.error("Failed to get nodes list " "from datacenter: %s", datacenter_id)
log.error("Failed to get nodes list from datacenter: %s", datacenter_id)
raise
for item in nodes["items"]:
@ -558,7 +557,7 @@ def list_nodes_full(conn=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called with -f or " "--function."
"The list_nodes_full function must be called with -f or --function."
)
if not conn:
@ -599,7 +598,7 @@ def reserve_ipblock(call=None, kwargs=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The reserve_ipblock function must be called with -f or " "--function."
"The reserve_ipblock function must be called with -f or --function."
)
conn = get_conn()
@ -936,7 +935,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -314,7 +314,7 @@ def get_resources_nodes(call=None, resFilter=None):
ret[name] = resource
if resFilter is not None:
log.debug("Filter given: %s, returning requested " "resource: nodes", resFilter)
log.debug("Filter given: %s, returning requested resource: nodes", resFilter)
return ret[resFilter]
log.debug("Filter not given: %s, returning all resource: nodes", ret)
@ -355,9 +355,7 @@ def get_resources_vms(call=None, resFilter=None, includeConfig=True):
)
if time.time() > timeoutTime:
raise SaltCloudExecutionTimeout(
"FAILED to get the proxmox " "resources vms"
)
raise SaltCloudExecutionTimeout("FAILED to get the proxmox resources vms")
# Carry on if there wasn't a bad resource return from Proxmox
if not badResource:
@ -366,7 +364,7 @@ def get_resources_vms(call=None, resFilter=None, includeConfig=True):
time.sleep(0.5)
if resFilter is not None:
log.debug("Filter given: %s, returning requested " "resource: nodes", resFilter)
log.debug("Filter given: %s, returning requested resource: nodes", resFilter)
return ret[resFilter]
log.debug("Filter not given: %s, returning all resource: nodes", ret)
@ -803,7 +801,8 @@ def create_node(vm_, newid):
if vm_["technology"] not in ["qemu", "openvz", "lxc"]:
# Wrong VM type given
log.error(
"Wrong VM type. Valid options are: qemu, openvz (proxmox3) or lxc (proxmox4)"
"Wrong VM type. Valid options are: qemu, openvz (proxmox3) or lxc"
" (proxmox4)"
)
raise SaltCloudExecutionFailure
@ -989,8 +988,7 @@ def wait_for_created(upid, timeout=300):
info = _lookup_proxmox_task(upid)
if not info:
log.error(
"wait_for_created: No task information "
"retrieved based on given criteria."
"wait_for_created: No task information retrieved based on given criteria."
)
raise SaltCloudExecutionFailure
@ -1043,7 +1041,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -339,7 +339,7 @@ def show_image(kwargs, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The show_images function must be called with " "-f or --function"
"The show_images function must be called with -f or --function"
)
if not isinstance(kwargs, dict):
@ -869,7 +869,7 @@ def destroy(instance_id, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
instance_data = show_instance(instance_id, call="action")

View file

@ -458,7 +458,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a, or --action."
"The destroy action must be called with -d, --destroy, -a, or --action."
)
opts = __opts__

View file

@ -413,7 +413,7 @@ def _get_node(name):
return list_nodes_full()[name]
except KeyError:
log.debug(
"Failed to get the data for node '%s'. Remaining " "attempts: %s",
"Failed to get the data for node '%s'. Remaining attempts: %s",
name,
attempt,
)
@ -433,7 +433,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -614,7 +614,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -418,8 +418,7 @@ def create(vm_):
def list_nodes_full(
mask="mask[id, hostname, primaryIpAddress, \
primaryBackendIpAddress, processorPhysicalCoreAmount, memoryCount]",
mask="mask[id, hostname, primaryIpAddress, primaryBackendIpAddress, processorPhysicalCoreAmount, memoryCount]",
call=None,
):
"""
@ -509,7 +508,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -292,7 +292,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a, or --action."
"The destroy action must be called with -d, --destroy, -a, or --action."
)
opts = __opts__

View file

@ -71,7 +71,8 @@ def __virtual__():
if get_configured_provider() is False:
return (
False,
"The virtualbox driver cannot be loaded: 'virtualbox' provider is not configured.",
"The virtualbox driver cannot be loaded: 'virtualbox' provider is not"
" configured.",
)
# If the name of the driver used does not match the filename,
@ -271,7 +272,7 @@ def list_nodes_full(kwargs=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called " "with -f or --function."
"The list_nodes_full function must be called with -f or --function."
)
machines = {}
@ -316,7 +317,7 @@ def list_nodes(kwargs=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes function must be called " "with -f or --function."
"The list_nodes function must be called with -f or --function."
)
attributes = [

View file

@ -327,9 +327,8 @@ def _add_new_hard_disk_helper(
if not datastore_cluster_ref:
# datastore/datastore cluster specified does not exist
raise SaltCloudSystemExit(
"Specified datastore/datastore cluster ({}) for disk ({}) does not exist".format(
datastore, disk_label
)
"Specified datastore/datastore cluster ({}) for disk ({}) does not"
" exist".format(datastore, disk_label)
)
# datastore cluster has been specified
@ -358,9 +357,8 @@ def _add_new_hard_disk_helper(
if not datastore_ref:
# datastore cluster specified does not have any accessible datastores
raise SaltCloudSystemExit(
"Specified datastore cluster ({}) for disk ({}) does not have any accessible datastores available".format(
datastore, disk_label
)
"Specified datastore cluster ({}) for disk ({}) does not have any"
" accessible datastores available".format(datastore, disk_label)
)
datastore_path = "[" + str(datastore_ref.name) + "] " + vm_name
@ -857,7 +855,7 @@ def _manage_devices(devices, vm=None, container_ref=None, new_vm_name=None):
disk_spec = _get_mode_spec(device, mode, disk_spec)
else:
raise SaltCloudSystemExit(
"Invalid disk" " backing mode" " specified!"
"Invalid disk backing mode specified!"
)
if disk_spec is not None:
device_specs.append(disk_spec)
@ -1225,7 +1223,7 @@ def _wait_for_ip(vm_ref, max_wait):
vm_name = vm_ref.summary.config.name
resolved_ips = salt.utils.network.host_to_ips(vm_name)
log.debug(
"Timeout waiting for VMware tools. The name %s resolved " "to %s",
"Timeout waiting for VMware tools. The name %s resolved to %s",
vm_name,
resolved_ips,
)
@ -1754,8 +1752,7 @@ def test_vcenter_connection(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The test_vcenter_connection function must be called with "
"-f or --function."
"The test_vcenter_connection function must be called with -f or --function."
)
try:
@ -1779,7 +1776,7 @@ def get_vcenter_version(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The get_vcenter_version function must be called with " "-f or --function."
"The get_vcenter_version function must be called with -f or --function."
)
# Get the inventory
@ -1800,7 +1797,7 @@ def list_datacenters(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_datacenters function must be called with " "-f or --function."
"The list_datacenters function must be called with -f or --function."
)
return {"Datacenters": salt.utils.vmware.list_datacenters(_get_si())}
@ -1818,7 +1815,7 @@ def list_portgroups(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_portgroups function must be called with " "-f or --function."
"The list_portgroups function must be called with -f or --function."
)
return {"Portgroups": salt.utils.vmware.list_portgroups(_get_si())}
@ -1836,7 +1833,7 @@ def list_clusters(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_clusters function must be called with " "-f or --function."
"The list_clusters function must be called with -f or --function."
)
return {"Clusters": salt.utils.vmware.list_clusters(_get_si())}
@ -1854,8 +1851,7 @@ def list_datastore_clusters(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_datastore_clusters function must be called with "
"-f or --function."
"The list_datastore_clusters function must be called with -f or --function."
)
return {"Datastore Clusters": salt.utils.vmware.list_datastore_clusters(_get_si())}
@ -1873,7 +1869,7 @@ def list_datastores(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_datastores function must be called with " "-f or --function."
"The list_datastores function must be called with -f or --function."
)
return {"Datastores": salt.utils.vmware.list_datastores(_get_si())}
@ -1891,7 +1887,7 @@ def list_hosts(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_hosts function must be called with " "-f or --function."
"The list_hosts function must be called with -f or --function."
)
return {"Hosts": salt.utils.vmware.list_hosts(_get_si())}
@ -1909,7 +1905,7 @@ def list_resourcepools(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_resourcepools function must be called with " "-f or --function."
"The list_resourcepools function must be called with -f or --function."
)
return {"Resource Pools": salt.utils.vmware.list_resourcepools(_get_si())}
@ -1927,7 +1923,7 @@ def list_networks(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_networks function must be called with " "-f or --function."
"The list_networks function must be called with -f or --function."
)
return {"Networks": salt.utils.vmware.list_networks(_get_si())}
@ -1945,7 +1941,7 @@ def list_nodes_min(kwargs=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_min function must be called " "with -f or --function."
"The list_nodes_min function must be called with -f or --function."
)
ret = {}
@ -1982,7 +1978,7 @@ def list_nodes(kwargs=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes function must be called " "with -f or --function."
"The list_nodes function must be called with -f or --function."
)
ret = {}
@ -2045,7 +2041,7 @@ def list_nodes_full(kwargs=None, call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_full function must be called " "with -f or --function."
"The list_nodes_full function must be called with -f or --function."
)
ret = {}
@ -2098,7 +2094,7 @@ def list_nodes_select(call=None):
"""
if call == "action":
raise SaltCloudSystemExit(
"The list_nodes_select function must be called " "with -f or --function."
"The list_nodes_select function must be called with -f or --function."
)
ret = {}
@ -2181,7 +2177,7 @@ def show_instance(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The show_instance action must be called with " "-a or --action."
"The show_instance action must be called with -a or --action."
)
vm_properties = [
@ -2321,7 +2317,7 @@ def list_templates(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_templates function must be called with " "-f or --function."
"The list_templates function must be called with -f or --function."
)
return {"Templates": avail_images(call="function")}
@ -2339,7 +2335,7 @@ def list_folders(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_folders function must be called with " "-f or --function."
"The list_folders function must be called with -f or --function."
)
return {"Folders": salt.utils.vmware.list_folders(_get_si())}
@ -2368,7 +2364,7 @@ def list_snapshots(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_snapshots function must be called with " "-f or --function."
"The list_snapshots function must be called with -f or --function."
)
ret = {}
@ -2403,7 +2399,7 @@ def start(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The start action must be called with " "-a or --action."
"The start action must be called with -a or --action."
)
vm_properties = ["name", "summary.runtime.powerState"]
@ -2455,9 +2451,7 @@ def stop(name, soft=False, call=None):
salt-cloud -a stop vmname soft=True
"""
if call != "action":
raise SaltCloudSystemExit(
"The stop action must be called with " "-a or --action."
)
raise SaltCloudSystemExit("The stop action must be called with -a or --action.")
vm_properties = ["name", "summary.runtime.powerState"]
@ -2503,7 +2497,7 @@ def suspend(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The suspend action must be called with " "-a or --action."
"The suspend action must be called with -a or --action."
)
vm_properties = ["name", "summary.runtime.powerState"]
@ -2560,7 +2554,7 @@ def reset(name, soft=False, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The reset action must be called with " "-a or --action."
"The reset action must be called with -a or --action."
)
vm_properties = ["name", "summary.runtime.powerState"]
@ -2611,7 +2605,7 @@ def terminate(name, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The terminate action must be called with " "-a or --action."
"The terminate action must be called with -a or --action."
)
vm_properties = ["name", "summary.runtime.powerState"]
@ -2656,7 +2650,7 @@ def destroy(name, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](
@ -2858,7 +2852,8 @@ def create(vm_):
clone_type = "template" if object_ref.config.template else "vm"
else:
raise SaltCloudSystemExit(
"The VM/template that you have specified under clonefrom does not exist."
"The VM/template that you have specified under clonefrom does not"
" exist."
)
else:
clone_type = None
@ -2887,7 +2882,8 @@ def create(vm_):
resourcepool_ref = cluster_ref.resourcePool
elif clone_type == "template":
raise SaltCloudSystemExit(
"You must either specify a cluster or a resource pool when cloning from a template."
"You must either specify a cluster or a resource pool when cloning from a"
" template."
)
elif not clone_type:
raise SaltCloudSystemExit(
@ -2926,7 +2922,8 @@ def create(vm_):
folder_ref = datacenter_ref.vmFolder
elif not clone_type:
raise SaltCloudSystemExit(
"You must either specify a folder or a datacenter when creating not cloning."
"You must either specify a folder or a datacenter when creating not"
" cloning."
)
else:
log.debug(
@ -3260,9 +3257,9 @@ def handle_snapshot(config_spec, object_ref, reloc_spec, template, vm_):
)
if not clone_spec:
raise SaltCloudSystemExit(
"Invalid disk move type specified"
" supported types are"
" {}".format(" ".join(allowed_types))
"Invalid disk move type specified supported types are {}".format(
" ".join(allowed_types)
)
)
return clone_spec
@ -3318,7 +3315,7 @@ def create_datacenter(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The create_datacenter function must be called with " "-f or --function."
"The create_datacenter function must be called with -f or --function."
)
datacenter_name = kwargs.get("name") if kwargs and "name" in kwargs else None
@ -3377,7 +3374,7 @@ def create_cluster(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The create_cluster function must be called with " "-f or --function."
"The create_cluster function must be called with -f or --function."
)
cluster_name = kwargs.get("name") if kwargs and "name" in kwargs else None
@ -3390,7 +3387,8 @@ def create_cluster(kwargs=None, call=None):
if not datacenter:
raise SaltCloudSystemExit(
"You must specify name of the datacenter where the cluster should be created."
"You must specify name of the datacenter where the cluster should be"
" created."
)
# Get the service instance
@ -3448,7 +3446,7 @@ def rescan_hba(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The rescan_hba function must be called with " "-f or --function."
"The rescan_hba function must be called with -f or --function."
)
hba = kwargs.get("hba") if kwargs and "hba" in kwargs else None
@ -3502,7 +3500,7 @@ def upgrade_tools_all(call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The upgrade_tools_all function must be called with " "-f or --function."
"The upgrade_tools_all function must be called with -f or --function."
)
ret = {}
@ -3537,7 +3535,7 @@ def upgrade_tools(name, reboot=False, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The upgrade_tools action must be called with " "-a or --action."
"The upgrade_tools action must be called with -a or --action."
)
vm_ref = salt.utils.vmware.get_mor_by_property(_get_si(), vim.VirtualMachine, name)
@ -3568,8 +3566,7 @@ def list_hosts_by_cluster(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_hosts_by_cluster function must be called with "
"-f or --function."
"The list_hosts_by_cluster function must be called with -f or --function."
)
ret = {}
@ -3734,7 +3731,7 @@ def list_hbas(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_hbas function must be called with " "-f or --function."
"The list_hbas function must be called with -f or --function."
)
ret = {}
@ -3788,7 +3785,7 @@ def list_dvs(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_dvs function must be called with " "-f or --function."
"The list_dvs function must be called with -f or --function."
)
return {"Distributed Virtual Switches": salt.utils.vmware.list_dvs(_get_si())}
@ -3806,7 +3803,7 @@ def list_vapps(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The list_vapps function must be called with " "-f or --function."
"The list_vapps function must be called with -f or --function."
)
return {"vApps": salt.utils.vmware.list_vapps(_get_si())}
@ -3824,8 +3821,7 @@ def enter_maintenance_mode(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The enter_maintenance_mode function must be called with "
"-f or --function."
"The enter_maintenance_mode function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -3868,8 +3864,7 @@ def exit_maintenance_mode(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The exit_maintenance_mode function must be called with "
"-f or --function."
"The exit_maintenance_mode function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -3930,7 +3925,7 @@ def create_folder(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The create_folder function must be called with " "-f or --function."
"The create_folder function must be called with -f or --function."
)
# Get the service instance object
@ -4011,7 +4006,7 @@ def create_snapshot(name, kwargs=None, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The create_snapshot action must be called with " "-a or --action."
"The create_snapshot action must be called with -a or --action."
)
if kwargs is None:
@ -4093,7 +4088,7 @@ def revert_to_snapshot(name, kwargs=None, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The revert_to_snapshot action must be called with " "-a or --action."
"The revert_to_snapshot action must be called with -a or --action."
)
if kwargs is None:
@ -4154,7 +4149,7 @@ def remove_snapshot(name, kwargs=None, call=None):
if call != "action":
raise SaltCloudSystemExit(
"The create_snapshot action must be called with " "-a or --action."
"The create_snapshot action must be called with -a or --action."
)
if kwargs is None:
@ -4221,7 +4216,7 @@ def remove_all_snapshots(name, kwargs=None, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The remove_all_snapshots action must be called with " "-a or --action."
"The remove_all_snapshots action must be called with -a or --action."
)
vm_ref = salt.utils.vmware.get_mor_by_property(_get_si(), vim.VirtualMachine, name)
@ -4254,7 +4249,7 @@ def convert_to_template(name, kwargs=None, call=None):
"""
if call != "action":
raise SaltCloudSystemExit(
"The convert_to_template action must be called with " "-a or --action."
"The convert_to_template action must be called with -a or --action."
)
vm_ref = salt.utils.vmware.get_mor_by_property(_get_si(), vim.VirtualMachine, name)
@ -4319,7 +4314,7 @@ def add_host(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The add_host function must be called with " "-f or --function."
"The add_host function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -4465,7 +4460,7 @@ def remove_host(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The remove_host function must be called with " "-f or --function."
"The remove_host function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -4515,7 +4510,7 @@ def connect_host(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The connect_host function must be called with " "-f or --function."
"The connect_host function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -4561,7 +4556,7 @@ def disconnect_host(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The disconnect_host function must be called with " "-f or --function."
"The disconnect_host function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -4615,7 +4610,7 @@ def reboot_host(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The reboot_host function must be called with " "-f or --function."
"The reboot_host function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -4633,7 +4628,8 @@ def reboot_host(kwargs=None, call=None):
if host_ref.runtime.connectionState == "notResponding":
raise SaltCloudSystemExit(
"Specified host system cannot be rebooted in it's current state (not responding)."
"Specified host system cannot be rebooted in it's current state (not"
" responding)."
)
if not host_ref.capability.rebootSupported:
@ -4641,9 +4637,9 @@ def reboot_host(kwargs=None, call=None):
if not host_ref.runtime.inMaintenanceMode and not force:
raise SaltCloudSystemExit(
"Specified host system is not in maintenance mode. Specify force=True to "
"force reboot even if there are virtual machines running or other operations "
"in progress."
"Specified host system is not in maintenance mode. Specify force=True to"
" force reboot even if there are virtual machines running or other"
" operations in progress."
)
try:
@ -4690,12 +4686,14 @@ def create_datastore_cluster(kwargs=None, call=None):
if not datastore_cluster_name or len(datastore_cluster_name) >= 80:
raise SaltCloudSystemExit(
"The datastore cluster name must be a non empty string of less than 80 characters."
"The datastore cluster name must be a non empty string of less than 80"
" characters."
)
if not datacenter_name:
raise SaltCloudSystemExit(
"You must specify name of the datacenter where the datastore cluster should be created."
"You must specify name of the datacenter where the datastore cluster should"
" be created."
)
# Get the service instance
@ -4747,7 +4745,7 @@ def shutdown_host(kwargs=None, call=None):
"""
if call != "function":
raise SaltCloudSystemExit(
"The shutdown_host function must be called with " "-f or --function."
"The shutdown_host function must be called with -f or --function."
)
host_name = kwargs.get("host") if kwargs and "host" in kwargs else None
@ -4765,7 +4763,8 @@ def shutdown_host(kwargs=None, call=None):
if host_ref.runtime.connectionState == "notResponding":
raise SaltCloudSystemExit(
"Specified host system cannot be shut down in it's current state (not responding)."
"Specified host system cannot be shut down in it's current state (not"
" responding)."
)
if not host_ref.capability.rebootSupported:
@ -4773,9 +4772,9 @@ def shutdown_host(kwargs=None, call=None):
if not host_ref.runtime.inMaintenanceMode and not force:
raise SaltCloudSystemExit(
"Specified host system is not in maintenance mode. Specify force=True to "
"force reboot even if there are virtual machines running or other operations "
"in progress."
"Specified host system is not in maintenance mode. Specify force=True to"
" force reboot even if there are virtual machines running or other"
" operations in progress."
)
try:

View file

@ -466,7 +466,7 @@ def create(vm_):
)
if int(data.get("status", "200")) >= 300:
log.error(
"Error creating %s on Vultr\n\n" "Vultr API returned %s\n",
"Error creating %s on Vultr\n\nVultr API returned %s\n",
vm_["name"],
data,
)

View file

@ -420,7 +420,10 @@ def avail_sizes(session=None, call=None):
"The avail_sizes function must be called with -f or --function."
)
return {
"STATUS": "Sizes are build into templates. Consider running --list-images to see sizes"
"STATUS": (
"Sizes are build into templates. Consider running --list-images to see"
" sizes"
)
}
@ -975,7 +978,7 @@ def destroy(name=None, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
ret = {}
__utils__["cloud.fire_event"](

View file

@ -24,8 +24,9 @@ class SaltCloudSystemExit(SaltCloudException):
def __init__(self, message, exit_code=salt.defaults.exitcodes.EX_GENERIC):
SaltCloudException.__init__(self, message)
self.message = "{} [WARNING: salt.cloud.exceptions is deprecated. Please migrate to salt.exceptions!]".format(
message
self.message = (
"{} [WARNING: salt.cloud.exceptions is deprecated. Please migrate to"
" salt.exceptions!]".format(message)
)
self.exit_code = exit_code

View file

@ -253,7 +253,7 @@ def destroy(name, conn=None, call=None):
"""
if call == "function":
raise SaltCloudSystemExit(
"The destroy action must be called with -d, --destroy, " "-a or --action."
"The destroy action must be called with -d, --destroy, -a or --action."
)
__utils__["cloud.fire_event"](

View file

@ -43,7 +43,10 @@ log = logging.getLogger(__name__)
_DFLT_LOG_DATEFMT = "%H:%M:%S"
_DFLT_LOG_DATEFMT_LOGFILE = "%Y-%m-%d %H:%M:%S"
_DFLT_LOG_FMT_CONSOLE = "[%(levelname)-8s] %(message)s"
_DFLT_LOG_FMT_LOGFILE = "%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(process)d] %(message)s"
_DFLT_LOG_FMT_LOGFILE = (
"%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(process)d]"
" %(message)s"
)
_DFLT_LOG_FMT_JID = "[JID: %(jid)s]"
_DFLT_REFSPECS = ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"]
DEFAULT_INTERVAL = 60
@ -1734,7 +1737,7 @@ def _validate_pillar_roots(pillar_roots):
"""
if not isinstance(pillar_roots, dict):
log.warning(
"The pillar_roots parameter is not properly formatted," " using defaults"
"The pillar_roots parameter is not properly formatted, using defaults"
)
return {"base": _expand_glob_path([salt.syspaths.BASE_PILLAR_ROOTS_DIR])}
return _normalize_roots(pillar_roots)
@ -1747,7 +1750,7 @@ def _validate_file_roots(file_roots):
"""
if not isinstance(file_roots, dict):
log.warning(
"The file_roots parameter is not properly formatted," " using defaults"
"The file_roots parameter is not properly formatted, using defaults"
)
return {"base": _expand_glob_path([salt.syspaths.BASE_FILE_ROOTS_DIR])}
return _normalize_roots(file_roots)
@ -1966,7 +1969,7 @@ def _absolute_path(path, relative_to=None):
_abspath = os.path.join(relative_to, path)
if os.path.isfile(_abspath):
log.debug(
"Relative path '%s' converted to existing absolute path " "'%s'",
"Relative path '%s' converted to existing absolute path '%s'",
path,
_abspath,
)
@ -2571,7 +2574,7 @@ def cloud_config(
if providers_config_path is not None and providers_config is not None:
raise salt.exceptions.SaltCloudConfigError(
"Only pass `providers_config` or `providers_config_path`, " "not both."
"Only pass `providers_config` or `providers_config_path`, not both."
)
elif providers_config_path is None and providers_config is None:
providers_config_path = overrides.get(
@ -3576,7 +3579,8 @@ def _update_ssl_config(opts):
or not hasattr(ssl, val)
):
message = "SSL option '{}' must be set to one of the following values: '{}'.".format(
key, "', '".join([val for val in dir(ssl) if val.startswith(prefix)])
key,
"', '".join([val for val in dir(ssl) if val.startswith(prefix)]),
)
log.error(message)
raise salt.exceptions.SaltConfigurationError(message)

View file

@ -103,8 +103,10 @@ class vSANClusterConfigItem(ComplexSchemaItem):
)
auto_claim_storage = BooleanItem(
title="Auto Claim Storage",
description="Specifies whether the storage of member ESXi hosts should "
"be automatically claimed for vSAN",
description=(
"Specifies whether the storage of member ESXi hosts should "
"be automatically claimed for vSAN"
),
)
dedup_enabled = BooleanItem(
title="Enabled", description="Specifies dedup should be enabled"
@ -127,8 +129,10 @@ class DRSConfigItem(ComplexSchemaItem):
)
vmotion_rate = IntegerItem(
title="vMotion rate",
description="Aggressiveness to do automatic vMotions: "
"1 (least aggressive) - 5 (most aggressive)",
description=(
"Aggressiveness to do automatic vMotions: "
"1 (least aggressive) - 5 (most aggressive)"
),
minimum=1,
maximum=5,
)

View file

@ -116,7 +116,7 @@ class VmfsDatastoreDiskIdItem(ComplexSchemaItem):
)
backing_disk_id = StringItem(
title="Backing Disk Id",
description=("Specifies the id of the disk backing the VMFS " "datastore"),
description="Specifies the id of the disk backing the VMFS datastore",
pattern=r"[^\s]+",
required=True,
)
@ -139,9 +139,7 @@ class VmfsDatastoreDiskScsiAddressItem(ComplexSchemaItem):
)
backing_disk_scsi_addr = VMwareScsiAddressItem(
title="Backing Disk Scsi Address",
description=(
"Specifies the SCSI address of the disk backing the VMFS " "datastore"
),
description="Specifies the SCSI address of the disk backing the VMFS datastore",
required=True,
)
vmfs_version = IntegerItem(

View file

@ -68,11 +68,16 @@ class ESXVirtualMachinePlacementSchemaItem(ComplexSchemaItem):
)
resourcepool = StringItem(
title="Virtual Machine Resource Pool",
description="Resource pool of the virtual machine if it is placed to a resource pool",
description=(
"Resource pool of the virtual machine if it is placed to a resource pool"
),
)
folder = StringItem(
title="Virtual Machine Folder",
description="Folder of the virtual machine where it should be deployed, default is the datacenter vmFolder",
description=(
"Folder of the virtual machine where it should be deployed, default is the"
" datacenter vmFolder"
),
)
@ -139,8 +144,10 @@ class ESXVirtualMachineSerialSchemaItem(ComplexSchemaItem):
)
adapter = StringItem(
title="Virtual Machine Serial Port Name",
description="Unique adapter name for virtual machine serial port"
"for creation an arbitrary value should be specified",
description=(
"Unique adapter name for virtual machine serial port "
"for creation an arbitrary value should be specified"
),
required=True,
)
backing = ESXVirtualMachineSerialBackingItem()
@ -161,8 +168,10 @@ class ESXVirtualMachineScsiSchemaItem(ComplexSchemaItem):
adapter = StringItem(
title="Virtual Machine SCSI Controller Name",
description="Unique SCSI controller name"
"for creation an arbitrary value should be specified",
description=(
"Unique SCSI controller name "
"for creation an arbitrary value should be specified"
),
required=True,
)
type = StringItem(
@ -194,8 +203,10 @@ class ESXVirtualMachineSataSchemaItem(ComplexSchemaItem):
required = False
adapter = StringItem(
title="Virtual Machine SATA Controller Name",
description="Unique SATA controller name"
"for creation an arbitrary value should be specified",
description=(
"Unique SATA controller name "
"for creation an arbitrary value should be specified"
),
required=True,
)
bus_number = NumberItem(
@ -219,16 +230,19 @@ class ESXVirtualMachineDiskSchemaItem(ComplexSchemaItem):
)
unit = StringItem(
title="Disk size unit",
description="Unit of the disk size, to VMware a "
"GB is the same as GiB = 1024MiB",
description=(
"Unit of the disk size, to VMware a GB is the same as GiB = 1024MiB"
),
required=False,
default="GB",
enum=("KB", "MB", "GB"),
)
adapter = StringItem(
title="Virtual Machine Adapter Name",
description="Unique adapter name for virtual machine"
"for creation an arbitrary value should be specified",
description=(
"Unique adapter name for virtual machine "
"for creation an arbitrary value should be specified"
),
required=True,
)
filename = StringItem(
@ -290,8 +304,10 @@ class ESXVirtualMachineInterfaceSchemaItem(ComplexSchemaItem):
)
adapter = StringItem(
title="Virtual Machine Network Adapter",
description="Unique name of the network adapter, "
"for creation an arbitrary value should be specified",
description=(
"Unique name of the network adapter, "
"for creation an arbitrary value should be specified"
),
required=True,
)
adapter_type = StringItem(
@ -303,7 +319,10 @@ class ESXVirtualMachineInterfaceSchemaItem(ComplexSchemaItem):
)
switch_type = StringItem(
title="Virtual Machine Switch Type",
description="Specifies the type of the virtual switch for the virtual machine connection",
description=(
"Specifies the type of the virtual switch for the virtual machine"
" connection"
),
required=True,
default="standard",
enum=("standard", "distributed"),
@ -333,8 +352,7 @@ class ESXVirtualMachineMemorySchemaItem(ComplexSchemaItem):
unit = StringItem(
title="Memory unit",
description="Unit of the memory, to VMware a "
"GB is the same as GiB = 1024MiB",
description="Unit of the memory, to VMware a GB is the same as GiB = 1024MiB",
required=False,
default="MB",
enum=("MB", "GB"),

View file

@ -76,8 +76,7 @@ class RosterEntryConfig(Schema):
timeout = IntegerItem(
title="Timeout",
description=(
"Number of seconds to wait for response "
"when establishing an SSH connection"
"Number of seconds to wait for response when establishing an SSH connection"
),
)
thin_dir = StringItem(

View file

@ -284,7 +284,7 @@ def gen_signature(priv_path, pub_path, sign_path, passphrase=None):
if os.path.isfile(sign_path):
log.trace(
"Signature file %s already exists, please remove it first and " "try again",
"Signature file %s already exists, please remove it first and try again",
sign_path,
)
else:
@ -757,7 +757,8 @@ class AsyncAuth:
raise salt.ext.tornado.gen.Return("retry")
else:
raise SaltClientError(
"Attempt to authenticate with the salt master failed with timeout error"
"Attempt to authenticate with the salt master failed with timeout"
" error"
)
finally:
if close_channel:
@ -1035,7 +1036,7 @@ class AsyncAuth:
return False
except Exception as sign_exc: # pylint: disable=broad-except
log.error(
"There was an error while verifying the masters public-key " "signature"
"There was an error while verifying the masters public-key signature"
)
raise Exception(sign_exc)

View file

@ -1112,8 +1112,10 @@ class LocalFuncs:
return {
"error": {
"name": err_name,
"message": 'Authentication failure of type "{}" occurred '
"for user {}.".format(auth_type, username),
"message": (
'Authentication failure of type "{}" occurred '
"for user {}.".format(auth_type, username)
),
}
}
elif isinstance(runner_check, dict) and "error" in runner_check:
@ -1162,8 +1164,10 @@ class LocalFuncs:
return {
"error": {
"name": err_name,
"message": 'Authentication failure of type "{}" occurred for '
"user {}.".format(auth_type, username),
"message": (
'Authentication failure of type "{}" occurred for '
"user {}.".format(auth_type, username)
),
}
}
elif isinstance(wheel_check, dict) and "error" in wheel_check:

View file

@ -275,19 +275,18 @@ class _SyslogServerFactory(DatagramProtocol):
self.title = topics
if len(topics) < 2 or topics[0] != "jnpr" or topics[1] != "syslog":
log.debug(
'The topic specified in configuration should start with \
"jnpr/syslog". Using the default topic.'
"The topic specified in configuration should start with "
'"jnpr/syslog". Using the default topic.'
)
self.title = ["jnpr", "syslog", "hostname", "event"]
else:
for i in range(2, len(topics)):
if topics[i] not in data:
log.debug(
"Please check the topic specified. \
Only the following keywords can be specified \
in the topic: hostip, priority, severity, \
facility, timestamp, hostname, daemon, pid, \
message, event. Using the default topic."
"Please check the topic specified. Only the following "
"keywords can be specified in the topic: hostip, priority, "
"severity, facility, timestamp, hostname, daemon, pid, "
"message, event. Using the default topic."
)
self.title = ["jnpr", "syslog", "hostname", "event"]
break
@ -337,8 +336,8 @@ class _SyslogServerFactory(DatagramProtocol):
raise Exception("Arguments in config not specified properly")
else:
raise Exception(
"Please check the arguments given to junos engine in the\
configuration file"
"Please check the arguments given to junos engine in the "
"configuration file"
)
if send_this_event:

View file

@ -198,8 +198,8 @@ def __virtual__():
if not HAS_NAPALM_LOGS or not zmq:
return (
False,
"napalm_syslog could not be loaded. \
Please install napalm-logs library amd ZeroMQ.",
"napalm_syslog could not be loaded. Please install "
"napalm-logs library and ZeroMQ.",
)
return True

View file

@ -284,7 +284,8 @@ class SlackClient:
ret_groups[name]["targets"].update(config.get("targets", {}))
except (IndexError, AttributeError):
log.warning(
"Couldn't use group %s. Check that targets is a dictionary and not a list",
"Couldn't use group %s. Check that targets is a dictionary and not"
" a list",
name,
)
@ -516,9 +517,7 @@ class SlackClient:
)
user_id = m_data["message"]["user"]
elif "comment" in m_data and "user" in m_data["comment"]:
log.debug(
"Comment was added, " "so we look for user in " "the comment."
)
log.debug("Comment was added, so we look for user in the comment.")
user_id = m_data["comment"]["user"]
else:
user_id = m_data.get("user")
@ -581,13 +580,13 @@ class SlackClient:
loaded_groups = self.get_config_groups(groups, groups_pillar_name)
if not data.get("user_name"):
log.error(
"The user %s can not be looked up via slack. What has happened here?",
"The user %s can not be looked up via slack. What has"
" happened here?",
m_data.get("user"),
)
channel.send_message(
"The user {} can not be looked up via slack. Not running {}".format(
data["user_id"], msg_text
)
"The user {} can not be looked up via slack. Not"
" running {}".format(data["user_id"], msg_text)
)
yield {"message_data": m_data}
continue

View file

@ -90,7 +90,8 @@ def __virtual__():
if not HAS_BOTO:
return (
False,
"Cannot import engine sqs_events because the required boto module is missing",
"Cannot import engine sqs_events because the required boto module is"
" missing",
)
else:
return True

View file

@ -1132,7 +1132,7 @@ class RemoteClient(Client):
if dest is not None and (os.path.isdir(dest) or dest.endswith(("/", "\\"))):
dest = os.path.join(dest, os.path.basename(path))
log.debug(
"In saltenv '%s', '%s' is a directory. Changing dest to " "'%s'",
"In saltenv '%s', '%s' is a directory. Changing dest to '%s'",
saltenv,
os.path.dirname(dest),
dest,
@ -1145,7 +1145,7 @@ class RemoteClient(Client):
rel_path = self._check_proto(path)
log.debug(
"In saltenv '%s', looking at rel_path '%s' to resolve " "'%s'",
"In saltenv '%s', looking at rel_path '%s' to resolve '%s'",
saltenv,
rel_path,
path,
@ -1154,7 +1154,7 @@ class RemoteClient(Client):
dest2check = cache_dest
log.debug(
"In saltenv '%s', ** considering ** path '%s' to resolve " "'%s'",
"In saltenv '%s', ** considering ** path '%s' to resolve '%s'",
saltenv,
dest2check,
path,

View file

@ -293,7 +293,7 @@ def init():
_failhard()
except Exception as exc: # pylint: disable=broad-except
log.error(
"Exception '%s' encountered while initializing hgfs " "remote %s",
"Exception '%s' encountered while initializing hgfs remote %s",
exc,
repo_url,
)

View file

@ -77,8 +77,7 @@ def find_file(path, tgt_env="base", **kwargs): # pylint: disable=W0613
return fnd
if os.path.basename(path) == "top.sls":
log.debug(
"minionfs will NOT serve top.sls "
"for security reasons (path requested: %s)",
"minionfs will NOT serve top.sls for security reasons (path requested: %s)",
path,
)
return fnd
@ -196,8 +195,7 @@ def file_hash(load, fnd):
)
except ValueError:
log.debug(
"Fileserver attempted to read incomplete cache file. "
"Retrying."
"Fileserver attempted to read incomplete cache file. Retrying."
)
file_hash(load, fnd)
return ret
@ -207,9 +205,7 @@ def file_hash(load, fnd):
return ret
# Can't use Python select() because we need Windows support
except os.error:
log.debug(
"Fileserver encountered lock when reading cache file. " "Retrying."
)
log.debug("Fileserver encountered lock when reading cache file. Retrying.")
file_hash(load, fnd)
return ret

View file

@ -109,7 +109,7 @@ def _rev(repo):
repo_info = dict(CLIENT.info(repo["repo"]).items())
except (pysvn._pysvn.ClientError, TypeError, KeyError, AttributeError) as exc:
log.error(
"Error retrieving revision ID for svnfs remote %s " "(cachedir: %s): %s",
"Error retrieving revision ID for svnfs remote %s (cachedir: %s): %s",
repo["url"],
repo["repo"],
exc,

View file

@ -77,7 +77,7 @@ if salt.utils.platform.is_windows():
HAS_WMI = True
except ImportError:
log.exception(
"Unable to import Python wmi module, some core grains " "will be missing"
"Unable to import Python wmi module, some core grains will be missing"
)
@ -1058,7 +1058,8 @@ def _virtual(osdata):
# Some firmwares provide non-valid 'product_name'
# files, ignore them
log.debug(
"The content in /sys/devices/virtual/dmi/id/product_name is not valid"
"The content in /sys/devices/virtual/dmi/id/product_name is not"
" valid"
)
except OSError:
pass
@ -1319,7 +1320,8 @@ def _clean_value(key, val):
else:
# map unspecified, undefined, unknown & whatever to None
if re.search(r"to be filled", val, flags=re.IGNORECASE) or re.search(
r"un(known|specified)|no(t|ne)? (asset|provided|defined|available|present|specified)",
r"un(known|specified)|no(t|ne)?"
r" (asset|provided|defined|available|present|specified)",
val,
flags=re.IGNORECASE,
):
@ -2389,7 +2391,8 @@ def hostname():
# Otherwise we would stacktrace below
if __FQDN__ is None: # still!
log.error(
"Having trouble getting a hostname. Does this machine have its hostname and domain set properly?"
"Having trouble getting a hostname. Does this machine have its hostname"
" and domain set properly?"
)
__FQDN__ = "localhost.localdomain"
@ -2748,7 +2751,8 @@ def _hw_data(osdata):
# Some firmwares provide non-valid 'product_name'
# files, ignore them
log.debug(
"The content in /sys/devices/virtual/dmi/id/product_name is not valid"
"The content in /sys/devices/virtual/dmi/id/product_name is not"
" valid"
)
except OSError as err:
# PermissionError is new to Python 3, but corresponds to the EACESS and

View file

@ -99,8 +99,9 @@ def _windows_iqn():
get = "iSCSINodeName"
cmd_ret = salt.modules.cmdmod.run_all(
"{} /namespace:{} path {} get {} /format:table"
"".format(wmic, namespace, path, get)
"{} /namespace:{} path {} get {} /format:table".format(
wmic, namespace, path, get
)
)
for line in cmd_ret["stdout"].splitlines():

Some files were not shown because too many files have changed in this diff Show more