mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix PyLint broad-except
This commit is contained in:
parent
9577efc59a
commit
35646c5ed9
349 changed files with 1016 additions and 1018 deletions
|
@ -20,19 +20,19 @@ log = logging.getLogger(__name__)
|
|||
try:
|
||||
# Python >2.5
|
||||
import xml.etree.cElementTree as ElementTree
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
# Python >2.5
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
# normal cElementTree install
|
||||
import elementtree.cElementTree as ElementTree
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
# normal ElementTree install
|
||||
import elementtree.ElementTree as ElementTree
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
ElementTree = None
|
||||
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class LoadAuth(object):
|
|||
return self.auth[fstr](*fcall['args'], **fcall['kwargs'])
|
||||
else:
|
||||
return self.auth[fstr](*fcall['args'])
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.debug('Authentication module threw %s', e)
|
||||
return False
|
||||
|
||||
|
@ -152,7 +152,7 @@ class LoadAuth(object):
|
|||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
try:
|
||||
return self.auth[fstr](*fcall['args'], **fcall['kwargs'])
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.debug('Authentication module threw %s', e)
|
||||
return None
|
||||
|
||||
|
@ -168,7 +168,7 @@ class LoadAuth(object):
|
|||
return auth_list
|
||||
try:
|
||||
return self.auth[fstr](auth_list, self.opts)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.debug('Authentication module threw %s', e)
|
||||
return auth_list
|
||||
|
||||
|
@ -190,7 +190,7 @@ class LoadAuth(object):
|
|||
return self.auth[fstr](*fcall['args'], **fcall['kwargs'])
|
||||
except IndexError:
|
||||
return False
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return None
|
||||
|
||||
def _allow_custom_expire(self, load):
|
||||
|
|
|
@ -61,7 +61,7 @@ try:
|
|||
import django
|
||||
from django.db import connection # pylint: disable=no-name-in-module
|
||||
HAS_DJANGO = True
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
# If Django is installed and is not detected, uncomment
|
||||
# the following line to display additional information
|
||||
#log.warning('Could not load Django auth module. Found exception: %s', exc)
|
||||
|
@ -84,7 +84,7 @@ def __virtual__():
|
|||
def is_connection_usable():
|
||||
try:
|
||||
connection.connection.ping()
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
|
|
@ -131,7 +131,7 @@ class _LDAPConnection(object):
|
|||
if self.starttls:
|
||||
self.ldap.start_tls_s()
|
||||
self.ldap.simple_bind_s(self.binddn, self.bindpw)
|
||||
except Exception as ldap_error:
|
||||
except Exception as ldap_error: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
'Failed to bind to LDAP server {0} as {1}: {2}'.format(
|
||||
self.uri, self.binddn, ldap_error
|
||||
|
@ -283,7 +283,7 @@ def _bind(username, password, anonymous=False, opts=None):
|
|||
log.debug('Attempting LDAP bind with user dn: %s', connargs['binddn'])
|
||||
try:
|
||||
ldap_conn = _LDAPConnection(**connargs).ldap
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
connargs.pop('bindpw', None) # Don't log the password
|
||||
log.error('Failed to authenticate user dn via LDAP: %s', connargs)
|
||||
log.debug('Error authenticating user dn via LDAP:', exc_info=True)
|
||||
|
@ -360,7 +360,7 @@ def groups(username, **kwargs):
|
|||
user_dn_results = bind.search_s(_config('basedn'),
|
||||
ldap.SCOPE_SUBTREE,
|
||||
get_user_dn_search, [str('distinguishedName')]) # future lint: disable=blacklisted-function
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error('Exception thrown while looking up user DN in AD: %s', e)
|
||||
return group_list
|
||||
if not user_dn_results:
|
||||
|
@ -375,7 +375,7 @@ def groups(username, **kwargs):
|
|||
ldap.SCOPE_SUBTREE,
|
||||
ldap_search_string,
|
||||
[salt.utils.stringutils.to_str(_config('accountattributename')), str('cn')]) # future lint: disable=blacklisted-function
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error('Exception thrown while retrieving group membership in AD: %s', e)
|
||||
return group_list
|
||||
for _, entry in search_results:
|
||||
|
|
|
@ -252,7 +252,7 @@ def beacon(config):
|
|||
try:
|
||||
if re.search(_exclude, event.pathname):
|
||||
_append = False
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.warning('Failed to compile regex: %s',
|
||||
_exclude)
|
||||
else:
|
||||
|
|
|
@ -120,7 +120,7 @@ def beacon(config):
|
|||
continue
|
||||
try:
|
||||
d[tag] = re.compile(r'{0}'.format(_config['tags'][tag]['regex']))
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
event = SKEL.copy()
|
||||
event['tag'] = tag
|
||||
event['error'] = 'bad regex'
|
||||
|
@ -136,7 +136,7 @@ def beacon(config):
|
|||
event['raw'] = line
|
||||
event['match'] = 'yes'
|
||||
ret.append(event)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
event = SKEL.copy()
|
||||
event['tag'] = tag
|
||||
event['error'] = 'bad match'
|
||||
|
|
|
@ -327,7 +327,7 @@ def beacon(config):
|
|||
log.debug(fun_cfg)
|
||||
try:
|
||||
fun_cmp_result = _compare(fun_cfg, fun_ret_out)
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(err, exc_info=True)
|
||||
# catch any exception and continue
|
||||
# to not jeopardise the execution of the next function in the list
|
||||
|
|
10
salt/cache/consul.py
vendored
10
salt/cache/consul.py
vendored
|
@ -100,7 +100,7 @@ def store(bank, key, data):
|
|||
try:
|
||||
c_data = __context__['serial'].dumps(data)
|
||||
api.kv.put(c_key, c_data)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error writing the key, {0}: {1}'.format(
|
||||
c_key, exc
|
||||
|
@ -118,7 +118,7 @@ def fetch(bank, key):
|
|||
if value is None:
|
||||
return {}
|
||||
return __context__['serial'].loads(value['Value'])
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error reading the key, {0}: {1}'.format(
|
||||
c_key, exc
|
||||
|
@ -136,7 +136,7 @@ def flush(bank, key=None):
|
|||
c_key = '{0}/{1}'.format(bank, key)
|
||||
try:
|
||||
return api.kv.delete(c_key, recurse=key is None)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error removing the key, {0}: {1}'.format(
|
||||
c_key, exc
|
||||
|
@ -150,7 +150,7 @@ def list_(bank):
|
|||
'''
|
||||
try:
|
||||
_, keys = api.kv.get(bank + '/', keys=True, separator='/')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error getting the key "{0}": {1}'.format(
|
||||
bank, exc
|
||||
|
@ -178,7 +178,7 @@ def contains(bank, key):
|
|||
try:
|
||||
c_key = '{0}/{1}'.format(bank, key)
|
||||
_, value = api.kv.get(c_key)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error getting the key, {0}: {1}'.format(
|
||||
c_key, exc
|
||||
|
|
10
salt/cache/etcd_cache.py
vendored
10
salt/cache/etcd_cache.py
vendored
|
@ -128,7 +128,7 @@ def store(bank, key, data):
|
|||
try:
|
||||
value = __context__['serial'].dumps(data)
|
||||
client.write(etcd_key, base64.b64encode(value))
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error writing the key, {0}: {1}'.format(etcd_key, exc)
|
||||
)
|
||||
|
@ -145,7 +145,7 @@ def fetch(bank, key):
|
|||
return __context__['serial'].loads(base64.b64decode(value))
|
||||
except etcd.EtcdKeyNotFound:
|
||||
return {}
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error reading the key, {0}: {1}'.format(
|
||||
etcd_key, exc
|
||||
|
@ -168,7 +168,7 @@ def flush(bank, key=None):
|
|||
return # nothing to flush
|
||||
try:
|
||||
client.delete(etcd_key, recursive=True)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error removing the key, {0}: {1}'.format(
|
||||
etcd_key, exc
|
||||
|
@ -199,7 +199,7 @@ def ls(bank):
|
|||
path = '{0}/{1}'.format(path_prefix, bank)
|
||||
try:
|
||||
return _walk(client.read(path))
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error getting the key "{0}": {1}'.format(
|
||||
bank, exc
|
||||
|
@ -219,7 +219,7 @@ def contains(bank, key):
|
|||
return r.dir is False
|
||||
except etcd.EtcdKeyNotFound:
|
||||
return False
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error getting the key, {0}: {1}'.format(
|
||||
etcd_key, exc
|
||||
|
|
2
salt/cache/mysql_cache.py
vendored
2
salt/cache/mysql_cache.py
vendored
|
@ -112,7 +112,7 @@ def run_query(conn, query, retries=3):
|
|||
global client
|
||||
client = MySQLdb.connect(**_mysql_kwargs)
|
||||
return run_query(client, query, retries - 1)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
if len(query) > 150:
|
||||
query = query[:150] + "<...>"
|
||||
raise SaltCacheError("Error running {0}: {1}".format(query, e))
|
||||
|
|
|
@ -239,7 +239,7 @@ class BaseCaller(object):
|
|||
try:
|
||||
func_result = all(ret['return'].get(x, True)
|
||||
for x in ('result', 'success'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# return data is not a dict
|
||||
func_result = True
|
||||
if not func_result:
|
||||
|
@ -283,7 +283,7 @@ class BaseCaller(object):
|
|||
try:
|
||||
ret['success'] = True
|
||||
self.minion.returners['{0}.returner'.format(returner)](ret)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
# return the job infos back up to the respective minion's master
|
||||
|
@ -292,7 +292,7 @@ class BaseCaller(object):
|
|||
mret = ret.copy()
|
||||
mret['jid'] = 'req'
|
||||
self.return_pub(mret)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
elif self.opts['cache_jobs']:
|
||||
# Local job cache has been enabled
|
||||
|
|
|
@ -356,7 +356,7 @@ class SaltCMD(salt.utils.parsers.SaltCMDOptionParser):
|
|||
if not hasattr(self, 'progress_bar'):
|
||||
try:
|
||||
self.progress_bar = salt.output.get_progress(self.config, out, progress)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise LoaderError('\nWARNING: Install the `progressbar` python package. '
|
||||
'Requested job was still run but output cannot be displayed.\n')
|
||||
salt.output.update_progress(self.config, progress, self.progress_bar, out)
|
||||
|
|
|
@ -342,7 +342,7 @@ class LocalClient(object):
|
|||
six.reraise(*sys.exc_info())
|
||||
except AuthorizationError as err:
|
||||
six.reraise(*sys.exc_info())
|
||||
except Exception as general_exception:
|
||||
except Exception as general_exception: # pylint: disable=broad-except
|
||||
# Convert to generic client error and pass along message
|
||||
raise SaltClientError(general_exception)
|
||||
|
||||
|
@ -403,7 +403,7 @@ class LocalClient(object):
|
|||
raise AuthenticationError(err)
|
||||
except AuthorizationError as err:
|
||||
raise AuthorizationError(err)
|
||||
except Exception as general_exception:
|
||||
except Exception as general_exception: # pylint: disable=broad-except
|
||||
# Convert to generic client error and pass along message
|
||||
raise SaltClientError(general_exception)
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ class LocalClient(object):
|
|||
yield {}
|
||||
# stop the iteration, since the jid is invalid
|
||||
raise StopIteration()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.warning('Returner unavailable: %s', exc, exc_info_on_loglevel=logging.DEBUG)
|
||||
# Wait for the hosts to check in
|
||||
last_time = False
|
||||
|
@ -1290,7 +1290,7 @@ class LocalClient(object):
|
|||
if self.returners['{0}.get_load'.format(self.opts['master_job_cache'])](jid) == {}:
|
||||
log.warning('jid does not exist')
|
||||
return ret
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltClientError('Master job cache returner [{0}] failed to verify jid. '
|
||||
'Exception details: {1}'.format(self.opts['master_job_cache'], exc))
|
||||
|
||||
|
@ -1335,7 +1335,7 @@ class LocalClient(object):
|
|||
|
||||
try:
|
||||
data = self.returners['{0}.get_jid'.format(self.opts['master_job_cache'])](jid)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltClientError('Returner {0} could not fetch jid data. '
|
||||
'Exception details: {1}'.format(
|
||||
self.opts['master_job_cache'],
|
||||
|
@ -1384,7 +1384,7 @@ class LocalClient(object):
|
|||
|
||||
try:
|
||||
data = self.returners['{0}.get_jid'.format(self.opts['master_job_cache'])](jid)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltClientError('Could not examine master job cache. '
|
||||
'Error occurred in {0} returner. '
|
||||
'Exception details: {1}'.format(self.opts['master_job_cache'],
|
||||
|
@ -1438,7 +1438,7 @@ class LocalClient(object):
|
|||
if self.returners['{0}.get_load'.format(self.opts['master_job_cache'])](jid) == {}:
|
||||
log.warning('jid does not exist')
|
||||
return ret
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltClientError('Load could not be retrieved from '
|
||||
'returner {0}. Exception details: {1}'.format(
|
||||
self.opts['master_job_cache'],
|
||||
|
|
|
@ -273,7 +273,7 @@ class APIClient(object):
|
|||
'''
|
||||
try:
|
||||
tokenage = self.resolver.mk_token(creds)
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
raise EauthAuthenticationError(
|
||||
"Authentication failed with {0}.".format(repr(ex)))
|
||||
|
||||
|
@ -299,7 +299,7 @@ class APIClient(object):
|
|||
'''
|
||||
try:
|
||||
result = self.resolver.get_token(token)
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
raise EauthAuthenticationError(
|
||||
"Token validation failed with {0}.".format(repr(ex)))
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ class SyncClientMixin(object):
|
|||
if isinstance(data['return'], dict) and 'data' in data['return']:
|
||||
# some functions can return boolean values
|
||||
data['success'] = salt.utils.state.check_result(data['return']['data'])
|
||||
except (Exception, SystemExit) as ex:
|
||||
except (Exception, SystemExit) as ex: # pylint: disable=broad-except
|
||||
if isinstance(ex, salt.exceptions.NotImplemented):
|
||||
data['return'] = six.text_type(ex)
|
||||
else:
|
||||
|
|
|
@ -497,7 +497,7 @@ class SSH(object):
|
|||
try:
|
||||
data = salt.utils.json.find_json(stdout)
|
||||
return {host: data.get('local', data)}
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
if stderr:
|
||||
return {host: stderr}
|
||||
return {host: 'Bad Return'}
|
||||
|
@ -532,7 +532,7 @@ class SSH(object):
|
|||
'stderr': stderr,
|
||||
'retcode': retcode,
|
||||
}
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
ret['ret'] = {
|
||||
'stdout': stdout,
|
||||
'stderr': stderr,
|
||||
|
@ -598,7 +598,7 @@ class SSH(object):
|
|||
if 'id' in ret:
|
||||
returned.add(ret['id'])
|
||||
yield {ret['id']: ret['ret']}
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# This bare exception is here to catch spurious exceptions
|
||||
# thrown by que.get during healthy operation. Please do not
|
||||
# worry about this bare exception, it is entirely here to
|
||||
|
@ -615,7 +615,7 @@ class SSH(object):
|
|||
if 'id' in ret:
|
||||
returned.add(ret['id'])
|
||||
yield {ret['id']: ret['ret']}
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
if host not in returned:
|
||||
|
@ -746,7 +746,7 @@ class SSH(object):
|
|||
self.returners['{0}.save_load'.format(self.opts['master_job_cache'])](jid, job_load, minions=self.targets.keys())
|
||||
else:
|
||||
self.returners['{0}.save_load'.format(self.opts['master_job_cache'])](jid, job_load)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception(exc)
|
||||
log.error(
|
||||
'Could not save load with returner %s: %s',
|
||||
|
@ -1161,7 +1161,7 @@ class Single(object):
|
|||
result = 'TypeError encountered executing {0}: {1}'.format(self.fun, exc)
|
||||
log.error(result, exc_info_on_loglevel=logging.DEBUG)
|
||||
retcode = 1
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
result = 'An Exception occurred while executing {0}: {1}'.format(self.fun, exc)
|
||||
log.error(result, exc_info_on_loglevel=logging.DEBUG)
|
||||
retcode = 1
|
||||
|
|
|
@ -280,7 +280,7 @@ class Shell(object):
|
|||
|
||||
data = proc.communicate()
|
||||
return data[0], data[1], proc.returncode
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return ('local', 'Unknown Error', None)
|
||||
|
||||
def _run_nb_cmd(self, cmd):
|
||||
|
@ -304,7 +304,7 @@ class Shell(object):
|
|||
if err:
|
||||
err = self.get_error(err)
|
||||
yield out, err, rcode
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
yield ('', 'Unknown Error', None)
|
||||
|
||||
def exec_nb_cmd(self, cmd):
|
||||
|
|
|
@ -110,7 +110,7 @@ class SSHHighState(salt.state.BaseHighState):
|
|||
continue
|
||||
try:
|
||||
ret.update(self.tops[fun](opts=self.opts, grains=grains))
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
# If anything happens in the top generation, log it and move on
|
||||
log.error(
|
||||
'Top function %s failed with error %s for minion %s',
|
||||
|
|
|
@ -98,7 +98,7 @@ def valid_fileproto(uri):
|
|||
'''
|
||||
try:
|
||||
return bool(re.match('^(?:salt|https?|ftp)://', uri))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ def _ssh_state(chunks, st_kwargs,
|
|||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return salt.utils.data.decode(salt.utils.json.loads(stdout, object_hook=salt.utils.data.encode_dict))
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(str(e))
|
||||
|
||||
|
@ -259,7 +259,7 @@ def sls(mods, saltenv='base', test=None, exclude=None, **kwargs):
|
|||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return salt.utils.json.loads(stdout)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(six.text_type(e))
|
||||
|
||||
|
@ -402,7 +402,7 @@ def low(data, **kwargs):
|
|||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return salt.utils.json.loads(stdout)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(six.text_type(e))
|
||||
|
||||
|
@ -492,7 +492,7 @@ def high(data, **kwargs):
|
|||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return salt.utils.json.loads(stdout)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(six.text_type(e))
|
||||
|
||||
|
@ -738,7 +738,7 @@ def highstate(test=None, **kwargs):
|
|||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return salt.utils.json.loads(stdout)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(six.text_type(e))
|
||||
|
||||
|
@ -820,7 +820,7 @@ def top(topfn, test=None, **kwargs):
|
|||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return salt.utils.json.loads(stdout)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(six.text_type(e))
|
||||
|
||||
|
@ -1190,7 +1190,7 @@ def single(fun, name, test=None, **kwargs):
|
|||
# Read in the JSON data and return the data structure
|
||||
try:
|
||||
return salt.utils.json.loads(stdout)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("JSON Render failed for: %s\n%s", stdout, stderr)
|
||||
log.error(six.text_type(e))
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ def communicator(func):
|
|||
queue.put('KEYBOARDINT')
|
||||
queue.put('Keyboard interrupt')
|
||||
queue.put('{0}\n{1}\n'.format(ex, trace))
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
trace = traceback.format_exc()
|
||||
queue.put('ERROR')
|
||||
queue.put('Exception')
|
||||
|
@ -636,7 +636,7 @@ class Cloud(object):
|
|||
__active_provider_name__=':'.join([alias, driver])
|
||||
):
|
||||
pmap[alias][driver] = self.clouds[fun]()
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.debug(
|
||||
'Failed to execute \'%s()\' while querying for '
|
||||
'running nodes: %s', fun, err,
|
||||
|
@ -818,7 +818,7 @@ class Cloud(object):
|
|||
__active_provider_name__=':'.join([alias, driver])
|
||||
):
|
||||
data[alias][driver] = self.clouds[fun]()
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to get the output of \'%s()\': %s',
|
||||
fun, err, exc_info_on_loglevel=logging.DEBUG
|
||||
|
@ -856,7 +856,7 @@ class Cloud(object):
|
|||
__active_provider_name__=':'.join([alias, driver])
|
||||
):
|
||||
data[alias][driver] = self.clouds[fun]()
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to get the output of \'%s()\': %s',
|
||||
fun, err, exc_info_on_loglevel=logging.DEBUG
|
||||
|
@ -894,7 +894,7 @@ class Cloud(object):
|
|||
__active_provider_name__=':'.join([alias, driver])
|
||||
):
|
||||
data[alias][driver] = self.clouds[fun]()
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to get the output of \'%s()\': %s',
|
||||
fun, err, exc_info_on_loglevel=logging.DEBUG
|
||||
|
@ -1097,7 +1097,7 @@ class Cloud(object):
|
|||
filename = os.path.basename(
|
||||
globbed_key_file.pop(selection)
|
||||
)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
continue
|
||||
|
||||
delete = input(
|
||||
|
@ -1777,7 +1777,7 @@ class Map(Cloud):
|
|||
map_ = compile_template(
|
||||
cached_map, rend, renderer, blacklist, whitelist
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Rendering map %s failed, render error:\n%s',
|
||||
self.opts['map'], exc,
|
||||
|
@ -2364,7 +2364,7 @@ def run_parallel_map_providers_query(data, queue=None):
|
|||
cloud.clouds[data['fun']]()
|
||||
)
|
||||
)
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.debug(
|
||||
'Failed to execute \'%s()\' while querying for running nodes: %s',
|
||||
data['fun'], err, exc_info_on_loglevel=logging.DEBUG
|
||||
|
|
|
@ -115,7 +115,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
if self.selected_query_option == 'list_providers':
|
||||
try:
|
||||
ret = mapper.provider_list()
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error listing providers: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -123,7 +123,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
provider = self.options.list_profiles
|
||||
try:
|
||||
ret = mapper.profile_list(provider)
|
||||
except(SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error listing profiles: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -133,7 +133,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
ret = mapper.interpolated_map(
|
||||
query=self.selected_query_option
|
||||
)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error with a custom map: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
else:
|
||||
|
@ -141,7 +141,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
ret = mapper.map_providers_parallel(
|
||||
query=self.selected_query_option
|
||||
)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error with a map: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -150,7 +150,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
ret = mapper.location_list(
|
||||
self.options.list_locations
|
||||
)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error listing locations: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -159,7 +159,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
ret = mapper.image_list(
|
||||
self.options.list_images
|
||||
)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error listing images: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -168,7 +168,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
ret = mapper.size_list(
|
||||
self.options.list_sizes
|
||||
)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error listing sizes: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -208,7 +208,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
try:
|
||||
if self.print_confirm(msg):
|
||||
ret = mapper.destroy(names, cached=True)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error destroying machines: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -245,7 +245,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
try:
|
||||
if self.print_confirm(msg):
|
||||
ret = mapper.do_action(names, kwargs)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error actioning machines: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -268,7 +268,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
ret = mapper.do_function(
|
||||
self.function_provider, self.function_name, kwargs
|
||||
)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error running the function: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -278,7 +278,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
self.options.profile,
|
||||
self.config.get('names')
|
||||
)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was a profile error: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -351,7 +351,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
msg = 'Already running.'
|
||||
ret[name] = {'Message': msg}
|
||||
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was a query error: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
@ -382,7 +382,7 @@ class SaltCloud(salt.utils.parsers.SaltCloudParser):
|
|||
|
||||
try:
|
||||
ret = salt.utils.cloud.bootstrap(vm_, self.config)
|
||||
except (SaltCloudException, Exception) as exc:
|
||||
except (SaltCloudException, Exception) as exc: # pylint: disable=broad-except
|
||||
msg = 'There was an error bootstrapping the minion: {0}'
|
||||
self.handle_exception(msg, exc)
|
||||
|
||||
|
|
|
@ -667,7 +667,7 @@ def create(vm_):
|
|||
|
||||
try:
|
||||
ret = create_node(kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on Aliyun ECS\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -560,7 +560,7 @@ def list_nodes_full(call=None):
|
|||
node['network_profile']['network_interfaces'][index].update(netiface)
|
||||
node['public_ips'].extend(pubips)
|
||||
node['private_ips'].extend(privips)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
node_ret[node['name']] = node
|
||||
|
@ -885,7 +885,7 @@ def create_network_interface(call=None, kwargs=None):
|
|||
)
|
||||
try:
|
||||
poller.wait()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.warning('Network interface creation could not be polled. '
|
||||
'It is likely that we are reusing an existing interface. (%s)', exc)
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ def request_instance(vm_):
|
|||
try:
|
||||
with salt.utils.files.fopen(ssh_publickeyfile, 'r') as spkc_:
|
||||
ssh_publickeyfile_contents = spkc_.read()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCloudConfigError(
|
||||
"Failed to read ssh publickey file '{0}': "
|
||||
"{1}".format(ssh_publickeyfile,
|
||||
|
@ -1305,7 +1305,7 @@ def request_instance(vm_):
|
|||
'settings': settings,
|
||||
'protected_settings': None
|
||||
}
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception('Failed to encode userdata: %s', exc)
|
||||
|
||||
params = VirtualMachine(
|
||||
|
@ -1751,7 +1751,7 @@ def list_blobs(call=None, kwargs=None): # pylint: disable=unused-argument
|
|||
'last_modified': blob.properties.last_modified.isoformat(),
|
||||
'server_encrypted': blob.properties.server_encrypted,
|
||||
}
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.warning(six.text_type(exc))
|
||||
|
||||
return ret
|
||||
|
@ -1789,7 +1789,7 @@ def delete_managed_disk(call=None, kwargs=None): # pylint: disable=unused-argum
|
|||
|
||||
try:
|
||||
compconn.disks.delete(kwargs['resource_group'], kwargs['blob'])
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('Error deleting managed disk %s - %s', kwargs.get('blob'), six.text_type(exc))
|
||||
return False
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ except ImportError:
|
|||
try:
|
||||
from requests.packages.urllib3 import disable_warnings # pylint: disable=no-name-in-module
|
||||
disable_warnings()
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ def get_ip(data):
|
|||
'''
|
||||
try:
|
||||
ip = data.public_ips[0]
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
ip = data.private_ips[0]
|
||||
return ip
|
||||
|
||||
|
@ -360,7 +360,7 @@ def create(vm_):
|
|||
ex_blockdevicemapping['VolumeSize'],
|
||||
ex_blockdevicemapping['VirtualName']
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating volume %s on CLOUDSTACK\n\n'
|
||||
'The following exception was thrown by libcloud when trying to '
|
||||
|
@ -374,7 +374,7 @@ def create(vm_):
|
|||
ex_blockdevicemapping = {}
|
||||
try:
|
||||
data = conn.create_node(**kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on CLOUDSTACK\n\n'
|
||||
'The following exception was thrown by libcloud when trying to '
|
||||
|
@ -388,7 +388,7 @@ def create(vm_):
|
|||
for device_name in six.iterkeys(volumes):
|
||||
try:
|
||||
conn.attach_volume(data, volumes[device_name], device_name)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error attaching volume %s on CLOUDSTACK\n\n'
|
||||
'The following exception was thrown by libcloud when trying to '
|
||||
|
|
|
@ -404,7 +404,7 @@ def create(vm_):
|
|||
kwargs['user_data'] = salt.utils.cloud.userdata_template(
|
||||
__opts__, vm_, salt.utils.stringutils.to_unicode(fp_.read())
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception(
|
||||
'Failed to read userdata from %s: %s', userdata_file, exc)
|
||||
|
||||
|
@ -456,7 +456,7 @@ def create(vm_):
|
|||
|
||||
try:
|
||||
ret = create_node(kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on DIGITALOCEAN\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -143,7 +143,7 @@ def _query_node_data(vm_, data):
|
|||
running = (node['state'] == NodeState.RUNNING)
|
||||
log.debug('Loaded node data for %s:\nname: %s\nstate: %s',
|
||||
vm_['name'], pprint.pformat(node['name']), node['state'])
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to get nodes list: %s', err,
|
||||
# Show the traceback if the debug logging level is enabled
|
||||
|
@ -268,7 +268,7 @@ def create(vm_):
|
|||
|
||||
try:
|
||||
data = conn.create_node(**kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on DIMENSIONDATA\n\n'
|
||||
'The following exception was thrown by libcloud when trying to '
|
||||
|
@ -389,7 +389,7 @@ def create_lb(kwargs=None, call=None):
|
|||
node = get_node(conn, member) # pylint: disable=not-callable
|
||||
log.debug('Node: %s', node)
|
||||
ip = node.private_ips[0]
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to get node ip: %s', err,
|
||||
# Show the traceback if the debug logging level is enabled
|
||||
|
@ -464,7 +464,7 @@ def preferred_ip(vm_, ips):
|
|||
try:
|
||||
socket.inet_pton(family, ip)
|
||||
return ip
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
continue
|
||||
return False
|
||||
|
||||
|
|
|
@ -1823,7 +1823,7 @@ def request_instance(vm_=None, call=None):
|
|||
params[spot_prefix + 'UserData'] = base64.b64encode(
|
||||
salt.utils.stringutils.to_bytes(userdata)
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception('Failed to encode userdata: %s', exc)
|
||||
|
||||
vm_size = config.get_cloud_config_value(
|
||||
|
@ -1972,7 +1972,7 @@ def request_instance(vm_=None, call=None):
|
|||
if 'error' in rd_data:
|
||||
return rd_data['error']
|
||||
log.debug('EC2 Response: \'%s\'', rd_data)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error getting root device name for image id %s for '
|
||||
'VM %s: \n%s', image_id, vm_['name'], exc,
|
||||
|
@ -2067,7 +2067,7 @@ def request_instance(vm_=None, call=None):
|
|||
sigver='4')
|
||||
if 'error' in data:
|
||||
return data['error']
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on EC2 when trying to run the initial '
|
||||
'deployment: \n%s', vm_['name'], exc,
|
||||
|
|
|
@ -135,7 +135,7 @@ def create(vm_):
|
|||
|
||||
try:
|
||||
data = _query('grid', 'server/add', args=create_kwargs)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on GOGRID\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -522,7 +522,7 @@ def take_action(name=None, call=None, command=None, data=None, method='GET',
|
|||
ret = query(command=command, data=data, method=method,
|
||||
location=location)
|
||||
log.info('Success %s for node %s', caller, name)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
if 'InvalidState' in six.text_type(exc):
|
||||
ret = [200, {}]
|
||||
else:
|
||||
|
|
|
@ -150,7 +150,7 @@ def __get_conn(url):
|
|||
# support all vm layers supported by libvirt
|
||||
try:
|
||||
conn = libvirt.open(url)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise SaltCloudExecutionFailure(
|
||||
'Sorry, {0} failed to open a connection to the hypervisor '
|
||||
'software at {1}'.format(
|
||||
|
|
|
@ -392,7 +392,7 @@ def create(vm_):
|
|||
result = clone(kwargs={'linode_id': linode_id,
|
||||
'datacenter_id': datacenter_id,
|
||||
'plan_id': plan_id})
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error cloning \'%s\' on Linode.\n\n'
|
||||
'The following exception was thrown by Linode when trying to '
|
||||
|
@ -409,7 +409,7 @@ def create(vm_):
|
|||
'PLANID': plan_id,
|
||||
'DATACENTERID': datacenter_id
|
||||
})
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on Linode\n\n'
|
||||
'The following exception was thrown by Linode when trying to '
|
||||
|
|
|
@ -182,7 +182,7 @@ def _salt(fun, *args, **kw):
|
|||
if not ping:
|
||||
raise ValueError('Unreachable')
|
||||
break
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
ping = False
|
||||
ping_retries += 1
|
||||
log.error('%s unreachable, retrying', target)
|
||||
|
|
|
@ -554,7 +554,7 @@ def create(vm_):
|
|||
conn.create_hosted_service(**service_kwargs)
|
||||
except AzureConflictHttpError:
|
||||
log.debug('Cloud service already exists')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
error = 'The hosted service name is invalid.'
|
||||
if error in six.text_type(exc):
|
||||
log.error(
|
||||
|
@ -588,7 +588,7 @@ def create(vm_):
|
|||
del vm_kwargs['virtual_network_name']
|
||||
result = conn.add_role(**vm_kwargs)
|
||||
_wait_for_async(conn, result.request_id)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
error = 'The hosted service name is invalid.'
|
||||
if error in six.text_type(exc):
|
||||
log.error(
|
||||
|
|
|
@ -671,7 +671,7 @@ def create(vm_):
|
|||
pprint.pformat(data['name']),
|
||||
data['status']['state']
|
||||
)
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to get nodes list: %s', err,
|
||||
# Show the trackback if the debug logging level is enabled
|
||||
|
|
|
@ -1076,7 +1076,7 @@ def create(vm_):
|
|||
exc_info_on_loglevel=logging.DEBUG
|
||||
)
|
||||
return False
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on OpenNebula\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
@ -4566,7 +4566,7 @@ def _list_nodes(full=False):
|
|||
for nic in vm.find('TEMPLATE').findall('NIC'):
|
||||
try:
|
||||
private_ips.append(nic.find('IP').text)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
vms[name]['id'] = vm.find('ID').text
|
||||
|
|
|
@ -310,7 +310,7 @@ def preferred_ip(vm_, ips):
|
|||
try:
|
||||
socket.inet_pton(family, ip)
|
||||
return ip
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
continue
|
||||
return False
|
||||
|
||||
|
@ -654,7 +654,7 @@ def request_instance(vm_, conn=None, call=None):
|
|||
kwargs['userdata'] = __utils__['cloud.userdata_template'](
|
||||
__opts__, vm_, fp_.read()
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception(
|
||||
'Failed to read userdata from %s: %s', userdata, exc)
|
||||
if 'size' in kwargs:
|
||||
|
|
|
@ -297,7 +297,7 @@ def create(vm_):
|
|||
|
||||
try:
|
||||
data = create_node(vm_)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on PARALLELS\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -750,7 +750,7 @@ def set_public_lan(lan_id):
|
|||
lan_id=lan_id,
|
||||
public=True)
|
||||
return lan['id']
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
lan = conn.create_lan(datacenter_id,
|
||||
LAN(public=True,
|
||||
name='Public LAN'))
|
||||
|
@ -898,7 +898,7 @@ def create(vm_):
|
|||
'Loaded node data for %s:\nname: %s\nstate: %s',
|
||||
vm_['name'], pprint.pformat(data['name']), data['state']
|
||||
)
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to get nodes list: %s', err,
|
||||
# Show the trackback if the debug logging level is enabled
|
||||
|
|
|
@ -185,7 +185,7 @@ def query(conn_type, option, post_data=None):
|
|||
if 'data' not in returned_data:
|
||||
raise SaltCloudExecutionFailure
|
||||
return returned_data['data']
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error('Error in trying to process JSON')
|
||||
log.error(response)
|
||||
|
||||
|
@ -539,7 +539,7 @@ def create(vm_):
|
|||
try:
|
||||
newid = _get_next_vmid()
|
||||
data = create_node(vm_, newid)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on PROXMOX\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -251,7 +251,7 @@ def create(server_):
|
|||
|
||||
try:
|
||||
ret = create_node(kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on Scaleway\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -411,7 +411,7 @@ def create(vm_):
|
|||
|
||||
try:
|
||||
response = conn.createObject(kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on SoftLayer\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -336,7 +336,7 @@ def create(vm_):
|
|||
response = conn.placeOrder(kwargs)
|
||||
# Leaving the following line in, commented, for easy debugging
|
||||
#response = conn.verifyOrder(kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on SoftLayer\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -1429,7 +1429,7 @@ def _upg_tools_helper(vm, reboot=False):
|
|||
'tools upgrade',
|
||||
sleep_seconds=5,
|
||||
log_level='info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while upgrading VMware tools on VM %s: %s',
|
||||
vm.name, exc,
|
||||
|
@ -1482,7 +1482,7 @@ def test_vcenter_connection(kwargs=None, call=None):
|
|||
try:
|
||||
# Get the service instance object
|
||||
_get_si()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
return 'failed to connect: {0}'.format(exc)
|
||||
|
||||
return 'connection successful'
|
||||
|
@ -2136,7 +2136,7 @@ def start(name, call=None):
|
|||
log.info('Starting VM %s', name)
|
||||
task = vm["object"].PowerOn()
|
||||
salt.utils.vmware.wait_for_task(task, name, 'power on')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while powering on VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -2193,7 +2193,7 @@ def stop(name, soft=False, call=None):
|
|||
else:
|
||||
task = vm["object"].PowerOff()
|
||||
salt.utils.vmware.wait_for_task(task, name, 'power off')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while powering off VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -2242,7 +2242,7 @@ def suspend(name, call=None):
|
|||
log.info('Suspending VM %s', name)
|
||||
task = vm["object"].Suspend()
|
||||
salt.utils.vmware.wait_for_task(task, name, 'suspend')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while suspending VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -2299,7 +2299,7 @@ def reset(name, soft=False, call=None):
|
|||
else:
|
||||
task = vm["object"].ResetVM_Task()
|
||||
salt.utils.vmware.wait_for_task(task, name, 'reset')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while resetting VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -2344,7 +2344,7 @@ def terminate(name, call=None):
|
|||
try:
|
||||
log.info('Terminating VM %s', name)
|
||||
vm["object"].Terminate()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while terminating VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -2398,7 +2398,7 @@ def destroy(name, call=None):
|
|||
log.info('Powering Off VM %s', name)
|
||||
task = vm["object"].PowerOff()
|
||||
salt.utils.vmware.wait_for_task(task, name, 'power off')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while powering off VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -2410,7 +2410,7 @@ def destroy(name, call=None):
|
|||
log.info('Destroying VM %s', name)
|
||||
task = vm["object"].Destroy_Task()
|
||||
salt.utils.vmware.wait_for_task(task, name, 'destroy')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while destroying VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -2899,7 +2899,7 @@ def create(vm_):
|
|||
else:
|
||||
task = folder_ref.CreateVM_Task(config_spec, resourcepool_ref)
|
||||
salt.utils.vmware.wait_for_task(task, vm_name, "create", 15, 'info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
err_msg = 'Error creating {0}: {1}'.format(vm_['name'], exc)
|
||||
log.error(
|
||||
err_msg,
|
||||
|
@ -2915,7 +2915,7 @@ def create(vm_):
|
|||
if not clone_type and power:
|
||||
task = new_vm_ref.PowerOn()
|
||||
salt.utils.vmware.wait_for_task(task, vm_name, 'power', 5, 'info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.info('Powering on the VM threw this exception. Ignoring.')
|
||||
log.info(exc)
|
||||
|
||||
|
@ -3062,7 +3062,7 @@ def create_datacenter(kwargs=None, call=None):
|
|||
if isinstance(folder, vim.Folder):
|
||||
try:
|
||||
folder.CreateDatacenter(name=datacenter_name)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating datacenter %s: %s',
|
||||
datacenter_name, exc,
|
||||
|
@ -3128,7 +3128,7 @@ def create_cluster(kwargs=None, call=None):
|
|||
if isinstance(folder, vim.Folder):
|
||||
try:
|
||||
folder.CreateClusterEx(name=cluster_name, spec=cluster_spec)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating cluster %s: %s',
|
||||
cluster_name, exc,
|
||||
|
@ -3182,7 +3182,7 @@ def rescan_hba(kwargs=None, call=None):
|
|||
log.info('Rescanning all HBAs on host %s', host_name)
|
||||
host_ref.configManager.storageSystem.RescanAllHba()
|
||||
ret = 'rescanned all HBAs'
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while rescaning HBA on host %s: %s',
|
||||
host_name, exc,
|
||||
|
@ -3550,7 +3550,7 @@ def enter_maintenance_mode(kwargs=None, call=None):
|
|||
try:
|
||||
task = host_ref.EnterMaintenanceMode(timeout=0, evacuatePoweredOffVms=True)
|
||||
salt.utils.vmware.wait_for_task(task, host_name, 'enter maintenance mode')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while moving host system %s in maintenance mode: %s',
|
||||
host_name, exc,
|
||||
|
@ -3593,7 +3593,7 @@ def exit_maintenance_mode(kwargs=None, call=None):
|
|||
try:
|
||||
task = host_ref.ExitMaintenanceMode(timeout=0)
|
||||
salt.utils.vmware.wait_for_task(task, host_name, 'exit maintenance mode')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while moving host system %s out of maintenance mode: %s',
|
||||
host_name, exc,
|
||||
|
@ -3747,7 +3747,7 @@ def create_snapshot(name, kwargs=None, call=None):
|
|||
try:
|
||||
task = vm_ref.CreateSnapshot(snapshot_name, desc, memdump, quiesce)
|
||||
salt.utils.vmware.wait_for_task(task, name, 'create snapshot', 5, 'info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while creating snapshot of %s: %s',
|
||||
name, exc,
|
||||
|
@ -3819,7 +3819,7 @@ def revert_to_snapshot(name, kwargs=None, call=None):
|
|||
|
||||
salt.utils.vmware.wait_for_task(task, name, 'revert to snapshot', 5, 'info')
|
||||
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while reverting VM %s to snapshot: %s',
|
||||
name, exc,
|
||||
|
@ -3872,7 +3872,7 @@ def remove_snapshot(name, kwargs=None, call=None):
|
|||
task = snap_obj.RemoveSnapshot_Task(remove_children)
|
||||
salt.utils.vmware.wait_for_task(task, name, 'remove snapshot', 5, 'info')
|
||||
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while removing snapshot of %s: %s',
|
||||
name, exc,
|
||||
|
@ -3919,7 +3919,7 @@ def remove_all_snapshots(name, kwargs=None, call=None):
|
|||
try:
|
||||
task = vm_ref.RemoveAllSnapshots()
|
||||
salt.utils.vmware.wait_for_task(task, name, 'remove snapshots', 5, 'info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while removing snapshots on VM %s: %s',
|
||||
name, exc,
|
||||
|
@ -3958,7 +3958,7 @@ def convert_to_template(name, kwargs=None, call=None):
|
|||
|
||||
try:
|
||||
vm_ref.MarkAsTemplate()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while converting VM to template %s: %s',
|
||||
name, exc,
|
||||
|
@ -4103,7 +4103,7 @@ def add_host(kwargs=None, call=None):
|
|||
ssl_thumbprint = out.split('=')[-1].strip()
|
||||
log.debug('SSL thumbprint received from the host system: %s', ssl_thumbprint)
|
||||
spec.sslThumbprint = ssl_thumbprint
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while trying to get SSL thumbprint of host %s: %s',
|
||||
host_name, exc,
|
||||
|
@ -4120,7 +4120,7 @@ def add_host(kwargs=None, call=None):
|
|||
task = datacenter_ref.hostFolder.AddStandaloneHost(spec=spec, addConnected=True)
|
||||
ret = 'added host system to datacenter {0}'.format(datacenter_name)
|
||||
salt.utils.vmware.wait_for_task(task, host_name, 'add host system', 5, 'info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
if isinstance(exc, vim.fault.SSLVerifyFault):
|
||||
log.error('Authenticity of the host\'s SSL certificate is not verified')
|
||||
log.info('Try again after setting the esxi_host_ssl_thumbprint '
|
||||
|
@ -4176,7 +4176,7 @@ def remove_host(kwargs=None, call=None):
|
|||
# This is a standalone host system
|
||||
task = host_ref.parent.Destroy_Task()
|
||||
salt.utils.vmware.wait_for_task(task, host_name, 'remove host', log_level='info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while removing host %s: %s',
|
||||
host_name, exc,
|
||||
|
@ -4226,7 +4226,7 @@ def connect_host(kwargs=None, call=None):
|
|||
try:
|
||||
task = host_ref.ReconnectHost_Task()
|
||||
salt.utils.vmware.wait_for_task(task, host_name, 'connect host', 5, 'info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while connecting host %s: %s',
|
||||
host_name, exc,
|
||||
|
@ -4276,7 +4276,7 @@ def disconnect_host(kwargs=None, call=None):
|
|||
try:
|
||||
task = host_ref.DisconnectHost_Task()
|
||||
salt.utils.vmware.wait_for_task(task, host_name, 'disconnect host', log_level='info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while disconnecting host %s: %s',
|
||||
host_name, exc,
|
||||
|
@ -4347,7 +4347,7 @@ def reboot_host(kwargs=None, call=None):
|
|||
try:
|
||||
host_ref.RebootHost_Task(force)
|
||||
_wait_for_host(host_ref, "reboot", 10, 'info')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error while rebooting host %s: %s',
|
||||
host_name, exc,
|
||||
|
@ -4409,7 +4409,7 @@ def create_datastore_cluster(kwargs=None, call=None):
|
|||
|
||||
try:
|
||||
datacenter_ref.datastoreFolder.CreateStoragePod(name=datastore_cluster_name)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating datastore cluster %s: %s',
|
||||
datastore_cluster_name, exc,
|
||||
|
|
|
@ -356,7 +356,7 @@ def create(vm_):
|
|||
transport=__opts__['transport'],
|
||||
)
|
||||
return False
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Error creating %s on Vultr\n\n'
|
||||
'The following exception was thrown when trying to '
|
||||
|
|
|
@ -198,7 +198,7 @@ def list_nodes():
|
|||
if not record['is_a_template'] and not record['is_control_domain']:
|
||||
try:
|
||||
base_template_name = record['other_config']['base_template_name']
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
base_template_name = None
|
||||
log.debug(
|
||||
'VM %s, doesnt have base_template_name attribute',
|
||||
|
@ -254,7 +254,7 @@ def get_vm_ip(name=None, session=None, call=None):
|
|||
name, net["0/ip"]
|
||||
)
|
||||
ret = net["0/ip"]
|
||||
# except Exception as ex:
|
||||
# except Exception as ex: # pylint: disable=broad-except
|
||||
except XenAPI.Failure:
|
||||
log.info('Could not get vm metrics at this time')
|
||||
return ret
|
||||
|
@ -322,7 +322,7 @@ def list_nodes_full(session=None):
|
|||
# deal with cases where the VM doesn't have 'base_template_name' attribute
|
||||
try:
|
||||
base_template_name = record['other_config']['base_template_name']
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
base_template_name = None
|
||||
log.debug(
|
||||
'VM %s, doesnt have base_template_name attribute',
|
||||
|
@ -489,7 +489,7 @@ def show_instance(name, session=None, call=None):
|
|||
if not record['is_a_template'] and not record['is_control_domain']:
|
||||
try:
|
||||
base_template_name = record['other_config']['base_template_name']
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
base_template_name = None
|
||||
log.debug(
|
||||
'VM %s, doesnt have base_template_name attribute',
|
||||
|
|
|
@ -227,7 +227,7 @@ def avail_sizes(conn=None, call=None):
|
|||
|
||||
try:
|
||||
attr_value = getattr(size, attr)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
if isinstance(attr_value, six.string_types) and not six.PY3:
|
||||
|
|
|
@ -1954,7 +1954,7 @@ def _expand_glob_path(file_roots):
|
|||
unglobbed_path.extend(glob.glob(path))
|
||||
else:
|
||||
unglobbed_path.append(path)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
unglobbed_path.append(path)
|
||||
return unglobbed_path
|
||||
|
||||
|
@ -4010,7 +4010,7 @@ def apply_master_config(overrides=None, defaults=None):
|
|||
# serialization)
|
||||
re.compile(regex)
|
||||
opts['file_ignore_regex'].append(regex)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.warning(
|
||||
'Unable to parse file_ignore_regex. Skipping: %s',
|
||||
regex
|
||||
|
|
|
@ -832,7 +832,7 @@ class AsyncAuth(object):
|
|||
else:
|
||||
cipher = PKCS1_OAEP.new(pub)
|
||||
payload['token'] = cipher.encrypt(self.token)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
with salt.utils.files.fopen(self.pub_path) as f:
|
||||
payload['pub'] = f.read()
|
||||
|
@ -877,7 +877,7 @@ class AsyncAuth(object):
|
|||
if os.path.exists(m_path):
|
||||
try:
|
||||
mkey = get_rsa_pub_key(m_path)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return '', ''
|
||||
digest = hashlib.sha256(key_str).hexdigest()
|
||||
if six.PY3:
|
||||
|
@ -968,7 +968,7 @@ class AsyncAuth(object):
|
|||
'verification failed!', self.opts['master']
|
||||
)
|
||||
return False
|
||||
except Exception as sign_exc:
|
||||
except Exception as sign_exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'There was an error while verifying the masters public-key '
|
||||
'signature'
|
||||
|
@ -1032,7 +1032,7 @@ class AsyncAuth(object):
|
|||
'The master failed to decrypt the random minion token'
|
||||
)
|
||||
return ''
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'The master failed to decrypt the random minion token'
|
||||
)
|
||||
|
|
|
@ -262,7 +262,7 @@ def fileserver_update(fileserver):
|
|||
)
|
||||
raise salt.exceptions.SaltMasterError('No fileserver backends available')
|
||||
fileserver.update()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Exception %s occurred in file server update', exc,
|
||||
exc_info_on_loglevel=logging.DEBUG
|
||||
|
@ -533,7 +533,7 @@ class RemoteFuncs(object):
|
|||
continue
|
||||
try:
|
||||
ret = salt.utils.dictupdate.merge(ret, self.tops[fun](opts=opts, grains=grains), merge_lists=True)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
# If anything happens in the top generation, log it and move on
|
||||
log.error(
|
||||
'Top function %s failed with error %s for minion %s',
|
||||
|
@ -1073,7 +1073,7 @@ class LocalFuncs(object):
|
|||
return runner_client.asynchronous(fun,
|
||||
load.get('kwarg', {}),
|
||||
username)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception('Exception occurred while introspecting %s')
|
||||
return {'error': {'name': exc.__class__.__name__,
|
||||
'args': exc.args,
|
||||
|
@ -1131,7 +1131,7 @@ class LocalFuncs(object):
|
|||
self.event.fire_event(data, salt.utils.event.tagify([jid, 'ret'], 'wheel'))
|
||||
return {'tag': tag,
|
||||
'data': data}
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception('Exception occurred while introspecting %s', fun)
|
||||
data['return'] = 'Exception occurred in wheel {0}: {1}: {2}'.format(
|
||||
fun,
|
||||
|
@ -1282,7 +1282,7 @@ class LocalFuncs(object):
|
|||
'"%s" does not have a save_load function!',
|
||||
self.opts['ext_job_cache']
|
||||
)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.critical(
|
||||
'The specified returner threw a stack trace:',
|
||||
exc_info=True
|
||||
|
@ -1298,7 +1298,7 @@ class LocalFuncs(object):
|
|||
'"%s" does not have a save_load function!',
|
||||
self.opts['master_job_cache']
|
||||
)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.critical(
|
||||
'The specified returner threw a stack trace:',
|
||||
exc_info=True
|
||||
|
|
|
@ -129,7 +129,7 @@ class Engine(SignalHandlingProcess):
|
|||
kwargs = self.config or {}
|
||||
try:
|
||||
self.engine[self.fun](**kwargs)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.critical(
|
||||
'Engine \'%s\' could not be started!',
|
||||
self.fun.split('.')[0], exc_info=True
|
||||
|
|
|
@ -101,5 +101,5 @@ def start(docker_url='unix://var/run/docker.sock',
|
|||
fire('{0}/{1}'.format(tag, data['Action']), data)
|
||||
else:
|
||||
fire('{0}/{1}'.format(tag, data['status']), data)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -170,10 +170,10 @@ class _Parser(object):
|
|||
def parse(self, line):
|
||||
try:
|
||||
parsed = self.__pattern.parseString(line)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
parsed = self.__pattern_without_daemon.parseString(line)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return
|
||||
if len(parsed) == 6:
|
||||
payload = {}
|
||||
|
|
|
@ -109,7 +109,7 @@ class PlainTextSocketAppender(object):
|
|||
try:
|
||||
self.open_connection()
|
||||
return
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
if self.verbose:
|
||||
log.warning('Unable to connect to Logentries')
|
||||
|
||||
|
|
|
@ -646,7 +646,7 @@ class SlackClient(object):
|
|||
out=outputter,
|
||||
opts=__opts__,
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
import pprint
|
||||
log.exception(
|
||||
'Exception encountered when trying to serialize %s',
|
||||
|
@ -845,5 +845,5 @@ def start(token,
|
|||
client = SlackClient(token=token)
|
||||
message_generator = client.generate_triggered_messages(token, trigger, groups, groups_pillar_name)
|
||||
client.run_commands_from_slack_async(message_generator, fire_all, tag, control)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise Exception('{}'.format(traceback.format_exc()))
|
||||
|
|
|
@ -201,7 +201,7 @@ def v4_int_to_packed(address):
|
|||
"""
|
||||
try:
|
||||
return _int_to_bytes(address, 4, 'big')
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise ValueError("Address negative or too large for IPv4")
|
||||
|
||||
|
||||
|
@ -217,7 +217,7 @@ def v6_int_to_packed(address):
|
|||
"""
|
||||
try:
|
||||
return _int_to_bytes(address, 16, 'big')
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise ValueError("Address negative or too large for IPv6")
|
||||
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ class Client(object):
|
|||
path_style=s3_opt('path_style', False),
|
||||
https_enable=s3_opt('https_enable', True))
|
||||
return dest
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise MinionError(
|
||||
'Could not fetch from {0}. Exception: {1}'.format(url, exc)
|
||||
)
|
||||
|
@ -543,7 +543,7 @@ class Client(object):
|
|||
ftp.retrbinary('RETR {0}'.format(remote_file_path), fp_.write)
|
||||
ftp.quit()
|
||||
return dest
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise MinionError('Could not retrieve {0} from FTP server. Exception: {1}'.format(url, exc))
|
||||
|
||||
if url_data.scheme == 'swift':
|
||||
|
@ -568,7 +568,7 @@ class Client(object):
|
|||
url_data.path[1:],
|
||||
dest)
|
||||
return dest
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise MinionError('Could not fetch from {0}'.format(url))
|
||||
|
||||
get_kwargs = {}
|
||||
|
@ -956,7 +956,7 @@ class PillarClient(Client):
|
|||
fnd_path = fnd
|
||||
try:
|
||||
fnd_stat = list(os.stat(fnd_path))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
fnd_stat = None
|
||||
|
||||
hash_type = self.opts.get('hash_type', 'md5')
|
||||
|
@ -1328,7 +1328,7 @@ class RemoteClient(Client):
|
|||
else:
|
||||
try:
|
||||
return hash_result, list(os.stat(path))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return hash_result, None
|
||||
load = {'path': path,
|
||||
'saltenv': saltenv,
|
||||
|
|
|
@ -163,7 +163,7 @@ def check_file_list_cache(opts, form, list_cache, w_lock):
|
|||
# Set the w_lock and go
|
||||
refresh_cache = True
|
||||
break
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
time.sleep(0.2)
|
||||
attempt += 1
|
||||
continue
|
||||
|
|
|
@ -127,7 +127,7 @@ def find_file(path, saltenv='base', **kwargs):
|
|||
# 8 => st_mtime=1456338235
|
||||
# 9 => st_ctime=1456338235
|
||||
fnd['stat'] = list(os.stat(full))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
return fnd
|
||||
return fnd
|
||||
|
@ -193,14 +193,14 @@ def update():
|
|||
elif not os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
os.makedirs(path)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception('Error occurred creating cache directory for azurefs')
|
||||
continue
|
||||
blob_service = _get_container_service(container)
|
||||
name = container['container_name']
|
||||
try:
|
||||
blob_list = blob_service.list_blobs(name)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception('Error occurred fetching blob list for azurefs')
|
||||
continue
|
||||
|
||||
|
@ -215,7 +215,7 @@ def update():
|
|||
salt.fileserver.wait_lock(fname + '.lk', fname)
|
||||
try:
|
||||
os.unlink(fname)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
if not dirs and not files:
|
||||
shutil.rmtree(root)
|
||||
|
@ -243,14 +243,14 @@ def update():
|
|||
|
||||
try:
|
||||
blob_service.get_blob_to_path(name, blob.name, fname)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception('Error occurred fetching blob from azurefs')
|
||||
continue
|
||||
|
||||
# Unlock writes
|
||||
try:
|
||||
os.unlink(lk_fn)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
# Write out file list
|
||||
|
@ -263,12 +263,12 @@ def update():
|
|||
salt.utils.json.dump(blob_names, fp_)
|
||||
try:
|
||||
os.unlink(lk_fn)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
try:
|
||||
hash_cachedir = os.path.join(__opts__['cachedir'], 'azurefs', 'hashes')
|
||||
shutil.rmtree(hash_cachedir)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.exception('Problem occurred trying to invalidate hash cach for azurefs')
|
||||
|
||||
|
||||
|
@ -315,7 +315,7 @@ def file_list(load):
|
|||
continue
|
||||
with salt.utils.files.fopen(container_list, 'r') as fp_:
|
||||
ret.update(set(salt.utils.json.load(fp_)))
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('azurefs: an error ocurred retrieving file lists. '
|
||||
'It should be resolved next time the fileserver '
|
||||
'updates. Please do not manually modify the azurefs '
|
||||
|
|
|
@ -283,7 +283,7 @@ def init():
|
|||
'hgfs remote.', rp_, repo_url
|
||||
)
|
||||
_failhard()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Exception \'%s\' encountered while initializing hgfs '
|
||||
'remote %s', exc, repo_url
|
||||
|
@ -533,7 +533,7 @@ def update():
|
|||
curtip = repo['repo'].tip()
|
||||
try:
|
||||
repo['repo'].pull()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Exception %s caught while updating hgfs remote %s',
|
||||
exc, repo['url'], exc_info_on_loglevel=logging.DEBUG
|
||||
|
@ -691,7 +691,7 @@ def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
|
|||
for filename in glob.glob(hashes_glob):
|
||||
try:
|
||||
os.remove(filename)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
with salt.utils.files.fopen(blobshadest, 'w+') as fp_:
|
||||
fp_.write(ref[2])
|
||||
|
@ -715,7 +715,7 @@ def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
|
|||
# 8 => st_mtime=1456338235
|
||||
# 9 => st_ctime=1456338235
|
||||
fnd['stat'] = list(os.stat(dest))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
repo['repo'].close()
|
||||
return fnd
|
||||
|
|
|
@ -78,7 +78,7 @@ def find_file(path, saltenv='base', **kwargs):
|
|||
'''
|
||||
try:
|
||||
fnd['stat'] = list(os.stat(fnd['path']))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
return fnd
|
||||
|
||||
|
@ -360,7 +360,7 @@ def _file_lists(load, form):
|
|||
try:
|
||||
if not os.listdir(abs_path):
|
||||
ret['empty_dirs'].add(rel_path)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# Generic exception because running os.listdir() on a
|
||||
# non-directory path raises an OSError on *NIX and a
|
||||
# WindowsError on Windows.
|
||||
|
|
|
@ -609,7 +609,7 @@ def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
|
|||
# 8 => st_mtime=1456338235
|
||||
# 9 => st_ctime=1456338235
|
||||
fnd['stat'] = list(os.stat(full))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
return fnd
|
||||
return fnd
|
||||
|
|
|
@ -2149,7 +2149,7 @@ def locale_info():
|
|||
grains['locale_info']['defaultlanguage'],
|
||||
grains['locale_info']['defaultencoding']
|
||||
) = locale.getdefaultlocale()
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# locale.getdefaultlocale can ValueError!! Catch anything else it
|
||||
# might do, per #2205
|
||||
grains['locale_info']['defaultlanguage'] = 'unknown'
|
||||
|
@ -2869,6 +2869,6 @@ def default_gateway():
|
|||
if via == 'via':
|
||||
grains['ip{0}_gw'.format(ip_version)] = gw_ip
|
||||
break
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
continue
|
||||
return grains
|
||||
|
|
|
@ -71,7 +71,7 @@ def config():
|
|||
with salt.utils.files.fopen(gfn, 'rb') as fp_:
|
||||
try:
|
||||
return salt.utils.data.decode(salt.utils.yaml.safe_load(fp_))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.warning("Bad syntax in grains file! Skipping.")
|
||||
return {}
|
||||
return {}
|
||||
|
|
|
@ -179,7 +179,7 @@ def _module_dirs(
|
|||
loaded_entry_point = entry_point.load()
|
||||
for path in loaded_entry_point():
|
||||
ext_type_types.append(path)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error("Error getting module directories from %s: %s", _format_entrypoint_target(entry_point), exc)
|
||||
log.debug("Full backtrace for module directories error", exc_info=True)
|
||||
|
||||
|
@ -829,7 +829,7 @@ def grains(opts, force_refresh=False, proxy=None):
|
|||
if 'grains' in parameters:
|
||||
kwargs['grains'] = grains_data
|
||||
ret = funcs[key](**kwargs)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
if salt.utils.platform.is_proxy():
|
||||
log.info('The following CRITICAL message may not be an error; the proxy may not be completely established yet.')
|
||||
log.critical(
|
||||
|
@ -865,7 +865,7 @@ def grains(opts, force_refresh=False, proxy=None):
|
|||
salt.utils.dictupdate.update(grains_data, ret)
|
||||
else:
|
||||
grains_data.update(ret)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.critical('Failed to run proxy\'s grains function!',
|
||||
exc_info=True
|
||||
)
|
||||
|
@ -889,7 +889,7 @@ def grains(opts, force_refresh=False, proxy=None):
|
|||
except TypeError as e:
|
||||
log.error('Failed to serialize grains cache: %s', e)
|
||||
raise # re-throw for cleanup
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error('Unable to write to grains cache file %s: %s', cfn, e)
|
||||
# Based on the original exception, the file may or may not have been
|
||||
# created. If it was, we will remove it now, as the exception means
|
||||
|
@ -1607,7 +1607,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
)
|
||||
self.missing_modules[name] = exc
|
||||
return False
|
||||
except Exception as error:
|
||||
except Exception as error: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Failed to import %s %s, this is due most likely to a '
|
||||
'syntax error:\n', self.tag, name, exc_info=True
|
||||
|
@ -1617,7 +1617,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
except SystemExit as error:
|
||||
try:
|
||||
fn_, _, caller, _ = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
else:
|
||||
tgt_fn = os.path.join('salt', 'utils', 'process.py')
|
||||
|
@ -1653,7 +1653,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
module_init(self.opts)
|
||||
except TypeError as e:
|
||||
log.error(e)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
err_string = '__init__ failed'
|
||||
log.debug(
|
||||
'Error loading %s.%s: %s',
|
||||
|
@ -1878,7 +1878,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
msg = 'Virtual function took {0} seconds for {1}'.format(
|
||||
end, module_name)
|
||||
log.warning(msg)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
error_reason = (
|
||||
'Exception raised when processing __virtual__ function'
|
||||
' for {0}. Module will not be loaded: {1}'.format(
|
||||
|
@ -1939,7 +1939,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
# help debugging.
|
||||
log.debug('KeyError when loading %s', module_name, exc_info=True)
|
||||
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# If the module throws an exception during __virtual__()
|
||||
# then log the information and continue to the next.
|
||||
log.error(
|
||||
|
|
|
@ -416,7 +416,7 @@ class FluentSender(object):
|
|||
|
||||
try:
|
||||
self._reconnect()
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# will be retried in emit()
|
||||
self._close()
|
||||
|
||||
|
@ -460,7 +460,7 @@ class FluentSender(object):
|
|||
|
||||
# send finished
|
||||
self.pendings = None
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# close socket
|
||||
self._close()
|
||||
# clear buffer if it exceeds max bufer size
|
||||
|
|
|
@ -317,7 +317,7 @@ class Maintenance(salt.utils.process.SignalHandlingProcess):
|
|||
try:
|
||||
for pillar in self.git_pillar:
|
||||
pillar.fetch_remotes()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('Exception caught while updating git_pillar',
|
||||
exc_info=True)
|
||||
|
||||
|
@ -331,7 +331,7 @@ class Maintenance(salt.utils.process.SignalHandlingProcess):
|
|||
# the loop_interval setting
|
||||
if self.schedule.loop_interval < self.loop_interval:
|
||||
self.loop_interval = self.schedule.loop_interval
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('Exception %s occurred in scheduled job', exc)
|
||||
self.schedule.cleanup_subprocesses()
|
||||
|
||||
|
@ -459,7 +459,7 @@ class FileserverUpdate(salt.utils.process.SignalHandlingProcess):
|
|||
args = ()
|
||||
|
||||
update_func(*args)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception(
|
||||
'Uncaught exception while updating %s fileserver '
|
||||
'cache', backend_name
|
||||
|
@ -719,7 +719,7 @@ class Master(SMaster):
|
|||
_tmp = __import__(mod, globals(), locals(), [cls], -1)
|
||||
cls = _tmp.__getattribute__(cls)
|
||||
self.process_manager.add_process(cls, args=(self.opts,))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error('Error creating ext_processes process: %s', proc)
|
||||
|
||||
if HAS_HALITE and 'halite' in self.opts:
|
||||
|
@ -1841,7 +1841,7 @@ class AESFuncs(object):
|
|||
'Master function call %s took %s seconds',
|
||||
func, time.time() - start
|
||||
)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
ret = ''
|
||||
log.error('Error in function %s:\n', func, exc_info=True)
|
||||
else:
|
||||
|
@ -1944,7 +1944,7 @@ class ClearFuncs(object):
|
|||
return runner_client.asynchronous(fun,
|
||||
clear_load.get('kwarg', {}),
|
||||
username)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('Exception occurred while introspecting %s: %s', fun, exc)
|
||||
return {'error': {'name': exc.__class__.__name__,
|
||||
'args': exc.args,
|
||||
|
@ -2009,7 +2009,7 @@ class ClearFuncs(object):
|
|||
self.event.fire_event(data, tagify([jid, 'ret'], 'wheel'))
|
||||
return {'tag': tag,
|
||||
'data': data}
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('Exception occurred while introspecting %s: %s', fun, exc)
|
||||
data['return'] = 'Exception occurred in wheel {0}: {1}: {2}'.format(
|
||||
fun,
|
||||
|
@ -2269,7 +2269,7 @@ class ClearFuncs(object):
|
|||
if save_load_func:
|
||||
try:
|
||||
self.mminion.returners[fstr](clear_load['jid'], clear_load, minions=minions)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.critical(
|
||||
'The specified returner threw a stack trace:\n',
|
||||
exc_info=True
|
||||
|
@ -2285,7 +2285,7 @@ class ClearFuncs(object):
|
|||
'"%s" does not have a save_load function!',
|
||||
self.opts['master_job_cache']
|
||||
)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.critical(
|
||||
'The specified returner threw a stack trace:\n',
|
||||
exc_info=True
|
||||
|
|
|
@ -108,7 +108,7 @@ def match(tgt, opts=None):
|
|||
log.debug('compound_match %s ? "%s" => "%s"', minion_id, tgt, results)
|
||||
try:
|
||||
return eval(results) # pylint: disable=W0123
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Invalid compound target: %s for results: %s', tgt, results)
|
||||
return False
|
||||
|
|
|
@ -28,7 +28,7 @@ def match(tgt, opts=None):
|
|||
# tgt is not a string, maybe it's a sequence type?
|
||||
try:
|
||||
return opts['id'] in tgt
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# tgt was likely some invalid type
|
||||
return False
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ def thread_return(cls, minion_instance, opts, data):
|
|||
try:
|
||||
func_result = all(return_data.get(x, True)
|
||||
for x in ('result', 'success'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# return data is not a dict
|
||||
func_result = True
|
||||
if not func_result:
|
||||
|
@ -470,7 +470,7 @@ def thread_return(cls, minion_instance, opts, data):
|
|||
ret['return'] = msg
|
||||
ret['out'] = 'nested'
|
||||
ret['retcode'] = salt.defaults.exitcodes.EX_GENERIC
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
msg = 'The minion function caused an exception'
|
||||
log.warning(msg, exc_info_on_loglevel=True)
|
||||
salt.utils.error.fire_exception(salt.exceptions.MinionError(msg), opts, job=data)
|
||||
|
@ -536,7 +536,7 @@ def thread_return(cls, minion_instance, opts, data):
|
|||
'Returner %s could not be loaded: %s',
|
||||
returner_str, returner_err
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception(
|
||||
'The return failed for job %s: %s', data['jid'], exc
|
||||
)
|
||||
|
@ -610,7 +610,7 @@ def thread_multi_return(cls, minion_instance, opts, data):
|
|||
try:
|
||||
func_result = all(ret['return'][key].get(x, True)
|
||||
for x in ('result', 'success'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# return data is not a dict
|
||||
func_result = True
|
||||
if not func_result:
|
||||
|
@ -618,7 +618,7 @@ def thread_multi_return(cls, minion_instance, opts, data):
|
|||
|
||||
ret['retcode'][key] = retcode
|
||||
ret['success'][key] = retcode == 0
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
trb = traceback.format_exc()
|
||||
log.warning('The minion function caused an exception: %s', exc)
|
||||
if multifunc_ordered:
|
||||
|
@ -646,7 +646,7 @@ def thread_multi_return(cls, minion_instance, opts, data):
|
|||
minion_instance.returners['{0}.returner'.format(
|
||||
returner
|
||||
)](ret)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'The return failed for job %s: %s',
|
||||
data['jid'], exc
|
||||
|
|
|
@ -472,7 +472,7 @@ class MinionBase(object):
|
|||
log.debug(
|
||||
'Overriding loop_interval because of scheduled jobs.'
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('Exception %s occurred in scheduled job', exc)
|
||||
return loop_interval
|
||||
|
||||
|
@ -781,7 +781,7 @@ class MinionBase(object):
|
|||
time.sleep(self.opts['discovery'].get('pause', 5))
|
||||
else:
|
||||
break
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error('SSDP discovery failure: %s', err)
|
||||
break
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ class MinionManager(MinionBase):
|
|||
'Set \'master\' value in minion config.'.format(minion.opts['master'])
|
||||
log.error(err)
|
||||
break
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
failed = True
|
||||
log.critical(
|
||||
'Unexpected error while connecting to %s',
|
||||
|
@ -1455,7 +1455,7 @@ class Minion(MinionBase):
|
|||
except salt.exceptions.SaltReqTimeoutError:
|
||||
log.info('fire_master failed: master could not be contacted. Request timed out.')
|
||||
return False
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.info('fire_master failed: %s', traceback.format_exc())
|
||||
return False
|
||||
else:
|
||||
|
@ -1697,7 +1697,7 @@ class Minion(MinionBase):
|
|||
try:
|
||||
func_result = all(return_data.get(x, True)
|
||||
for x in ('result', 'success'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# return data is not a dict
|
||||
func_result = True
|
||||
if not func_result:
|
||||
|
@ -1741,7 +1741,7 @@ class Minion(MinionBase):
|
|||
ret['return'] = msg
|
||||
ret['out'] = 'nested'
|
||||
ret['retcode'] = salt.defaults.exitcodes.EX_GENERIC
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
msg = 'The minion function caused an exception'
|
||||
log.warning(msg, exc_info_on_loglevel=True)
|
||||
salt.utils.error.fire_exception(salt.exceptions.MinionError(msg), opts, job=data)
|
||||
|
@ -1807,7 +1807,7 @@ class Minion(MinionBase):
|
|||
'Returner %s could not be loaded: %s',
|
||||
returner_str, returner_err
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.exception(
|
||||
'The return failed for job %s: %s', data['jid'], exc
|
||||
)
|
||||
|
@ -1882,7 +1882,7 @@ class Minion(MinionBase):
|
|||
try:
|
||||
func_result = all(ret['return'][key].get(x, True)
|
||||
for x in ('result', 'success'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# return data is not a dict
|
||||
func_result = True
|
||||
if not func_result:
|
||||
|
@ -1890,7 +1890,7 @@ class Minion(MinionBase):
|
|||
|
||||
ret['retcode'][key] = retcode
|
||||
ret['success'][key] = retcode == 0
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
trb = traceback.format_exc()
|
||||
log.warning('The minion function caused an exception: %s', exc)
|
||||
if multifunc_ordered:
|
||||
|
@ -1918,7 +1918,7 @@ class Minion(MinionBase):
|
|||
minion_instance.returners['{0}.returner'.format(
|
||||
returner
|
||||
)](ret)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'The return failed for job %s: %s',
|
||||
data['jid'], exc
|
||||
|
@ -2328,7 +2328,7 @@ class Minion(MinionBase):
|
|||
'%s is starting as user \'%s\'',
|
||||
self.__class__.__name__, salt.utils.user.get_user()
|
||||
)
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
# Only windows is allowed to fail here. See #3189. Log as debug in
|
||||
# that case. Else, error.
|
||||
log.log(
|
||||
|
@ -2596,7 +2596,7 @@ class Minion(MinionBase):
|
|||
beacons = None
|
||||
try:
|
||||
beacons = self.process_beacons(self.functions)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.critical('The beacon errored: ', exc_info=True)
|
||||
if beacons:
|
||||
event = salt.utils.event.get_event('minion',
|
||||
|
@ -2638,7 +2638,7 @@ class Minion(MinionBase):
|
|||
self.opts['grains_refresh_every']
|
||||
)
|
||||
self._refresh_grains_watcher(abs(self.opts['grains_refresh_every']))
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'Exception occurred in attempt to initialize grain refresh '
|
||||
'routine during minion tune-in: %s', exc
|
||||
|
@ -2735,7 +2735,7 @@ class Minion(MinionBase):
|
|||
)
|
||||
|
||||
self._fire_master('ping', 'minion_ping', sync=False, timeout_handler=ping_timeout_handler)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.warning('Attempt to ping master failed.', exc_on_loglevel=logging.DEBUG)
|
||||
self.remove_periodic_callback('ping')
|
||||
self.add_periodic_callback('ping', ping_master, ping_interval)
|
||||
|
@ -3069,7 +3069,7 @@ class SyndicManager(MinionBase):
|
|||
yield tornado.gen.sleep(auth_wait) # TODO: log?
|
||||
except (KeyboardInterrupt, SystemExit): # pylint: disable=try-except-raise
|
||||
raise
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
failed = True
|
||||
log.critical(
|
||||
'Unexpected error while connecting to %s',
|
||||
|
|
|
@ -179,7 +179,7 @@ def deluser(name, username, root=None):
|
|||
return not ret['retcode']
|
||||
else:
|
||||
return True
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ def help(module=None, *args):
|
|||
docset = salt.utils.yaml.safe_load(docset)
|
||||
if docset:
|
||||
doc.update(docset)
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
log.error("Error parsing doc section: %s", err)
|
||||
if not args:
|
||||
if 'description' in doc:
|
||||
|
|
|
@ -1445,7 +1445,7 @@ def version_cmp(pkg1, pkg2, ignore_epoch=False):
|
|||
except TypeError:
|
||||
ret = apt_pkg.version_compare(six.text_type(pkg1), six.text_type(pkg2))
|
||||
return 1 if ret > 0 else -1 if ret < 0 else 0
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# Try to use shell version in case of errors w/python bindings
|
||||
pass
|
||||
try:
|
||||
|
@ -1457,7 +1457,7 @@ def version_cmp(pkg1, pkg2, ignore_epoch=False):
|
|||
ignore_retcode=True)
|
||||
if retcode == 0:
|
||||
return ret
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(exc)
|
||||
return None
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ def list_(name,
|
|||
)
|
||||
except CommandExecutionError as exc:
|
||||
raise
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
'Uncaught exception \'{0}\' when listing contents of {1}'
|
||||
.format(exc, name)
|
||||
|
@ -827,7 +827,7 @@ def zip_(zip_file, sources, template=None, cwd=None, runas=None, zip64=False):
|
|||
arc_name = os.path.relpath(src, rel_root)
|
||||
archived_files.append(arc_name)
|
||||
zfile.write(src, arc_name)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
pass
|
||||
finally:
|
||||
# Restore the euid/egid
|
||||
|
@ -1101,7 +1101,7 @@ def unzip(zip_file,
|
|||
else:
|
||||
win32_attr = zfile.getinfo(target).external_attr & 0xFF
|
||||
win32file.SetFileAttributes(os.path.join(dest, target), win32_attr)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
if runas:
|
||||
os.seteuid(euid)
|
||||
os.setegid(egid)
|
||||
|
@ -1177,7 +1177,7 @@ def is_encrypted(name, clean=False, saltenv='base', source_hash=None):
|
|||
'{0} is not a ZIP file'.format(name),
|
||||
info=archive_info
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(exc.__str__(), info=archive_info)
|
||||
else:
|
||||
ret = False
|
||||
|
|
|
@ -75,7 +75,7 @@ def uuid(dev=None):
|
|||
else:
|
||||
# basename of the /sys/block/{dev}/bcache/cache symlink target
|
||||
return os.path.basename(_bcsys(dev, 'cache'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return False
|
||||
|
||||
|
||||
|
@ -492,7 +492,7 @@ def device(dev, stats=False, config=False, internals=False, superblock=False):
|
|||
|
||||
try:
|
||||
result['dev'] = os.path.basename(_bcsys(dev, 'dev'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
result['bdev'] = _bdev(dev)
|
||||
|
||||
|
@ -604,10 +604,10 @@ def super_(dev):
|
|||
|
||||
try:
|
||||
rval = int(rval)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
rval = float(rval)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
if rval == 'yes':
|
||||
rval = True
|
||||
elif rval == 'no':
|
||||
|
@ -800,10 +800,10 @@ def _sysfs_parse(path, base_attr=None, stats=False, config=False, internals=Fals
|
|||
val = val.strip()
|
||||
try:
|
||||
val = int(val)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
val = float(val)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
listres[key.strip()] = val
|
||||
result[strlist] = listres
|
||||
|
@ -846,7 +846,7 @@ def _size_map(size):
|
|||
size = 1024**2 * float(re.sub(r'[Mm]', '', size))
|
||||
size = int(size)
|
||||
return size
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ def _set_value(value):
|
|||
|
||||
try:
|
||||
return salt.utils.json.loads(value)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise salt.exceptions.CommandExecutionError
|
||||
|
||||
#detect list of dictionaries
|
||||
|
@ -1485,7 +1485,7 @@ def create_virtual(hostname, username, password, name, destination,
|
|||
payload['vlans-enabled'] = True
|
||||
elif vlans['disabled']:
|
||||
payload['vlans-disabled'] = True
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return 'Error: Unable to Parse vlans dictionary: \n\tvlans={vlans}'.format(vlans=vlans)
|
||||
elif vlans == 'none':
|
||||
payload['vlans'] = 'none'
|
||||
|
@ -1499,7 +1499,7 @@ def create_virtual(hostname, username, password, name, destination,
|
|||
payload['vlans-disabled'] = True
|
||||
elif vlans_setting == 'enabled':
|
||||
payload['vlans-enabled'] = True
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return 'Error: Unable to Parse vlans option: \n\tvlans={vlans}'.format(vlans=vlans)
|
||||
else:
|
||||
return 'Error: vlans must be a dictionary or string.'
|
||||
|
@ -1759,7 +1759,7 @@ def modify_virtual(hostname, username, password, name,
|
|||
payload['vlans-enabled'] = True
|
||||
elif vlans['disabled']:
|
||||
payload['vlans-disabled'] = True
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return 'Error: Unable to Parse vlans dictionary: \n\tvlans={vlans}'.format(vlans=vlans)
|
||||
elif vlans == 'none':
|
||||
payload['vlans'] = 'none'
|
||||
|
@ -1773,7 +1773,7 @@ def modify_virtual(hostname, username, password, name,
|
|||
payload['vlans-disabled'] = True
|
||||
elif vlans_setting == 'enabled':
|
||||
payload['vlans-enabled'] = True
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return 'Error: Unable to Parse vlans option: \n\tvlans={vlans}'.format(vlans=vlans)
|
||||
|
||||
#determine state
|
||||
|
|
|
@ -61,7 +61,7 @@ def version():
|
|||
pybluez_version = '<= 0.18 (Unknown, but installed)'
|
||||
try:
|
||||
pybluez_version = bluetooth.__version__
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
pass
|
||||
return {'Bluez': bluez_version, 'PyBluez': pybluez_version}
|
||||
|
||||
|
@ -250,7 +250,7 @@ def pair(address, key):
|
|||
|
||||
try:
|
||||
int(key)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
'bluetooth.pair requires a numerical key to be used'
|
||||
)
|
||||
|
|
|
@ -126,7 +126,7 @@ def _delete_resource(name, name_param, desc, res_type, wait=0, status_param=None
|
|||
'''
|
||||
try:
|
||||
wait = int(wait)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise SaltInvocationError("Bad value ('{0}') passed for 'wait' param - must be an "
|
||||
"int or boolean.".format(wait))
|
||||
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
|
||||
|
@ -178,7 +178,7 @@ def _create_resource(name, name_param=None, desc=None, res_type=None, wait=0, st
|
|||
**args):
|
||||
try:
|
||||
wait = int(wait)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise SaltInvocationError("Bad value ('{0}') passed for 'wait' param - must be an "
|
||||
"int or boolean.".format(wait))
|
||||
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
|
||||
|
@ -231,7 +231,7 @@ def _modify_resource(name, name_param=None, desc=None, res_type=None, wait=0, st
|
|||
**args):
|
||||
try:
|
||||
wait = int(wait)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise SaltInvocationError("Bad value ('{0}') passed for 'wait' param - must be an "
|
||||
"int or boolean.".format(wait))
|
||||
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
|
||||
|
|
|
@ -747,7 +747,7 @@ def aws_encode(x):
|
|||
_hexReplace, x.encode('unicode_escape'))
|
||||
except UnicodeEncodeError:
|
||||
ret = x.encode('idna')
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error("Couldn't encode %s using either 'unicode_escape' or 'idna' codecs", x)
|
||||
raise CommandExecutionError(e)
|
||||
log.debug('AWS-encoded result for %s: %s', x, ret)
|
||||
|
|
|
@ -1635,7 +1635,7 @@ def _update_usage_plan_apis(plan_id, apis, op, region=None, key=None, keyid=None
|
|||
return {'success': True, 'result': res}
|
||||
except ClientError as e:
|
||||
return {'error': __utils__['boto3.get_error'](e)}
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
return {'error': e}
|
||||
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ def unsubscribe(topic, subscription_arn, region=None, key=None, keyid=None, prof
|
|||
try:
|
||||
conn.unsubscribe(subscription_arn)
|
||||
log.info('Unsubscribe %s to %s topic', subscription_arn, topic)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.error('Unsubscribe Error', exc_info=True)
|
||||
return False
|
||||
else:
|
||||
|
|
|
@ -398,7 +398,7 @@ def find_interfaces(*args):
|
|||
try: # a bridge may not contain interfaces
|
||||
if iface in brs[br]['interfaces']:
|
||||
iflist[iface] = br
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
return iflist
|
||||
|
|
|
@ -658,7 +658,7 @@ def properties(obj, type=None, set=None):
|
|||
for keyset in set.split(",")]:
|
||||
cmd.append(key)
|
||||
cmd.append(value)
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(ex)
|
||||
|
||||
out = __salt__['cmd.run_all'](' '.join(cmd))
|
||||
|
|
|
@ -196,6 +196,6 @@ def column_family_definition(keyspace, column_family):
|
|||
|
||||
try:
|
||||
return vars(sys.get_keyspace_column_families(keyspace)[column_family])
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.debug('Invalid Keyspace/CF combination')
|
||||
return None
|
||||
|
|
|
@ -117,7 +117,7 @@ def update_job(name, config):
|
|||
)
|
||||
log.debug('update response: %s', response)
|
||||
return {'success': True}
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
log.error('unable to update chronos job: %s', get_error_message(ex))
|
||||
return {
|
||||
'exception': {
|
||||
|
|
|
@ -274,7 +274,7 @@ def get_hostname():
|
|||
|
||||
try:
|
||||
return ret['outConfigs']['mgmtIf'][0]['hostname']
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
return "Unable to retrieve hostname"
|
||||
|
||||
|
||||
|
@ -658,7 +658,7 @@ def set_hostname(hostname=None):
|
|||
return True
|
||||
else:
|
||||
return False
|
||||
except Exception as err:
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -3622,7 +3622,7 @@ def powershell(cmd,
|
|||
|
||||
try:
|
||||
return salt.utils.json.loads(response)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error("Error converting PowerShell JSON return", exc_info=True)
|
||||
return {}
|
||||
|
||||
|
@ -3947,7 +3947,7 @@ def powershell_all(cmd,
|
|||
# If we fail to parse stdoutput we will raise an exception
|
||||
try:
|
||||
result = salt.utils.json.loads(stdoutput)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
err_msg = "cmd.powershell_all " + \
|
||||
"cannot parse the Powershell output."
|
||||
response["cmd"] = cmd
|
||||
|
|
|
@ -91,7 +91,7 @@ def a2ensite(site):
|
|||
|
||||
try:
|
||||
status = __salt__['cmd.retcode'](command, python_shell=False)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
return e
|
||||
|
||||
ret['Name'] = 'Apache2 Enable Site'
|
||||
|
@ -125,7 +125,7 @@ def a2dissite(site):
|
|||
|
||||
try:
|
||||
status = __salt__['cmd.retcode'](command, python_shell=False)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
return e
|
||||
|
||||
ret['Name'] = 'Apache2 Disable Site'
|
||||
|
@ -181,7 +181,7 @@ def a2enmod(mod):
|
|||
|
||||
try:
|
||||
status = __salt__['cmd.retcode'](command, python_shell=False)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
return e
|
||||
|
||||
ret['Name'] = 'Apache2 Enable Mod'
|
||||
|
@ -215,7 +215,7 @@ def a2dismod(mod):
|
|||
|
||||
try:
|
||||
status = __salt__['cmd.retcode'](command, python_shell=False)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
return e
|
||||
|
||||
ret['Name'] = 'Apache2 Disable Mod'
|
||||
|
@ -275,7 +275,7 @@ def a2enconf(conf):
|
|||
|
||||
try:
|
||||
status = __salt__['cmd.retcode'](command, python_shell=False)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
return e
|
||||
|
||||
ret['Name'] = 'Apache2 Enable Conf'
|
||||
|
@ -312,7 +312,7 @@ def a2disconf(conf):
|
|||
|
||||
try:
|
||||
status = __salt__['cmd.retcode'](command, python_shell=False)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
return e
|
||||
|
||||
ret['Name'] = 'Apache2 Disable Conf'
|
||||
|
|
|
@ -513,7 +513,7 @@ def build(runas,
|
|||
dsc_dir = tempfile.mkdtemp()
|
||||
try:
|
||||
dscs = make_src_pkg(dsc_dir, spec, sources, env, saltenv, runas)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
shutil.rmtree(dsc_dir)
|
||||
log.error('Failed to make src package, exception \'{0}\''.format(exc))
|
||||
return ret
|
||||
|
@ -575,7 +575,7 @@ def build(runas,
|
|||
shutil.copy(full, bdist)
|
||||
ret.setdefault('Packages', []).append(bdist)
|
||||
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error('Error building from \'{0}\', execption \'{1}\''.format(dsc, exc))
|
||||
|
||||
# remove any Packages file created for local dependency processing
|
||||
|
|
|
@ -618,7 +618,7 @@ def hdparms(disks, args=None):
|
|||
try:
|
||||
val = int(val)
|
||||
rvals.append(val)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
if '=' in val:
|
||||
deep_key, val = val.split('=', 1)
|
||||
deep_key = deep_key.strip()
|
||||
|
@ -685,7 +685,7 @@ def hpa(disks, size=None):
|
|||
for disk, data in hpa_data.items():
|
||||
try:
|
||||
size = data['total'] - int(size)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
if '%' in size:
|
||||
size = int(size.strip('%'))
|
||||
size = (100 - size) * data['total']
|
||||
|
@ -750,17 +750,17 @@ def smart_attributes(dev, attributes=None, values=None):
|
|||
data = dict(zip(fields, line[1:]))
|
||||
try:
|
||||
del data['_']
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
for field in data:
|
||||
val = data[field]
|
||||
try:
|
||||
val = int(val)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
val = [int(value) for value in val.split(' ')]
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
data[field] = val
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ def parse_hosts(hostsfile='/etc/hosts', hosts=None):
|
|||
try:
|
||||
with salt.utils.files.fopen(hostsfile, 'r') as fp_:
|
||||
hosts = salt.utils.stringutils.to_unicode(fp_.read())
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return 'Error: hosts data was not found'
|
||||
|
||||
hostsdict = {}
|
||||
|
@ -133,7 +133,7 @@ def parse_zone(zonefile=None, zone=None):
|
|||
try:
|
||||
with salt.utils.files.fopen(zonefile, 'r') as fp_:
|
||||
zone = salt.utils.stringutils.to_unicode(fp_.read())
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
if not zone:
|
||||
|
|
|
@ -341,7 +341,7 @@ def __load_project_from_file_path(file_path):
|
|||
try:
|
||||
project = get_project(project_dir=os.path.dirname(file_path),
|
||||
config_path=[os.path.basename(file_path)])
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return project
|
||||
|
||||
|
@ -519,7 +519,7 @@ def pull(path, service_names=None):
|
|||
else:
|
||||
try:
|
||||
project.pull(service_names)
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Pulling containers images via docker-compose succeeded',
|
||||
None, None)
|
||||
|
@ -553,7 +553,7 @@ def build(path, service_names=None):
|
|||
else:
|
||||
try:
|
||||
project.build(service_names)
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Building containers images via docker-compose succeeded',
|
||||
None, None)
|
||||
|
@ -592,7 +592,7 @@ def restart(path, service_names=None):
|
|||
container.inspect_if_not_inspected()
|
||||
debug_ret[container.get('Name')] = container.inspect()
|
||||
result[container.get('Name')] = 'restarted'
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Restarting containers via docker-compose', result, debug_ret)
|
||||
|
||||
|
@ -629,7 +629,7 @@ def stop(path, service_names=None):
|
|||
container.inspect_if_not_inspected()
|
||||
debug_ret[container.get('Name')] = container.inspect()
|
||||
result[container.get('Name')] = 'stopped'
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Stopping containers via docker-compose', result, debug_ret)
|
||||
|
||||
|
@ -666,7 +666,7 @@ def pause(path, service_names=None):
|
|||
container.inspect_if_not_inspected()
|
||||
debug_ret[container.get('Name')] = container.inspect()
|
||||
result[container.get('Name')] = 'paused'
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Pausing containers via docker-compose', result, debug_ret)
|
||||
|
||||
|
@ -703,7 +703,7 @@ def unpause(path, service_names=None):
|
|||
container.inspect_if_not_inspected()
|
||||
debug_ret[container.get('Name')] = container.inspect()
|
||||
result[container.get('Name')] = 'unpaused'
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Un-Pausing containers via docker-compose', result, debug_ret)
|
||||
|
||||
|
@ -740,7 +740,7 @@ def start(path, service_names=None):
|
|||
container.inspect_if_not_inspected()
|
||||
debug_ret[container.get('Name')] = container.inspect()
|
||||
result[container.get('Name')] = 'started'
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Starting containers via docker-compose', result, debug_ret)
|
||||
|
||||
|
@ -777,7 +777,7 @@ def kill(path, service_names=None):
|
|||
container.inspect_if_not_inspected()
|
||||
debug_ret[container.get('Name')] = container.inspect()
|
||||
result[container.get('Name')] = 'killed'
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Killing containers via docker-compose', result, debug_ret)
|
||||
|
||||
|
@ -806,7 +806,7 @@ def rm(path, service_names=None):
|
|||
else:
|
||||
try:
|
||||
project.remove_stopped(service_names)
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Removing stopped containers via docker-compose', None, None)
|
||||
|
||||
|
@ -886,7 +886,7 @@ def up(path, service_names=None):
|
|||
if service_names is None or container.get('Name')[1:] in service_names:
|
||||
container.inspect_if_not_inspected()
|
||||
debug_ret[container.get('Name')] = container.inspect()
|
||||
except Exception as inst:
|
||||
except Exception as inst: # pylint: disable=broad-except
|
||||
return __handle_except(inst)
|
||||
return __standardize_result(True, 'Adding containers via docker-compose', result, debug_ret)
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ def __virtual__():
|
|||
if HAS_DOCKER_PY:
|
||||
try:
|
||||
docker_py_versioninfo = _get_docker_py_versioninfo()
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# May fail if we try to connect to a docker daemon but can't
|
||||
return (False, 'Docker module found, but no version could be'
|
||||
' extracted')
|
||||
|
@ -316,7 +316,7 @@ def __virtual__():
|
|||
if docker_py_versioninfo >= MIN_DOCKER_PY:
|
||||
try:
|
||||
docker_versioninfo = version().get('VersionInfo')
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
docker_versioninfo = None
|
||||
|
||||
if docker_versioninfo is None or docker_versioninfo >= MIN_DOCKER:
|
||||
|
@ -395,7 +395,7 @@ def _get_client(timeout=NOTSET, **kwargs):
|
|||
ca_cert=docker_machine_tls['CaCertPath'],
|
||||
assert_hostname=False,
|
||||
verify=True)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
'Docker machine {0} failed: {1}'.format(docker_machine, exc))
|
||||
try:
|
||||
|
@ -632,7 +632,7 @@ def _size_fmt(num):
|
|||
if num < 1024.0:
|
||||
return '{0:3.1f} {1}'.format(num, unit)
|
||||
num /= 1024.0
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error('Unable to format file size for \'%s\'', num)
|
||||
return 'unknown'
|
||||
|
||||
|
@ -672,7 +672,7 @@ def _client_wrapper(attr, *args, **kwargs):
|
|||
except docker.errors.DockerException as exc:
|
||||
# More general docker exception (catches InvalidVersion, etc.)
|
||||
raise CommandExecutionError(exc.__str__())
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
err = exc.__str__()
|
||||
else:
|
||||
return ret
|
||||
|
@ -1103,7 +1103,7 @@ def compare_container_networks(first, second):
|
|||
for net_name in all_nets:
|
||||
try:
|
||||
connected_containers = inspect_network(net_name).get('Containers', {})
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
# Shouldn't happen unless a network was removed outside of Salt
|
||||
# between the time that a docker_container.running state started
|
||||
# and when this comparison took place.
|
||||
|
@ -2100,7 +2100,7 @@ def logs(name, **kwargs):
|
|||
if HAS_TIMELIB:
|
||||
try:
|
||||
kwargs['since'] = timelib.strtodatetime(kwargs['since'])
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.warning(
|
||||
'docker.logs: Failed to parse \'%s\' using timelib: %s',
|
||||
kwargs['since'], exc
|
||||
|
@ -3795,7 +3795,7 @@ def export(name,
|
|||
if data:
|
||||
out.write(data)
|
||||
out.flush()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
try:
|
||||
os.remove(path)
|
||||
except OSError:
|
||||
|
@ -4228,7 +4228,7 @@ def dangling(prune=False, force=False):
|
|||
for image in dangling_images:
|
||||
try:
|
||||
ret.setdefault(image, {})['Removed'] = rmi(image, force=force)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
err = exc.__str__()
|
||||
log.error(err)
|
||||
ret.setdefault(image, {})['Comment'] = err
|
||||
|
@ -4451,7 +4451,7 @@ def load(path, repository=None, tag=None):
|
|||
except IndexError:
|
||||
ret['Warning'] = ('No top-level image layers were loaded, no '
|
||||
'image was tagged')
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
ret['Warning'] = (
|
||||
'Failed to tag {0} as {1}: {2}'.format(
|
||||
top_level_images[0], tagged_image, exc
|
||||
|
@ -4564,7 +4564,7 @@ def pull(image,
|
|||
log.debug('pull event: %s', event)
|
||||
try:
|
||||
event = salt.utils.json.loads(event)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
'Unable to interpret API event: \'{0}\''.format(event),
|
||||
info={'Error': exc.__str__()}
|
||||
|
@ -4659,7 +4659,7 @@ def push(image,
|
|||
for event in response:
|
||||
try:
|
||||
event = salt.utils.json.loads(event)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
'Unable to interpret API event: \'{0}\''.format(event),
|
||||
info={'Error': exc.__str__()}
|
||||
|
@ -4931,7 +4931,7 @@ def save(name,
|
|||
if data:
|
||||
out.write(data)
|
||||
out.flush()
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
try:
|
||||
os.remove(path)
|
||||
except OSError:
|
||||
|
@ -5045,7 +5045,7 @@ def networks(names=None, ids=None):
|
|||
for idx, netinfo in enumerate(response):
|
||||
try:
|
||||
containers = inspect_network(netinfo['Id'])['Containers']
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
continue
|
||||
else:
|
||||
if containers:
|
||||
|
|
|
@ -80,7 +80,7 @@ def setval(key, val, false_unsets=False, permanent=False):
|
|||
if permanent and is_windows:
|
||||
__salt__['reg.delete_value'](permanent_hive, permanent_key, key)
|
||||
return None
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'{0}: Exception occurred when unsetting '
|
||||
'environ key \'{1}\': \'{2}\''
|
||||
|
@ -95,7 +95,7 @@ def setval(key, val, false_unsets=False, permanent=False):
|
|||
if permanent and is_windows:
|
||||
__salt__['reg.set_value'](permanent_hive, permanent_key, key, val)
|
||||
return os.environ[key]
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.error(
|
||||
'{0}: Exception occurred when setting'
|
||||
'environ key \'{1}\': \'{2}\''
|
||||
|
|
|
@ -79,7 +79,7 @@ def fire_master(data, tag, preload=None):
|
|||
# channel.send was successful.
|
||||
# Ensure ret is True.
|
||||
ret = True
|
||||
except Exception: # pylint: disable=bare-except
|
||||
except Exception: # pylint: disable=broad-except
|
||||
ret = False
|
||||
return ret
|
||||
else:
|
||||
|
@ -88,7 +88,7 @@ def fire_master(data, tag, preload=None):
|
|||
try:
|
||||
return salt.utils.event.MinionEvent(__opts__, listen=False).fire_event(
|
||||
{'data': data, 'tag': tag, 'events': None, 'pretag': None}, 'fire_master')
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||
log.debug(lines)
|
||||
|
@ -112,7 +112,7 @@ def fire(data, tag):
|
|||
opts=__opts__,
|
||||
listen=False) as event:
|
||||
return event.fire_event(data, tag)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||
log.debug(lines)
|
||||
|
|
|
@ -440,7 +440,7 @@ def set_mode(path, mode):
|
|||
raise CommandExecutionError('{0}: File not found'.format(path))
|
||||
try:
|
||||
os.chmod(path, int(mode, 8))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return 'Invalid Mode ' + mode
|
||||
return get_mode(path)
|
||||
|
||||
|
@ -1779,7 +1779,7 @@ def _regex_to_static(src, regex):
|
|||
try:
|
||||
compiled = re.compile(regex, re.DOTALL)
|
||||
src = [line for line in src if compiled.search(line) or line.count(regex)]
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
raise CommandExecutionError("{0}: '{1}'".format(_get_error_message(ex), regex))
|
||||
|
||||
return src and src or []
|
||||
|
@ -2465,7 +2465,7 @@ def replace(path,
|
|||
except OSError:
|
||||
os.remove(symlink_backup)
|
||||
os.symlink(target_backup, symlink_backup)
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
"Unable create backup symlink '{0}'. "
|
||||
"Target was '{1}'. "
|
||||
|
@ -2713,7 +2713,7 @@ def blockreplace(path,
|
|||
linesep = os.linesep
|
||||
try:
|
||||
fi_file.close()
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
||||
if in_block:
|
||||
|
@ -3536,7 +3536,7 @@ def lstat(path):
|
|||
lst = os.lstat(path)
|
||||
return dict((key, getattr(lst, key)) for key in ('st_atime', 'st_ctime',
|
||||
'st_gid', 'st_mode', 'st_mtime', 'st_nlink', 'st_size', 'st_uid'))
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return {}
|
||||
|
||||
|
||||
|
@ -4245,7 +4245,7 @@ def get_managed(
|
|||
source,
|
||||
saltenv,
|
||||
source_hash=source_sum.get('hsum'))
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
# A 404 or other error code may raise an exception, catch it
|
||||
# and return a comment that will fail the calling state.
|
||||
_source = salt.utils.url.redact_http_basic_auth(source)
|
||||
|
@ -4853,7 +4853,7 @@ def check_managed_changes(
|
|||
or source.startswith('/'):
|
||||
try:
|
||||
mode = __salt__['cp.stat_file'](source, saltenv=saltenv, octal=True)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.warning('Unable to stat %s: %s', sfn, exc)
|
||||
changes = check_file_meta(name, sfn, source, source_sum, user,
|
||||
group, mode, attrs, saltenv, contents)
|
||||
|
@ -5282,7 +5282,7 @@ def manage_file(name,
|
|||
if _urlparse(source).scheme in ('salt', 'file', ''):
|
||||
try:
|
||||
mode = __salt__['cp.stat_file'](source, saltenv=saltenv, octal=True)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
log.warning('Unable to stat %s: %s', sfn, exc)
|
||||
|
||||
# Check changes if the target file exists
|
||||
|
@ -6388,7 +6388,7 @@ def open_files(by_pid=False):
|
|||
|
||||
#try:
|
||||
# fd_.append(os.path.realpath('{0}/task/{1}exe'.format(ppath, tid)))
|
||||
#except Exception:
|
||||
#except Exception: # pylint: disable=broad-except
|
||||
# pass
|
||||
|
||||
for fpath in os.listdir('{0}/fd'.format(ppath)):
|
||||
|
|
|
@ -164,7 +164,7 @@ def _add_missing_repositories(frozen_repos, ret, **kwargs):
|
|||
__salt__['pkg.mod_repo'](repo, **_tmp_kwargs)
|
||||
ret['repos']['add'].append(repo)
|
||||
log.info('Added missing repository %s', repo)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
msg = 'Error adding %s repository: %s'
|
||||
log.error(msg, repo, e)
|
||||
ret['comment'].append(msg % (repo, e))
|
||||
|
@ -179,7 +179,7 @@ def _remove_extra_repositories(frozen_repos, ret, **kwargs):
|
|||
__salt__['pkg.del_repo'](repo, **kwargs)
|
||||
ret['repos']['remove'].append(repo)
|
||||
log.info('Removed extra repository %s', repo)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
msg = 'Error removing %s repository: %s'
|
||||
log.error(msg, repo, e)
|
||||
ret['comment'].append(msg % (repo, e))
|
||||
|
@ -197,7 +197,7 @@ def _add_missing_packages(frozen_pkgs, ret, **kwargs):
|
|||
__salt__['pkg.install'](name=pkg, **kwargs)
|
||||
ret['pkgs']['add'].append(pkg)
|
||||
log.info('Added missing package %s', pkg)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
msg = 'Error adding %s package: %s'
|
||||
log.error(msg, pkg, e)
|
||||
ret['comment'].append(msg % (pkg, e))
|
||||
|
@ -212,7 +212,7 @@ def _remove_extra_packages(frozen_pkgs, ret, **kwargs):
|
|||
__salt__['pkg.remove'](name=pkg, **kwargs)
|
||||
ret['pkgs']['remove'].append(pkg)
|
||||
log.info('Removed extra package %s', pkg)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
msg = 'Error removing %s package: %s'
|
||||
log.error(msg, pkg, e)
|
||||
ret['comment'].append(msg % (pkg, e))
|
||||
|
|
|
@ -155,7 +155,7 @@ def bootstrap(
|
|||
if not __salt__['file.directory_exists'](root):
|
||||
try:
|
||||
__salt__['file.mkdir'](root)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
return {'Error': salt.utils.stringutils.to_unicode(pprint.pformat(exc))}
|
||||
elif img_format == 'sparse':
|
||||
if not img_size:
|
||||
|
@ -623,7 +623,7 @@ def _tar(name, root, path=None, compress='bzip2'):
|
|||
if not __salt__['file.directory_exists'](path):
|
||||
try:
|
||||
__salt__['file.mkdir'](path)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
return {'Error': salt.utils.stringutils.to_unicode(pprint.pformat(exc))}
|
||||
|
||||
compression, ext = _compress(compress)
|
||||
|
@ -650,7 +650,7 @@ def _untar(name, dest=None, path=None, compress='bz2'):
|
|||
if not __salt__['file.directory_exists'](dest):
|
||||
try:
|
||||
__salt__['file.mkdir'](dest)
|
||||
except Exception as exc:
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
return {'Error': salt.utils.stringutils.to_unicode(pprint.pformat(exc))}
|
||||
|
||||
compression, ext = _compress(compress)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue