mirror of
https://github.com/saltstack/salt.git
synced 2025-04-15 17:20:19 +00:00
Update to isort 5.10.1
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
2ff4835ff3
commit
4d49013247
1045 changed files with 1363 additions and 446 deletions
|
@ -1147,7 +1147,7 @@ repos:
|
|||
args: [--silent, -E, fix_asserts, -E, fix_docstrings]
|
||||
|
||||
- repo: https://github.com/timothycrosley/isort
|
||||
rev: "1e78a9acf3110e1f9721feb591f89a451fc9876a"
|
||||
rev: 5.10.1
|
||||
hooks:
|
||||
- id: isort
|
||||
additional_dependencies: ['toml']
|
||||
|
|
|
@ -2,7 +2,6 @@ import itertools
|
|||
import os
|
||||
import re
|
||||
|
||||
import salt
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import Directive
|
||||
from docutils.statemachine import ViewList
|
||||
|
@ -14,6 +13,8 @@ from sphinx.locale import _
|
|||
from sphinx.roles import XRefRole
|
||||
from sphinx.util.nodes import make_refnode, nested_parse_with_titles, set_source_info
|
||||
|
||||
import salt
|
||||
|
||||
|
||||
class Event(PyObject):
|
||||
"""
|
||||
|
|
7
run.py
7
run.py
|
@ -1,18 +1,19 @@
|
|||
#!/usr/bin/env python3
|
||||
# see issue: https://gitlab.com/saltstack/open/salt-pkg/-/issues/19
|
||||
import _pyio
|
||||
import contextlib
|
||||
import multiprocessing
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import salt.scripts
|
||||
import salt.utils.platform
|
||||
import _pyio
|
||||
import tiamatpip.cli
|
||||
import tiamatpip.configure
|
||||
import tiamatpip.utils
|
||||
|
||||
import salt.scripts
|
||||
import salt.utils.platform
|
||||
|
||||
AVAIL = (
|
||||
"minion",
|
||||
"master",
|
||||
|
|
|
@ -6,8 +6,8 @@ Provide authentication using OpenStack Keystone
|
|||
|
||||
|
||||
try:
|
||||
from keystoneclient.v2_0 import client
|
||||
from keystoneclient.exceptions import AuthorizationFailure, Unauthorized
|
||||
from keystoneclient.v2_0 import client
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -6,9 +6,10 @@ Provide authentication using simple LDAP binds
|
|||
import itertools
|
||||
import logging
|
||||
|
||||
from jinja2 import Environment
|
||||
|
||||
import salt.utils.data
|
||||
import salt.utils.stringutils
|
||||
from jinja2 import Environment
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -16,8 +17,8 @@ log = logging.getLogger(__name__)
|
|||
try:
|
||||
# pylint: disable=no-name-in-module
|
||||
import ldap
|
||||
import ldap.modlist
|
||||
import ldap.filter
|
||||
import ldap.modlist
|
||||
|
||||
HAS_LDAP = True
|
||||
# pylint: enable=no-name-in-module
|
||||
|
|
|
@ -55,8 +55,8 @@ log = logging.getLogger(__name__)
|
|||
try:
|
||||
# Trying to import MySQLdb
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb.connections import OperationalError
|
||||
except ImportError:
|
||||
try:
|
||||
|
@ -65,8 +65,8 @@ except ImportError:
|
|||
|
||||
pymysql.install_as_MySQLdb()
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb.err import OperationalError
|
||||
except ImportError:
|
||||
MySQLdb = None
|
||||
|
|
|
@ -14,8 +14,8 @@ import salt.utils.beacons
|
|||
|
||||
try:
|
||||
# pylint: disable=no-name-in-module
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from watchdog.observers import Observer
|
||||
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
|
|
4
salt/cache/mysql_cache.py
vendored
4
salt/cache/mysql_cache.py
vendored
|
@ -60,8 +60,8 @@ from salt.exceptions import SaltCacheError
|
|||
try:
|
||||
# Trying to import MySQLdb
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb.connections import OperationalError
|
||||
except ImportError:
|
||||
try:
|
||||
|
@ -70,8 +70,8 @@ except ImportError:
|
|||
|
||||
pymysql.install_as_MySQLdb()
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb.err import OperationalError
|
||||
except ImportError:
|
||||
MySQLdb = None
|
||||
|
|
|
@ -590,10 +590,9 @@ class LocalClient:
|
|||
# even though it has already been imported.
|
||||
# when cmd_batch is called via the NetAPI
|
||||
# the module is unavailable.
|
||||
import salt.utils.args
|
||||
|
||||
# Late import - not used anywhere else in this file
|
||||
import salt.cli.batch
|
||||
import salt.utils.args
|
||||
|
||||
arg = salt.utils.args.condition_input(arg, kwarg)
|
||||
opts = {
|
||||
|
|
|
@ -83,9 +83,9 @@ except ImportError:
|
|||
HAS_CLC = False
|
||||
# Disable InsecureRequestWarning generated on python > 2.6
|
||||
try:
|
||||
from requests.packages.urllib3 import (
|
||||
from requests.packages.urllib3 import ( # pylint: disable=no-name-in-module
|
||||
disable_warnings,
|
||||
) # pylint: disable=no-name-in-module
|
||||
)
|
||||
|
||||
disable_warnings()
|
||||
except Exception: # pylint: disable=broad-except
|
||||
|
|
|
@ -39,13 +39,12 @@ from salt.utils.versions import LooseVersion as _LooseVersion
|
|||
# Import libcloud
|
||||
try:
|
||||
import libcloud
|
||||
from libcloud.compute.base import NodeDriver, NodeState
|
||||
from libcloud.compute.base import NodeAuthPassword
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.compute.base import NodeAuthPassword, NodeDriver, NodeState
|
||||
from libcloud.compute.providers import get_driver
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.loadbalancer.base import Member
|
||||
from libcloud.loadbalancer.types import Provider as Provider_lb
|
||||
from libcloud.loadbalancer.providers import get_driver as get_driver_lb
|
||||
from libcloud.loadbalancer.types import Provider as Provider_lb
|
||||
|
||||
# This work-around for Issue #32743 is no longer needed for libcloud >=
|
||||
# 1.4.0. However, older versions of libcloud must still be supported with
|
||||
|
|
|
@ -66,14 +66,11 @@ from salt.utils.versions import LooseVersion as _LooseVersion
|
|||
LIBCLOUD_IMPORT_ERROR = None
|
||||
try:
|
||||
import libcloud
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.common.google import ResourceInUseError, ResourceNotFoundError
|
||||
from libcloud.compute.providers import get_driver
|
||||
from libcloud.loadbalancer.types import Provider as Provider_lb
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.loadbalancer.providers import get_driver as get_driver_lb
|
||||
from libcloud.common.google import (
|
||||
ResourceInUseError,
|
||||
ResourceNotFoundError,
|
||||
)
|
||||
from libcloud.loadbalancer.types import Provider as Provider_lb
|
||||
|
||||
HAS_LIBCLOUD = True
|
||||
except ImportError:
|
||||
|
|
|
@ -61,13 +61,14 @@ from salt.exceptions import SaltCloudSystemExit
|
|||
HAS_LIBS = False
|
||||
try:
|
||||
import azure
|
||||
import azure.storage
|
||||
import azure.servicemanagement
|
||||
import azure.storage
|
||||
from azure.common import (
|
||||
AzureConflictHttpError,
|
||||
AzureMissingResourceHttpError,
|
||||
AzureException,
|
||||
AzureMissingResourceHttpError,
|
||||
)
|
||||
|
||||
import salt.utils.msazure
|
||||
from salt.utils.msazure import object_to_dict
|
||||
|
||||
|
|
|
@ -109,13 +109,7 @@ from salt.exceptions import (
|
|||
|
||||
try:
|
||||
# pylint: disable=no-name-in-module
|
||||
from oneandone.client import (
|
||||
OneAndOneService,
|
||||
Server,
|
||||
Hdd,
|
||||
BlockStorage,
|
||||
SshKey,
|
||||
)
|
||||
from oneandone.client import BlockStorage, Hdd, OneAndOneService, Server, SshKey
|
||||
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ from salt.exceptions import (
|
|||
|
||||
try:
|
||||
import xmlrpc.client
|
||||
|
||||
from lxml import etree
|
||||
|
||||
HAS_XML_LIBS = True
|
||||
|
|
|
@ -240,10 +240,10 @@ from salt.exceptions import (
|
|||
)
|
||||
|
||||
try:
|
||||
import shade
|
||||
import shade.openstackcloud
|
||||
import shade.exc
|
||||
import os_client_config
|
||||
import shade
|
||||
import shade.exc
|
||||
import shade.openstackcloud
|
||||
|
||||
HAS_SHADE = (
|
||||
salt.utils.versions._LooseVersion(shade.__version__)
|
||||
|
|
|
@ -114,17 +114,17 @@ try:
|
|||
# pylint: disable=no-name-in-module
|
||||
import profitbricks
|
||||
from profitbricks.client import (
|
||||
ProfitBricksService,
|
||||
Server,
|
||||
LAN,
|
||||
NIC,
|
||||
Volume,
|
||||
Datacenter,
|
||||
FirewallRule,
|
||||
IPBlock,
|
||||
Datacenter,
|
||||
LoadBalancer,
|
||||
LAN,
|
||||
PBNotFoundError,
|
||||
PBError,
|
||||
PBNotFoundError,
|
||||
ProfitBricksService,
|
||||
Server,
|
||||
Volume,
|
||||
)
|
||||
|
||||
# pylint: enable=no-name-in-module
|
||||
|
|
|
@ -642,7 +642,7 @@ def create(vm_):
|
|||
if "use_dns" in vm_ and "ip_address" not in vm_:
|
||||
use_dns = vm_["use_dns"]
|
||||
if use_dns:
|
||||
from socket import gethostbyname, gaierror
|
||||
from socket import gaierror, gethostbyname
|
||||
|
||||
try:
|
||||
ip_address = gethostbyname(str(vm_["name"]))
|
||||
|
|
|
@ -29,8 +29,8 @@ log = logging.getLogger(__name__)
|
|||
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from impacket.smbconnection import SessionError as smbSessionError
|
||||
from impacket.smb3 import SessionError as smb3SessionError
|
||||
from impacket.smbconnection import SessionError as smbSessionError
|
||||
|
||||
HAS_IMPACKET = True
|
||||
except ImportError:
|
||||
|
@ -38,18 +38,17 @@ except ImportError:
|
|||
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from winrm.exceptions import WinRMTransportError
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from requests.exceptions import (
|
||||
ConnectionError,
|
||||
ConnectTimeout,
|
||||
ReadTimeout,
|
||||
SSLError,
|
||||
ProxyError,
|
||||
RetryError,
|
||||
InvalidSchema,
|
||||
ProxyError,
|
||||
ReadTimeout,
|
||||
RetryError,
|
||||
SSLError,
|
||||
)
|
||||
from winrm.exceptions import WinRMTransportError
|
||||
|
||||
HAS_WINRM = True
|
||||
except ImportError:
|
||||
|
|
|
@ -47,8 +47,8 @@ try:
|
|||
from tencentcloud.common.profile.client_profile import ClientProfile
|
||||
from tencentcloud.cvm.v20170312 import cvm_client
|
||||
from tencentcloud.cvm.v20170312 import models as cvm_models
|
||||
from tencentcloud.vpc.v20170312 import vpc_client
|
||||
from tencentcloud.vpc.v20170312 import models as vpc_models
|
||||
from tencentcloud.vpc.v20170312 import vpc_client
|
||||
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
|
|
|
@ -23,15 +23,16 @@ from salt.exceptions import SaltCloudSystemExit
|
|||
|
||||
try:
|
||||
import vboxapi # pylint: disable=unused-import
|
||||
|
||||
from salt.utils.virtualbox import (
|
||||
vb_list_machines,
|
||||
treat_machine_dict,
|
||||
vb_clone_vm,
|
||||
vb_machine_exists,
|
||||
vb_destroy_machine,
|
||||
vb_get_machine,
|
||||
vb_stop_vm,
|
||||
treat_machine_dict,
|
||||
vb_list_machines,
|
||||
vb_machine_exists,
|
||||
vb_start_vm,
|
||||
vb_stop_vm,
|
||||
vb_wait_for_network_address,
|
||||
)
|
||||
|
||||
|
|
|
@ -139,9 +139,9 @@ except ImportError:
|
|||
|
||||
# Disable InsecureRequestWarning generated on python > 2.6
|
||||
try:
|
||||
from requests.packages.urllib3 import (
|
||||
from requests.packages.urllib3 import ( # pylint: disable=no-name-in-module
|
||||
disable_warnings,
|
||||
) # pylint: disable=no-name-in-module
|
||||
)
|
||||
|
||||
disable_warnings()
|
||||
except ImportError:
|
||||
|
|
|
@ -16,9 +16,9 @@ from salt.exceptions import SaltCloudNotFound, SaltCloudSystemExit
|
|||
# pylint: disable=W0611
|
||||
try:
|
||||
import libcloud
|
||||
from libcloud.compute.types import Provider, NodeState
|
||||
from libcloud.compute.providers import get_driver
|
||||
from libcloud.compute.deployment import MultiStepDeployment, ScriptDeployment
|
||||
from libcloud.compute.providers import get_driver
|
||||
from libcloud.compute.types import NodeState, Provider
|
||||
|
||||
HAS_LIBCLOUD = True
|
||||
LIBCLOUD_VERSION_INFO = tuple(
|
||||
|
|
|
@ -43,7 +43,7 @@ from salt.exceptions import (
|
|||
)
|
||||
|
||||
try:
|
||||
from M2Crypto import RSA, EVP, BIO
|
||||
from M2Crypto import BIO, EVP, RSA
|
||||
|
||||
HAS_M2 = True
|
||||
except ImportError:
|
||||
|
@ -51,11 +51,12 @@ except ImportError:
|
|||
|
||||
if not HAS_M2:
|
||||
try:
|
||||
from Cryptodome.Cipher import AES, PKCS1_OAEP, PKCS1_v1_5 as PKCS1_v1_5_CIPHER
|
||||
from Cryptodome import Random
|
||||
from Cryptodome.Cipher import AES, PKCS1_OAEP
|
||||
from Cryptodome.Cipher import PKCS1_v1_5 as PKCS1_v1_5_CIPHER
|
||||
from Cryptodome.Hash import SHA
|
||||
from Cryptodome.PublicKey import RSA
|
||||
from Cryptodome.Signature import PKCS1_v1_5
|
||||
from Cryptodome import Random
|
||||
|
||||
HAS_CRYPTO = True
|
||||
except ImportError:
|
||||
|
@ -63,18 +64,14 @@ if not HAS_M2:
|
|||
|
||||
if not HAS_M2 and not HAS_CRYPTO:
|
||||
try:
|
||||
from Crypto.Cipher import ( # nosec
|
||||
AES,
|
||||
PKCS1_OAEP,
|
||||
PKCS1_v1_5 as PKCS1_v1_5_CIPHER,
|
||||
)
|
||||
# let this be imported, if possible
|
||||
from Crypto import Random # nosec
|
||||
from Crypto.Cipher import AES, PKCS1_OAEP # nosec
|
||||
from Crypto.Cipher import PKCS1_v1_5 as PKCS1_v1_5_CIPHER # nosec
|
||||
from Crypto.Hash import SHA # nosec
|
||||
from Crypto.PublicKey import RSA # nosec
|
||||
from Crypto.Signature import PKCS1_v1_5 # nosec
|
||||
|
||||
# let this be imported, if possible
|
||||
from Crypto import Random # nosec
|
||||
|
||||
HAS_CRYPTO = True
|
||||
except ImportError:
|
||||
HAS_CRYPTO = False
|
||||
|
|
|
@ -40,7 +40,7 @@ import logging
|
|||
import salt.utils.event
|
||||
|
||||
try:
|
||||
from fluent import sender, event
|
||||
from fluent import event, sender
|
||||
except ImportError:
|
||||
sender = None
|
||||
|
||||
|
|
|
@ -92,22 +92,22 @@ import time
|
|||
import salt.utils.event as event
|
||||
|
||||
try:
|
||||
from twisted.internet.protocol import ( # pylint: disable=no-name-in-module
|
||||
DatagramProtocol,
|
||||
)
|
||||
from twisted.internet import reactor, threads # pylint: disable=no-name-in-module
|
||||
from pyparsing import (
|
||||
Word,
|
||||
alphas,
|
||||
Suppress,
|
||||
Combine,
|
||||
nums,
|
||||
string,
|
||||
LineEnd,
|
||||
Optional,
|
||||
Regex,
|
||||
LineEnd,
|
||||
StringEnd,
|
||||
Suppress,
|
||||
Word,
|
||||
alphas,
|
||||
delimitedList,
|
||||
nums,
|
||||
string,
|
||||
)
|
||||
from twisted.internet import reactor, threads # pylint: disable=no-name-in-module
|
||||
from twisted.internet.protocol import ( # pylint: disable=no-name-in-module
|
||||
DatagramProtocol,
|
||||
)
|
||||
|
||||
HAS_TWISTED_AND_PYPARSING = True
|
||||
|
|
|
@ -24,6 +24,7 @@ import uuid
|
|||
from errno import EACCES, EPERM
|
||||
|
||||
import distro
|
||||
|
||||
import salt.exceptions
|
||||
|
||||
# Solve the Chicken and egg problem where grains need to run before any
|
||||
|
|
|
@ -40,7 +40,7 @@ import socket
|
|||
from salt._logging import LOG_LEVELS
|
||||
|
||||
try:
|
||||
from log4mongo.handlers import MongoHandler, MongoFormatter
|
||||
from log4mongo.handlers import MongoFormatter, MongoHandler
|
||||
|
||||
HAS_MONGO = True
|
||||
except ImportError:
|
||||
|
|
|
@ -54,10 +54,7 @@ log = logging.getLogger(__name__)
|
|||
try:
|
||||
import apt.cache
|
||||
import apt.debfile
|
||||
from aptsources.sourceslist import (
|
||||
SourceEntry,
|
||||
SourcesList,
|
||||
)
|
||||
from aptsources.sourceslist import SourceEntry, SourcesList
|
||||
|
||||
HAS_APT = True
|
||||
except ImportError:
|
||||
|
|
|
@ -57,8 +57,8 @@ log = logging.getLogger(__name__)
|
|||
|
||||
try:
|
||||
# pylint: disable=unused-import
|
||||
import botocore
|
||||
import boto3
|
||||
import botocore
|
||||
|
||||
# pylint: enable=unused-import
|
||||
logging.getLogger("boto3").setLevel(logging.CRITICAL)
|
||||
|
|
|
@ -50,8 +50,8 @@ log = logging.getLogger(__name__)
|
|||
|
||||
# pylint: disable=unused-import
|
||||
try:
|
||||
import botocore
|
||||
import boto3
|
||||
import botocore
|
||||
import jmespath
|
||||
|
||||
logging.getLogger("boto3").setLevel(logging.CRITICAL)
|
||||
|
|
|
@ -93,10 +93,10 @@ try:
|
|||
# pylint: disable=unused-import
|
||||
import boto
|
||||
import boto3
|
||||
from botocore import __version__ as found_botocore_version
|
||||
|
||||
# pylint: enable=unused-import
|
||||
from botocore.exceptions import ClientError
|
||||
from botocore import __version__ as found_botocore_version
|
||||
|
||||
logging.getLogger("boto").setLevel(logging.CRITICAL)
|
||||
logging.getLogger("boto3").setLevel(logging.CRITICAL)
|
||||
|
|
|
@ -63,9 +63,9 @@ DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
|||
try:
|
||||
import boto
|
||||
import boto.ec2
|
||||
import boto.ec2.instance
|
||||
import boto.ec2.blockdevicemapping as blockdevicemapping
|
||||
import boto.ec2.autoscale as autoscale
|
||||
import boto.ec2.blockdevicemapping as blockdevicemapping
|
||||
import boto.ec2.instance
|
||||
|
||||
logging.getLogger("boto").setLevel(logging.CRITICAL)
|
||||
import boto3 # pylint: disable=unused-import
|
||||
|
|
|
@ -45,16 +45,17 @@ Connection module for Amazon CloudWatch
|
|||
|
||||
import logging
|
||||
|
||||
import yaml # pylint: disable=blacklisted-import
|
||||
|
||||
import salt.utils.json
|
||||
import salt.utils.odict as odict
|
||||
import salt.utils.versions
|
||||
import yaml # pylint: disable=blacklisted-import
|
||||
|
||||
try:
|
||||
import boto
|
||||
import boto.ec2.cloudwatch
|
||||
import boto.ec2.cloudwatch.listelement
|
||||
import boto.ec2.cloudwatch.dimension
|
||||
import boto.ec2.cloudwatch.listelement
|
||||
|
||||
logging.getLogger("boto").setLevel(logging.CRITICAL)
|
||||
HAS_BOTO = True
|
||||
|
|
|
@ -55,12 +55,13 @@ try:
|
|||
import boto.dynamodb2
|
||||
|
||||
# pylint: enable=unused-import
|
||||
from boto.dynamodb2.fields import HashKey, RangeKey
|
||||
from boto.dynamodb2.fields import (
|
||||
AllIndex,
|
||||
GlobalAllIndex,
|
||||
GlobalIncludeIndex,
|
||||
GlobalKeysOnlyIndex,
|
||||
HashKey,
|
||||
RangeKey,
|
||||
)
|
||||
from boto.dynamodb2.table import Table
|
||||
from boto.exception import JSONResponseError
|
||||
|
|
|
@ -60,8 +60,8 @@ try:
|
|||
# pylint: enable=unused-import
|
||||
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
|
||||
from boto.ec2.networkinterface import (
|
||||
NetworkInterfaceSpecification,
|
||||
NetworkInterfaceCollection,
|
||||
NetworkInterfaceSpecification,
|
||||
)
|
||||
|
||||
HAS_BOTO = True
|
||||
|
|
|
@ -54,10 +54,12 @@ try:
|
|||
import boto
|
||||
import boto.ec2 # pylint: enable=unused-import
|
||||
from boto.ec2.elb import HealthCheck
|
||||
from boto.ec2.elb.attributes import AccessLogAttribute
|
||||
from boto.ec2.elb.attributes import ConnectionDrainingAttribute
|
||||
from boto.ec2.elb.attributes import ConnectionSettingAttribute
|
||||
from boto.ec2.elb.attributes import CrossZoneLoadBalancingAttribute
|
||||
from boto.ec2.elb.attributes import (
|
||||
AccessLogAttribute,
|
||||
ConnectionDrainingAttribute,
|
||||
ConnectionSettingAttribute,
|
||||
CrossZoneLoadBalancingAttribute,
|
||||
)
|
||||
|
||||
logging.getLogger("boto").setLevel(logging.CRITICAL)
|
||||
HAS_BOTO = True
|
||||
|
|
|
@ -49,7 +49,6 @@ try:
|
|||
import botocore
|
||||
|
||||
# pylint: enable=unused-import
|
||||
|
||||
# TODO Version check using salt.utils.versions
|
||||
from botocore.exceptions import ClientError
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ import salt.utils.versions
|
|||
# pylint: disable=unused-import
|
||||
try:
|
||||
import boto
|
||||
import boto.iam
|
||||
import boto3
|
||||
import boto.iam
|
||||
import botocore
|
||||
|
||||
logging.getLogger("boto").setLevel(logging.CRITICAL)
|
||||
|
|
|
@ -64,10 +64,10 @@ try:
|
|||
# pylint: disable=unused-import
|
||||
import boto
|
||||
import boto3
|
||||
from botocore import __version__ as found_botocore_version
|
||||
|
||||
# pylint: enable=unused-import
|
||||
from botocore.exceptions import ClientError
|
||||
from botocore import __version__ as found_botocore_version
|
||||
|
||||
logging.getLogger("boto3").setLevel(logging.CRITICAL)
|
||||
HAS_BOTO = True
|
||||
|
|
|
@ -96,10 +96,10 @@ try:
|
|||
# pylint: disable=unused-import
|
||||
import boto
|
||||
import boto3
|
||||
from botocore import __version__ as found_botocore_version
|
||||
|
||||
# pylint: enable=unused-import
|
||||
from botocore.exceptions import ClientError
|
||||
from botocore import __version__ as found_botocore_version
|
||||
|
||||
logging.getLogger("boto").setLevel(logging.CRITICAL)
|
||||
logging.getLogger("boto3").setLevel(logging.CRITICAL)
|
||||
|
|
|
@ -147,8 +147,8 @@ log = logging.getLogger(__name__)
|
|||
try:
|
||||
# pylint: disable=unused-import
|
||||
import boto
|
||||
import botocore
|
||||
import boto.vpc
|
||||
import botocore
|
||||
|
||||
# pylint: enable=unused-import
|
||||
from boto.exception import BotoServerError
|
||||
|
|
|
@ -34,8 +34,8 @@ log = logging.getLogger(__file__)
|
|||
try:
|
||||
import capirca
|
||||
import capirca.aclgen
|
||||
import capirca.lib.policy
|
||||
import capirca.lib.aclgenerator
|
||||
import capirca.lib.policy
|
||||
|
||||
HAS_CAPIRCA = True
|
||||
except ImportError:
|
||||
|
|
|
@ -96,14 +96,13 @@ __virtualname__ = "cassandra_cql"
|
|||
HAS_DRIVER = False
|
||||
try:
|
||||
# pylint: disable=import-error,no-name-in-module
|
||||
from cassandra.cluster import Cluster
|
||||
from cassandra.cluster import NoHostAvailable
|
||||
from cassandra.auth import PlainTextAuthProvider
|
||||
from cassandra.cluster import Cluster, NoHostAvailable
|
||||
from cassandra.connection import (
|
||||
ConnectionException,
|
||||
ConnectionShutdown,
|
||||
OperationTimedOut,
|
||||
)
|
||||
from cassandra.auth import PlainTextAuthProvider
|
||||
from cassandra.query import dict_factory
|
||||
|
||||
# pylint: enable=import-error,no-name-in-module
|
||||
|
|
|
@ -10,9 +10,10 @@ import os
|
|||
import re
|
||||
import tempfile
|
||||
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
|
||||
import salt.utils.data
|
||||
import salt.utils.platform
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
from salt.exceptions import (
|
||||
CommandExecutionError,
|
||||
CommandNotFoundError,
|
||||
|
|
|
@ -15,6 +15,7 @@ https://docs.datadoghq.com/api/
|
|||
|
||||
|
||||
import requests
|
||||
|
||||
from salt.exceptions import SaltInvocationError
|
||||
|
||||
HAS_DATADOG = True
|
||||
|
|
|
@ -32,8 +32,8 @@ log = logging.getLogger(__name__)
|
|||
|
||||
try:
|
||||
import dns.query
|
||||
import dns.update # pylint: disable=no-name-in-module
|
||||
import dns.tsigkeyring # pylint: disable=no-name-in-module
|
||||
import dns.update # pylint: disable=no-name-in-module
|
||||
|
||||
dns_support = True
|
||||
except ImportError as e:
|
||||
|
|
|
@ -15,6 +15,7 @@ import time
|
|||
|
||||
import jinja2
|
||||
import jinja2.exceptions
|
||||
|
||||
import salt.utils.dns
|
||||
import salt.utils.files
|
||||
import salt.utils.odict
|
||||
|
|
|
@ -33,6 +33,7 @@ REPREPRO_SIGN_PROMPT_RE = re.compile(r"Passphrase: ", re.M)
|
|||
|
||||
try:
|
||||
import gnupg # pylint: disable=unused-import
|
||||
|
||||
import salt.modules.gpg
|
||||
|
||||
HAS_LIBS = True
|
||||
|
|
|
@ -8,7 +8,9 @@ import os
|
|||
HAS_GENTOOLKIT = False
|
||||
|
||||
try:
|
||||
from gentoolkit.eclean import search, clean, cli, exclude as excludemod
|
||||
from gentoolkit.eclean import clean, cli
|
||||
from gentoolkit.eclean import exclude as excludemod
|
||||
from gentoolkit.eclean import search
|
||||
|
||||
HAS_GENTOOLKIT = True
|
||||
except ImportError:
|
||||
|
|
|
@ -39,8 +39,8 @@ HAS_LIBS = False
|
|||
try:
|
||||
# pylint: disable=no-name-in-module
|
||||
import github
|
||||
import github.PaginatedList
|
||||
import github.NamedUser
|
||||
import github.PaginatedList
|
||||
from github.GithubException import UnknownObjectException
|
||||
|
||||
# pylint: enable=no-name-in-module
|
||||
|
|
|
@ -20,13 +20,14 @@ import os
|
|||
import re
|
||||
from functools import wraps
|
||||
|
||||
import yaml
|
||||
|
||||
import salt.utils.args
|
||||
import salt.utils.files
|
||||
import salt.utils.json
|
||||
import salt.utils.path
|
||||
import salt.utils.platform
|
||||
import salt.utils.stringutils
|
||||
import yaml
|
||||
|
||||
try:
|
||||
from lxml import etree
|
||||
|
|
|
@ -7,8 +7,8 @@ import logging
|
|||
import re
|
||||
|
||||
try:
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
from salt.exceptions import CommandExecutionError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
HAS_REQUIRED_LIBS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -6,12 +6,12 @@ import functools
|
|||
import logging
|
||||
|
||||
try:
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
from salt.exceptions import CommandExecutionError
|
||||
import salt.modules.yumpkg
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.systemd
|
||||
import salt.modules.yumpkg
|
||||
from salt.exceptions import CommandExecutionError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
__IMPORT_ERROR = None
|
||||
except ImportError as exc:
|
||||
|
|
|
@ -58,14 +58,14 @@ import salt.utils.http
|
|||
HAS_KEYSTONE = False
|
||||
try:
|
||||
# pylint: disable=import-error
|
||||
from keystoneclient.v2_0 import client
|
||||
import keystoneclient.exceptions
|
||||
from keystoneclient.v2_0 import client
|
||||
|
||||
HAS_KEYSTONE = True
|
||||
from keystoneclient.v3 import client as client3
|
||||
from keystoneclient import discover
|
||||
from keystoneauth1 import session
|
||||
from keystoneauth1.identity import generic
|
||||
from keystoneclient import discover
|
||||
from keystoneclient.v3 import client as client3
|
||||
|
||||
# pylint: enable=import-error
|
||||
except ImportError:
|
||||
|
|
|
@ -72,8 +72,7 @@ try:
|
|||
from kubernetes.client import V1beta1Deployment as AppsV1beta1Deployment
|
||||
from kubernetes.client import V1beta1DeploymentSpec as AppsV1beta1DeploymentSpec
|
||||
except ImportError:
|
||||
from kubernetes.client import AppsV1beta1Deployment
|
||||
from kubernetes.client import AppsV1beta1DeploymentSpec
|
||||
from kubernetes.client import AppsV1beta1Deployment, AppsV1beta1DeploymentSpec
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
HAS_LIBS = True
|
||||
|
|
|
@ -43,8 +43,8 @@ REQUIRED_LIBCLOUD_VERSION = "2.0.0"
|
|||
try:
|
||||
# pylint: disable=unused-import
|
||||
import libcloud
|
||||
from libcloud.compute.providers import get_driver
|
||||
from libcloud.compute.base import Node
|
||||
from libcloud.compute.providers import get_driver
|
||||
|
||||
# pylint: enable=unused-import
|
||||
if hasattr(libcloud, "__version__") and _LooseVersion(
|
||||
|
|
|
@ -42,8 +42,8 @@ REQUIRED_LIBCLOUD_VERSION = "1.5.0"
|
|||
try:
|
||||
# pylint: disable=unused-import
|
||||
import libcloud
|
||||
from libcloud.loadbalancer.base import Algorithm, Member
|
||||
from libcloud.loadbalancer.providers import get_driver
|
||||
from libcloud.loadbalancer.base import Member, Algorithm
|
||||
|
||||
# pylint: enable=unused-import
|
||||
if hasattr(libcloud, "__version__") and _LooseVersion(
|
||||
|
|
|
@ -49,10 +49,10 @@ import salt.utils.stringutils
|
|||
try:
|
||||
# Trying to import MySQLdb
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
from MySQLdb.constants import FIELD_TYPE, FLAG, CLIENT
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb import OperationalError
|
||||
from MySQLdb.constants import CLIENT, FIELD_TYPE, FLAG
|
||||
except ImportError:
|
||||
try:
|
||||
# MySQLdb import failed, try to import PyMySQL
|
||||
|
@ -60,10 +60,10 @@ except ImportError:
|
|||
|
||||
pymysql.install_as_MySQLdb()
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
from MySQLdb.constants import FIELD_TYPE, FLAG, CLIENT
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb import OperationalError
|
||||
from MySQLdb.constants import CLIENT, FIELD_TYPE, FLAG
|
||||
except ImportError:
|
||||
MySQLdb = None
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ try:
|
|||
# pylint: disable=W0611
|
||||
import capirca
|
||||
import capirca.aclgen
|
||||
import capirca.lib.policy
|
||||
import capirca.lib.aclgenerator
|
||||
import capirca.lib.policy
|
||||
|
||||
HAS_CAPIRCA = True
|
||||
# pylint: enable=W0611
|
||||
|
|
|
@ -189,8 +189,7 @@ from salt.exceptions import CommandExecutionError
|
|||
from salt.utils.args import clean_kwargs
|
||||
|
||||
try:
|
||||
from netmiko import ConnectHandler
|
||||
from netmiko import BaseConnection
|
||||
from netmiko import BaseConnection, ConnectHandler
|
||||
|
||||
HAS_NETMIKO = True
|
||||
except ImportError:
|
||||
|
|
|
@ -51,18 +51,18 @@ import logging
|
|||
import salt.utils.platform
|
||||
|
||||
try:
|
||||
from nsnitro.nsnitro import NSNitro
|
||||
from nsnitro.nsexceptions import NSNitroError
|
||||
from nsnitro.nsnitro import NSNitro
|
||||
from nsnitro.nsresources.nslbvserver import NSLBVServer
|
||||
from nsnitro.nsresources.nslbvserverservicegroupbinding import (
|
||||
NSLBVServerServiceGroupBinding,
|
||||
)
|
||||
from nsnitro.nsresources.nsserver import NSServer
|
||||
from nsnitro.nsresources.nsservice import NSService
|
||||
from nsnitro.nsresources.nsservicegroup import NSServiceGroup
|
||||
from nsnitro.nsresources.nsservicegroupserverbinding import (
|
||||
NSServiceGroupServerBinding,
|
||||
)
|
||||
from nsnitro.nsresources.nslbvserver import NSLBVServer
|
||||
from nsnitro.nsresources.nslbvserverservicegroupbinding import (
|
||||
NSLBVServerServiceGroupBinding,
|
||||
)
|
||||
from nsnitro.nsresources.nssslvserversslcertkeybinding import (
|
||||
NSSSLVServerSSLCertKeyBinding,
|
||||
)
|
||||
|
|
|
@ -23,6 +23,7 @@ Module for sending data to OpsGenie
|
|||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
import salt.exceptions
|
||||
import salt.utils.json
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ For PagerDuty API details, see https://developer.pagerduty.com/documentation/res
|
|||
"""
|
||||
|
||||
import requests
|
||||
|
||||
import salt.utils.json
|
||||
|
||||
|
||||
|
|
|
@ -56,8 +56,15 @@ from datetime import datetime
|
|||
from salt.exceptions import CommandExecutionError
|
||||
|
||||
try:
|
||||
from purity_fb import PurityFb, FileSystem, FileSystemSnapshot, SnapshotSuffix
|
||||
from purity_fb import rest, NfsRule, ProtocolRule
|
||||
from purity_fb import (
|
||||
FileSystem,
|
||||
FileSystemSnapshot,
|
||||
NfsRule,
|
||||
ProtocolRule,
|
||||
PurityFb,
|
||||
SnapshotSuffix,
|
||||
rest,
|
||||
)
|
||||
|
||||
HAS_PURITY_FB = True
|
||||
except ImportError:
|
||||
|
|
|
@ -9,8 +9,8 @@ import salt.utils.platform
|
|||
from salt.utils.decorators import depends
|
||||
|
||||
try:
|
||||
from pywintypes import error as PyWinError
|
||||
import win32ts
|
||||
from pywintypes import error as PyWinError
|
||||
|
||||
_HAS_WIN32TS_DEPENDENCIES = True
|
||||
except ImportError:
|
||||
|
|
|
@ -7,6 +7,7 @@ import os
|
|||
|
||||
import jinja2
|
||||
import jinja2.exceptions
|
||||
|
||||
import salt.utils.files
|
||||
import salt.utils.json
|
||||
import salt.utils.stringutils
|
||||
|
|
|
@ -31,8 +31,8 @@ if salt.utils.path.which("initctl"):
|
|||
# Don't re-invent the wheel, import the helper functions from the
|
||||
# upstart module.
|
||||
from salt.modules.upstart_service import (
|
||||
_upstart_enable,
|
||||
_upstart_disable,
|
||||
_upstart_enable,
|
||||
_upstart_is_enabled,
|
||||
)
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
|
|
|
@ -31,6 +31,7 @@ HAS_LIBS = False
|
|||
|
||||
try:
|
||||
import gnupg # pylint: disable=unused-import
|
||||
|
||||
import salt.modules.gpg
|
||||
|
||||
HAS_LIBS = True
|
||||
|
|
|
@ -13,11 +13,12 @@ import datetime
|
|||
import logging
|
||||
import os
|
||||
|
||||
import yaml
|
||||
|
||||
import salt.utils.event
|
||||
import salt.utils.files
|
||||
import salt.utils.odict
|
||||
import salt.utils.yaml
|
||||
import yaml
|
||||
|
||||
try:
|
||||
import dateutil.parser as dateutil_parser
|
||||
|
|
|
@ -12,8 +12,8 @@ import logging
|
|||
# Import salt modules
|
||||
|
||||
try:
|
||||
import scp
|
||||
import paramiko
|
||||
import scp
|
||||
|
||||
HAS_SCP = True
|
||||
except ImportError:
|
||||
|
|
|
@ -51,10 +51,10 @@ log = logging.getLogger(__name__)
|
|||
|
||||
HAS_LIBS = False
|
||||
try:
|
||||
import smtplib
|
||||
import email.mime.text
|
||||
import email.mime.application
|
||||
import email.mime.multipart
|
||||
import email.mime.text
|
||||
import smtplib
|
||||
|
||||
HAS_LIBS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -28,8 +28,8 @@ import subprocess
|
|||
HAS_LIBS = False
|
||||
try:
|
||||
import splunklib.client
|
||||
from splunklib.client import AuthenticationError
|
||||
from splunklib.binding import HTTPError
|
||||
from splunklib.client import AuthenticationError
|
||||
|
||||
HAS_LIBS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -27,8 +27,8 @@ from salt.utils.odict import OrderedDict
|
|||
|
||||
HAS_LIBS = False
|
||||
try:
|
||||
import splunklib.client
|
||||
import requests
|
||||
import splunklib.client
|
||||
|
||||
HAS_LIBS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -10,6 +10,7 @@ import os
|
|||
|
||||
import jinja2
|
||||
import jinja2.exceptions
|
||||
|
||||
import salt.utils.files
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.templates
|
||||
|
|
|
@ -33,8 +33,8 @@ try:
|
|||
from twilio.rest import TwilioException as TwilioRestException
|
||||
else:
|
||||
TWILIO_5 = True
|
||||
from twilio.rest import TwilioRestClient
|
||||
from twilio import TwilioRestException # pylint: disable=no-name-in-module
|
||||
from twilio.rest import TwilioRestClient
|
||||
HAS_LIBS = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
@ -136,6 +136,7 @@ from xml.etree import ElementTree
|
|||
from xml.sax import saxutils
|
||||
|
||||
import jinja2.exceptions
|
||||
|
||||
import salt.utils.data
|
||||
import salt.utils.files
|
||||
import salt.utils.json
|
||||
|
|
|
@ -233,15 +233,9 @@ except ImportError:
|
|||
|
||||
try:
|
||||
# pylint: disable=no-name-in-module
|
||||
from pyVmomi import (
|
||||
vim,
|
||||
vmodl,
|
||||
pbm,
|
||||
VmomiSupport,
|
||||
)
|
||||
from pyVmomi import VmomiSupport, pbm, vim, vmodl
|
||||
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
# We check the supported vim versions to infer the pyVmomi version
|
||||
if (
|
||||
"vim25/6.0" in VmomiSupport.versionMap
|
||||
|
@ -260,10 +254,13 @@ except ImportError:
|
|||
# vSphere SDK Automation
|
||||
# pylint: disable=unused-import
|
||||
try:
|
||||
from com.vmware.cis.tagging_client import Category, CategoryModel
|
||||
from com.vmware.cis.tagging_client import Tag, TagModel, TagAssociation
|
||||
from com.vmware.vcenter_client import Cluster
|
||||
from com.vmware.vapi.std_client import DynamicID
|
||||
from com.vmware.cis.tagging_client import (
|
||||
Category,
|
||||
CategoryModel,
|
||||
Tag,
|
||||
TagAssociation,
|
||||
TagModel,
|
||||
)
|
||||
|
||||
# Error Handling
|
||||
from com.vmware.vapi.std.errors_client import (
|
||||
|
@ -273,6 +270,8 @@ try:
|
|||
Unauthenticated,
|
||||
Unauthorized,
|
||||
)
|
||||
from com.vmware.vapi.std_client import DynamicID
|
||||
from com.vmware.vcenter_client import Cluster
|
||||
|
||||
vsphere_errors = (
|
||||
AlreadyExists,
|
||||
|
|
|
@ -20,8 +20,9 @@ from salt.exceptions import CommandExecutionError
|
|||
|
||||
try:
|
||||
import winreg
|
||||
import win32security
|
||||
|
||||
import ntsecuritycon
|
||||
import win32security
|
||||
|
||||
HAS_WINDOWS_MODULES = True
|
||||
except ImportError:
|
||||
|
|
|
@ -8,6 +8,7 @@ import salt.utils.platform
|
|||
|
||||
try:
|
||||
import wmi
|
||||
|
||||
import salt.utils.winapi
|
||||
|
||||
HAS_LIBS = True
|
||||
|
|
|
@ -99,6 +99,7 @@ try:
|
|||
import win32con
|
||||
import win32file
|
||||
import win32security
|
||||
|
||||
import salt.platform.win
|
||||
|
||||
HAS_WINDOWS_MODULES = True
|
||||
|
|
|
@ -15,9 +15,9 @@ import salt.utils.win_functions
|
|||
import salt.utils.winapi
|
||||
|
||||
try:
|
||||
import pywintypes
|
||||
import win32api
|
||||
import win32com.client
|
||||
import pywintypes
|
||||
|
||||
HAS_DEPENDENCIES = True
|
||||
except ImportError:
|
||||
|
|
|
@ -13,9 +13,10 @@ import logging
|
|||
import os
|
||||
import re
|
||||
|
||||
import yaml
|
||||
|
||||
import salt.utils.json
|
||||
import salt.utils.platform
|
||||
import yaml
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -27,6 +27,7 @@ from salt.exceptions import SaltInvocationError
|
|||
|
||||
try:
|
||||
import wmi
|
||||
|
||||
import salt.utils.winapi
|
||||
|
||||
_HAS_MODULE_DEPENDENCIES = True
|
||||
|
|
|
@ -25,6 +25,7 @@ log = logging.getLogger(__name__)
|
|||
try:
|
||||
if salt.utils.platform.is_windows():
|
||||
import wmi
|
||||
|
||||
import salt.utils.winapi
|
||||
|
||||
HAS_WMI = True
|
||||
|
|
|
@ -24,12 +24,13 @@ import salt.utils.winapi
|
|||
from salt.exceptions import CommandExecutionError
|
||||
|
||||
try:
|
||||
from ctypes import windll
|
||||
|
||||
import pywintypes
|
||||
import win32api
|
||||
import win32con
|
||||
import win32net
|
||||
import wmi
|
||||
from ctypes import windll
|
||||
|
||||
HAS_WIN32NET_MODS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -42,7 +42,6 @@ log = logging.getLogger(__name__)
|
|||
|
||||
try:
|
||||
import pywintypes
|
||||
import wmi
|
||||
import win32api
|
||||
import win32con
|
||||
import win32net
|
||||
|
@ -50,6 +49,7 @@ try:
|
|||
import win32profile
|
||||
import win32security
|
||||
import win32ts
|
||||
import wmi
|
||||
|
||||
HAS_WIN32NET_MODS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -14,16 +14,15 @@ import logging
|
|||
import sys
|
||||
|
||||
try:
|
||||
import kazoo.client
|
||||
|
||||
from kazoo.retry import ForceRetryError
|
||||
import kazoo.recipe.lock
|
||||
import kazoo.recipe.barrier
|
||||
import kazoo.recipe.party
|
||||
from kazoo.exceptions import CancelledError
|
||||
from kazoo.exceptions import NoNodeError
|
||||
from socket import gethostname
|
||||
|
||||
import kazoo.client
|
||||
import kazoo.recipe.barrier
|
||||
import kazoo.recipe.lock
|
||||
import kazoo.recipe.party
|
||||
from kazoo.exceptions import CancelledError, NoNodeError
|
||||
from kazoo.retry import ForceRetryError
|
||||
|
||||
# TODO: use the kazoo one, waiting for pull req:
|
||||
# https://github.com/python-zk/kazoo/pull/206
|
||||
class _Semaphore(kazoo.recipe.lock.Semaphore):
|
||||
|
|
|
@ -597,6 +597,7 @@ from multiprocessing import Pipe, Process
|
|||
from urllib.parse import parse_qsl
|
||||
|
||||
import cherrypy # pylint: disable=import-error,3rd-party-module-not-gated
|
||||
|
||||
import salt
|
||||
import salt.auth
|
||||
import salt.exceptions
|
||||
|
@ -627,8 +628,8 @@ except ImportError:
|
|||
|
||||
try:
|
||||
# Imports related to websocket
|
||||
from .tools import websockets
|
||||
from . import event_processor
|
||||
from .tools import websockets
|
||||
|
||||
HAS_WEBSOCKETS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -55,8 +55,8 @@ def bootstrap_app():
|
|||
"""
|
||||
Grab the opts dict of the master config by trying to import Salt
|
||||
"""
|
||||
from salt.netapi.rest_cherrypy import app
|
||||
import salt.config
|
||||
from salt.netapi.rest_cherrypy import app
|
||||
|
||||
__opts__ = salt.config.client_config(
|
||||
os.environ.get("SALT_MASTER_CONFIG", "/etc/salt/master")
|
||||
|
|
|
@ -1140,8 +1140,8 @@ class Pillar:
|
|||
# the git ext_pillar() func is run, but only for masterless.
|
||||
if self.ext and "git" in self.ext and self.opts.get("__role") != "minion":
|
||||
# Avoid circular import
|
||||
import salt.utils.gitfs
|
||||
import salt.pillar.git_pillar
|
||||
import salt.utils.gitfs
|
||||
|
||||
git_pillar = salt.utils.gitfs.GitPillar(
|
||||
self.opts,
|
||||
|
|
|
@ -61,8 +61,8 @@ from salt.utils.versions import StrictVersion as _StrictVersion
|
|||
|
||||
try:
|
||||
import boto.ec2
|
||||
import boto.utils
|
||||
import boto.exception
|
||||
import boto.utils
|
||||
|
||||
HAS_BOTO = True
|
||||
except ImportError:
|
||||
|
|
|
@ -380,8 +380,8 @@ import os
|
|||
import salt.utils.yaml
|
||||
|
||||
try:
|
||||
from mako.lookup import TemplateLookup
|
||||
from mako import exceptions
|
||||
from mako.lookup import TemplateLookup
|
||||
|
||||
HAS_MAKO = True
|
||||
except ImportError:
|
||||
|
|
|
@ -56,8 +56,8 @@ log = logging.getLogger(__name__)
|
|||
try:
|
||||
# Trying to import MySQLdb
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
except ImportError:
|
||||
try:
|
||||
# MySQLdb import failed, try to import PyMySQL
|
||||
|
@ -65,8 +65,8 @@ except ImportError:
|
|||
|
||||
pymysql.install_as_MySQLdb()
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
except ImportError:
|
||||
MySQLdb = None
|
||||
|
||||
|
|
|
@ -270,6 +270,7 @@ import re
|
|||
import sys
|
||||
|
||||
import jinja2
|
||||
|
||||
import salt.utils.files
|
||||
import salt.utils.yaml
|
||||
|
||||
|
@ -597,9 +598,10 @@ if __name__ == "__main__":
|
|||
__opts__["pepa_validate"] = True
|
||||
|
||||
if args.query_api:
|
||||
import requests
|
||||
import getpass
|
||||
|
||||
import requests
|
||||
|
||||
username = args.username
|
||||
password = args.password
|
||||
if username is None:
|
||||
|
@ -660,8 +662,8 @@ if __name__ == "__main__":
|
|||
try:
|
||||
# pylint: disable=import-error
|
||||
import pygments
|
||||
import pygments.lexers
|
||||
import pygments.formatters
|
||||
import pygments.lexers
|
||||
|
||||
# pylint: disable=no-member
|
||||
print(
|
||||
|
|
|
@ -125,6 +125,7 @@ import logging
|
|||
import os
|
||||
|
||||
import jinja2
|
||||
|
||||
import salt.utils.data
|
||||
from salt.exceptions import SaltInvocationError
|
||||
|
||||
|
|
|
@ -378,10 +378,11 @@ import logging
|
|||
import os
|
||||
import posixpath
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
import salt.utils.data
|
||||
import salt.utils.jinja
|
||||
import salt.utils.yaml
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
strategies = ("overwrite", "merge-first", "merge-last", "remove")
|
||||
|
|
|
@ -149,8 +149,8 @@ import salt.utils.vmware
|
|||
|
||||
try:
|
||||
# pylint: disable=no-name-in-module
|
||||
from pyVmomi import vim
|
||||
from pyVim.connect import Disconnect
|
||||
from pyVmomi import vim
|
||||
|
||||
HAS_LIBS = True
|
||||
# pylint: enable=no-name-in-module
|
||||
|
|
|
@ -190,8 +190,10 @@ import salt.utils.args
|
|||
|
||||
try:
|
||||
from netmiko import ConnectHandler
|
||||
from netmiko.ssh_exception import NetMikoTimeoutException
|
||||
from netmiko.ssh_exception import NetMikoAuthenticationException
|
||||
from netmiko.ssh_exception import (
|
||||
NetMikoAuthenticationException,
|
||||
NetMikoTimeoutException,
|
||||
)
|
||||
|
||||
HAS_NETMIKO = True
|
||||
except ImportError:
|
||||
|
|
|
@ -69,8 +69,8 @@ import salt.utils.stringio
|
|||
from salt.exceptions import SaltConfigurationError
|
||||
|
||||
try:
|
||||
import botocore.exceptions
|
||||
import boto3
|
||||
import botocore.exceptions
|
||||
|
||||
logging.getLogger("boto3").setLevel(logging.CRITICAL)
|
||||
except ImportError:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue