mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Update to isort 5.10.1
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
22a6fec0a3
commit
c8998a9338
866 changed files with 1040 additions and 246 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"]))
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -4,9 +4,7 @@ Genshi Renderer for Salt
|
|||
|
||||
|
||||
try:
|
||||
from genshi.template import MarkupTemplate
|
||||
from genshi.template import NewTextTemplate
|
||||
from genshi.template import OldTextTemplate
|
||||
from genshi.template import MarkupTemplate, NewTextTemplate, OldTextTemplate
|
||||
|
||||
HAS_LIBS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -8,14 +8,15 @@ For YAML usage information see :ref:`Understanding YAML <yaml>`.
|
|||
import logging
|
||||
import warnings
|
||||
|
||||
from yaml.constructor import ConstructorError
|
||||
from yaml.parser import ParserError
|
||||
from yaml.scanner import ScannerError
|
||||
|
||||
import salt.utils.url
|
||||
import salt.utils.yamlloader as yamlloader_new
|
||||
import salt.utils.yamlloader_old as yamlloader_old
|
||||
from salt.exceptions import SaltRenderError
|
||||
from salt.utils.odict import OrderedDict
|
||||
from yaml.constructor import ConstructorError
|
||||
from yaml.parser import ParserError
|
||||
from yaml.scanner import ScannerError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -144,10 +144,9 @@ try:
|
|||
# installed, both the modules/cassandra_cql execution module and this returner module
|
||||
# will not be loaded by Salt's loader system.
|
||||
# pylint: disable=unused-import,no-name-in-module
|
||||
from cassandra.cluster import Cluster
|
||||
from cassandra.cluster import NoHostAvailable
|
||||
from cassandra.connection import ConnectionException, ConnectionShutdown
|
||||
from cassandra.auth import PlainTextAuthProvider
|
||||
from cassandra.cluster import Cluster, NoHostAvailable
|
||||
from cassandra.connection import ConnectionException, ConnectionShutdown
|
||||
from cassandra.query import dict_factory
|
||||
|
||||
# pylint: enable=unused-import,no-name-in-module
|
||||
|
|
|
@ -53,6 +53,7 @@ To override individual configuration items, append --return_kwargs '{"key:": "va
|
|||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
import salt.returners
|
||||
import salt.utils.jid
|
||||
from salt.utils.decorators import memoize
|
||||
|
|
|
@ -154,8 +154,8 @@ import salt.utils.json
|
|||
try:
|
||||
# Trying to import MySQLdb
|
||||
import MySQLdb
|
||||
import MySQLdb.cursors
|
||||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb.connections import OperationalError
|
||||
except ImportError:
|
||||
try:
|
||||
|
@ -164,8 +164,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
|
||||
|
|
|
@ -44,8 +44,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_TWILIO = True
|
||||
except ImportError:
|
||||
|
|
|
@ -23,6 +23,7 @@ import socket
|
|||
import time
|
||||
|
||||
import requests
|
||||
|
||||
import salt.utils.json
|
||||
|
||||
_max_content_bytes = 100000
|
||||
|
|
|
@ -34,9 +34,10 @@ import logging
|
|||
|
||||
HAS_LIBS = False
|
||||
try:
|
||||
import requests
|
||||
import html.parser
|
||||
|
||||
import requests
|
||||
|
||||
HAS_LIBS = True
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
|
|
|
@ -100,11 +100,9 @@ Configuration
|
|||
import salt.output
|
||||
|
||||
try:
|
||||
from netaddr import IPNetwork
|
||||
from netaddr import IPAddress
|
||||
|
||||
# pylint: disable=unused-import,no-name-in-module
|
||||
from napalm.base import helpers as napalm_helpers
|
||||
from netaddr import IPAddress, IPNetwork
|
||||
|
||||
# pylint: enable=unused-import,no-name-in-module
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ import salt.utils.json
|
|||
HAS_LIBS = False
|
||||
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
|
||||
|
||||
HAS_LIBS = True
|
||||
except ImportError:
|
||||
|
|
|
@ -72,11 +72,10 @@ import salt.output
|
|||
import salt.utils.network
|
||||
|
||||
try:
|
||||
from netaddr import IPNetwork # netaddr is already required by napalm
|
||||
from netaddr.core import AddrFormatError
|
||||
|
||||
# pylint: disable=no-name-in-module
|
||||
from napalm.base import helpers as napalm_helpers
|
||||
from netaddr import IPNetwork # netaddr is already required by napalm
|
||||
from netaddr.core import AddrFormatError
|
||||
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import string
|
|||
import time
|
||||
|
||||
import requests
|
||||
|
||||
import salt.crypt
|
||||
import salt.exceptions
|
||||
|
||||
|
|
|
@ -13,11 +13,12 @@ import datetime
|
|||
import logging
|
||||
|
||||
import yaml
|
||||
from salt.serializers import DeserializationError, SerializationError
|
||||
from salt.utils.odict import OrderedDict
|
||||
from yaml.constructor import ConstructorError
|
||||
from yaml.scanner import ScannerError
|
||||
|
||||
from salt.serializers import DeserializationError, SerializationError
|
||||
from salt.utils.odict import OrderedDict
|
||||
|
||||
__all__ = ["deserialize", "serialize", "available"]
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -107,13 +107,14 @@ import datetime
|
|||
import logging
|
||||
|
||||
import yaml
|
||||
from salt.serializers import DeserializationError, SerializationError
|
||||
from salt.utils.aggregation import Map, Sequence, aggregate
|
||||
from salt.utils.odict import OrderedDict
|
||||
from yaml.constructor import ConstructorError
|
||||
from yaml.nodes import MappingNode
|
||||
from yaml.scanner import ScannerError
|
||||
|
||||
from salt.serializers import DeserializationError, SerializationError
|
||||
from salt.utils.aggregation import Map, Sequence, aggregate
|
||||
from salt.utils.odict import OrderedDict
|
||||
|
||||
__all__ = ["deserialize", "serialize", "available"]
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -42,8 +42,9 @@ Manage Grafana v4.0 orgs
|
|||
- country: ""
|
||||
"""
|
||||
|
||||
import salt.utils.dictupdate as dictupdate
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
import salt.utils.dictupdate as dictupdate
|
||||
from salt.utils.dictdiffer import deep_diff
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ allowing users to manage their own custom rows.
|
|||
import copy
|
||||
|
||||
import requests
|
||||
|
||||
import salt.utils.json
|
||||
from salt.utils.dictdiffer import DictDiffer
|
||||
|
||||
|
|
|
@ -16,9 +16,10 @@ import difflib
|
|||
import json
|
||||
import logging
|
||||
|
||||
import salt.utils.odict
|
||||
import yaml
|
||||
|
||||
import salt.utils.odict
|
||||
|
||||
log = logging.getLogger(__file__)
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import _pytest.logging
|
|||
import _pytest.skipping
|
||||
import psutil
|
||||
import pytest
|
||||
|
||||
import salt._logging
|
||||
import salt._logging.mixins
|
||||
import salt.config
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import SSHCase
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
import salt.utils.platform
|
||||
from tests.support.case import ModuleCase
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.utils.files
|
||||
import salt.utils.platform
|
||||
from tests.support.case import ModuleCase
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from tests.support.case import SyndicCase
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
|
||||
import os
|
||||
|
||||
import yaml
|
||||
|
||||
import salt.utils.cloud
|
||||
import salt.utils.files
|
||||
import salt.utils.yaml
|
||||
import yaml
|
||||
from tests.integration.cloud.helpers.cloud_test_base import CloudTest
|
||||
from tests.support import win_installer
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
|
|
@ -5,6 +5,7 @@ Tests for the Openstack Cloud Provider
|
|||
import logging
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.mixins import SaltReturnAssertsMixin
|
||||
|
@ -14,8 +15,10 @@ log = logging.getLogger(__name__)
|
|||
|
||||
try:
|
||||
import keystoneclient # pylint: disable=import-error,unused-import
|
||||
from libcloud.common.openstack_identity import OpenStackIdentity_3_0_Connection
|
||||
from libcloud.common.openstack_identity import OpenStackIdentityTokenScope
|
||||
from libcloud.common.openstack_identity import (
|
||||
OpenStackIdentity_3_0_Connection,
|
||||
OpenStackIdentityTokenScope,
|
||||
)
|
||||
|
||||
HAS_KEYSTONE = True
|
||||
except ImportError:
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
from salt.config import cloud_providers_config
|
||||
from saltfactories.utils import random_string
|
||||
|
||||
from salt.config import cloud_providers_config
|
||||
from tests.support.case import ShellCase
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
|
|
|
@ -9,10 +9,11 @@ import shutil
|
|||
from time import sleep
|
||||
|
||||
import pytest
|
||||
from saltfactories.utils import random_string
|
||||
|
||||
import salt.utils.files
|
||||
from salt.config import cloud_config, cloud_providers_config
|
||||
from salt.utils.yaml import safe_load
|
||||
from saltfactories.utils import random_string
|
||||
from tests.support.case import ShellCase
|
||||
from tests.support.paths import FILES
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Integration tests for functions located in the salt.cloud.__init__.py file.
|
||||
"""
|
||||
import pytest
|
||||
|
||||
import salt.cloud
|
||||
from tests.integration.cloud.helpers.cloud_test_base import CloudTest
|
||||
from tests.support.helpers import PRE_PYTEST_SKIP
|
||||
|
|
|
@ -8,6 +8,7 @@ import logging
|
|||
import pathlib
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -12,6 +12,7 @@ from cryptography import x509
|
|||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.x509.oid import NameOID
|
||||
|
||||
from tests.support.case import ShellCase
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ Test the core grains
|
|||
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.loader
|
||||
import salt.utils.platform
|
||||
from tests.support.case import ModuleCase
|
||||
|
|
|
@ -4,6 +4,7 @@ Test the core grains
|
|||
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import ModuleCase
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import os
|
|||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.config
|
||||
import salt.loader
|
||||
from tests.support.case import ModuleCase
|
||||
|
|
|
@ -13,6 +13,7 @@ import os
|
|||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import time
|
|||
|
||||
from pytestshellutils.utils import ports
|
||||
from pytestshellutils.utils.processes import terminate_process
|
||||
|
||||
from salt.utils.nb_popen import NonBlockingPopen
|
||||
from tests.support.cli_scripts import ScriptPathMixin
|
||||
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import ModuleCase, ShellCase
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -7,6 +7,7 @@ import os
|
|||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.utils.platform
|
||||
from tests.support.case import ShellCase
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
import salt.utils.path
|
||||
import salt.utils.platform
|
||||
from tests.support.case import ModuleCase
|
||||
|
|
|
@ -5,6 +5,7 @@ import tempfile
|
|||
from contextlib import contextmanager
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.utils.path
|
||||
import salt.utils.platform
|
||||
import salt.utils.user
|
||||
|
|
|
@ -3,6 +3,7 @@ Validate the config system
|
|||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import ModuleCase
|
||||
|
||||
|
||||
|
|
|
@ -10,12 +10,13 @@ import uuid
|
|||
|
||||
import psutil # pylint: disable=3rd-party-module-not-gated
|
||||
import pytest
|
||||
from pytestshellutils.utils import ports
|
||||
from saltfactories.utils.tempfiles import temp_file
|
||||
|
||||
import salt.utils.files
|
||||
import salt.utils.path
|
||||
import salt.utils.platform
|
||||
import salt.utils.stringutils
|
||||
from pytestshellutils.utils import ports
|
||||
from saltfactories.utils.tempfiles import temp_file
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import with_tempfile
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from tests.support.case import ModuleCase
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import os
|
|||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.utils.platform
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.unit import skipIf
|
||||
|
|
|
@ -4,6 +4,7 @@ import shutil
|
|||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.utils.files
|
||||
import salt.utils.platform
|
||||
from tests.support.case import ModuleCase
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue