mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49606 from rallytime/merge-2018.3
[2018.3] Merge forward from 2017.7 to 2018.3
This commit is contained in:
commit
ab19082a7a
34 changed files with 102 additions and 100 deletions
|
@ -223,8 +223,8 @@ $MAKE install
|
|||
############################################################################
|
||||
echo -n -e "\033]0;Build_Env: OpenSSL: download\007"
|
||||
|
||||
PKGURL="http://openssl.org/source/openssl-1.0.2n.tar.gz"
|
||||
PKGDIR="openssl-1.0.2n"
|
||||
PKGURL="http://openssl.org/source/openssl-1.0.2p.tar.gz"
|
||||
PKGDIR="openssl-1.0.2p"
|
||||
|
||||
download $PKGURL
|
||||
|
||||
|
|
1
pkg/osx/shasums/openssl-1.0.2p.tar.gz.sha512
Normal file
1
pkg/osx/shasums/openssl-1.0.2p.tar.gz.sha512
Normal file
|
@ -0,0 +1 @@
|
|||
958c5a7c3324bbdc8f07dfb13e11329d9a1b4452c07cf41fbd2d42b5fe29c95679332a3476d24c2dc2b88be16e4a24744aba675a05a388c0905756c77a8a2f16 ./openssl-1.0.2p.tar.gz
|
|
@ -113,8 +113,14 @@ if not %errorLevel%==0 (
|
|||
:: Remove build and dist directories
|
||||
@echo %0 :: Remove build and dist directories...
|
||||
@echo ---------------------------------------------------------------------
|
||||
rd /s /q "%SrcDir%\build"
|
||||
rd /s /q "%SrcDir%\dist"
|
||||
"%PyDir%\python.exe" "%SrcDir%\setup.py" clean --all
|
||||
if not %errorLevel%==0 (
|
||||
goto eof
|
||||
)
|
||||
If Exist "%SrcDir%\dist" (
|
||||
@echo removing %SrcDir%\dist
|
||||
rd /S /Q "%SrcDir%\dist"
|
||||
)
|
||||
@echo.
|
||||
|
||||
:: Install Current Version of salt
|
||||
|
|
|
@ -658,8 +658,6 @@ def _get_properties(path="", method="GET", forced_params=None):
|
|||
props = sub['info'][method]['parameters']['properties'].keys()
|
||||
except KeyError as exc:
|
||||
log.error('method not found: "%s"', exc)
|
||||
except:
|
||||
raise
|
||||
for prop in props:
|
||||
numerical = re.match(r'(\w+)\[n\]', prop)
|
||||
# generate (arbitrarily) 10 properties for duplicatable properties identified by:
|
||||
|
|
|
@ -201,7 +201,7 @@ def v4_int_to_packed(address):
|
|||
"""
|
||||
try:
|
||||
return _int_to_bytes(address, 4, 'big')
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
raise ValueError("Address negative or too large for IPv6")
|
||||
|
||||
|
||||
|
|
|
@ -3332,11 +3332,11 @@ class Matcher(object):
|
|||
try:
|
||||
# Target is an address?
|
||||
tgt = ipaddress.ip_address(tgt)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
try:
|
||||
# Target is a network?
|
||||
tgt = ipaddress.ip_network(tgt)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
log.error('Invalid IP/CIDR target: %s', tgt)
|
||||
return []
|
||||
proto = 'ipv{0}'.format(tgt.version)
|
||||
|
|
|
@ -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: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
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: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
pass
|
||||
result['bdev'] = _bdev(dev)
|
||||
|
||||
|
@ -604,10 +604,10 @@ def super_(dev):
|
|||
|
||||
try:
|
||||
rval = int(rval)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
try:
|
||||
rval = float(rval)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
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: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
try:
|
||||
val = float(val)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
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: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ def _delete_resource(name, name_param, desc, res_type, wait=0, status_param=None
|
|||
'''
|
||||
try:
|
||||
wait = int(wait)
|
||||
except:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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:
|
||||
except Exception:
|
||||
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)
|
||||
|
|
|
@ -594,7 +594,7 @@ def hdparms(disks, args=None):
|
|||
try:
|
||||
val = int(val)
|
||||
rvals.append(val)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
if '=' in val:
|
||||
deep_key, val = val.split('=', 1)
|
||||
deep_key = deep_key.strip()
|
||||
|
@ -661,7 +661,7 @@ def hpa(disks, size=None):
|
|||
for disk, data in hpa_data.items():
|
||||
try:
|
||||
size = data['total'] - int(size)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
if '%' in size:
|
||||
size = int(size.strip('%'))
|
||||
size = (100 - size) * data['total']
|
||||
|
@ -726,17 +726,17 @@ def smart_attributes(dev, attributes=None, values=None):
|
|||
data = dict(zip(fields, line[1:]))
|
||||
try:
|
||||
del data['_']
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
for field in data:
|
||||
val = data[field]
|
||||
try:
|
||||
val = int(val)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
try:
|
||||
val = [int(value) for value in val.split(' ')]
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
pass
|
||||
data[field] = val
|
||||
|
||||
|
|
|
@ -2404,7 +2404,7 @@ def replace(path,
|
|||
except OSError:
|
||||
os.remove(symlink_backup)
|
||||
os.symlink(target_backup, symlink_backup)
|
||||
except:
|
||||
except Exception:
|
||||
raise CommandExecutionError(
|
||||
"Unable create backup symlink '{0}'. "
|
||||
"Target was '{1}'. "
|
||||
|
@ -6286,7 +6286,7 @@ def open_files(by_pid=False):
|
|||
|
||||
#try:
|
||||
# fd_.append(os.path.realpath('{0}/task/{1}exe'.format(ppath, tid)))
|
||||
#except:
|
||||
#except Exception:
|
||||
# pass
|
||||
|
||||
for fpath in os.listdir('{0}/fd'.format(ppath)):
|
||||
|
|
|
@ -271,8 +271,7 @@ def _dmi_cast(key, val, clean=True):
|
|||
else:
|
||||
try:
|
||||
val = int(val)
|
||||
# pylint: disable=bare-except
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return val
|
||||
|
|
|
@ -70,7 +70,7 @@ def write(key, value):
|
|||
salt.utils.stringutils.to_str('{0}\n'.format(value))
|
||||
)
|
||||
return True
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
|
@ -129,13 +129,13 @@ def read(key, root=''):
|
|||
return False
|
||||
try:
|
||||
val = int(val)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
try:
|
||||
val = float(val)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
pass
|
||||
return val
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ from datetime import datetime
|
|||
|
||||
try:
|
||||
from shlex import quote as _cmd_quote # pylint: disable=E0611
|
||||
except: # pylint: disable=W0702
|
||||
except Exception:
|
||||
from pipes import quote as _cmd_quote
|
||||
|
||||
# Import Salt libs
|
||||
|
|
|
@ -123,7 +123,7 @@ def start():
|
|||
backlog=mod_opts.get('backlog', 128),
|
||||
)
|
||||
http_server.start(mod_opts['num_processes'])
|
||||
except:
|
||||
except Exception:
|
||||
log.error('Rest_tornado unable to bind to port %s', mod_opts['port'], exc_info=True)
|
||||
raise SystemExit(1)
|
||||
|
||||
|
|
|
@ -185,9 +185,8 @@ a return like::
|
|||
.. |406| replace:: requested Content-Type not available
|
||||
.. |500| replace:: internal server error
|
||||
'''
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import time
|
||||
import fnmatch
|
||||
import logging
|
||||
|
@ -616,7 +615,7 @@ class SaltAuthHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
'''
|
||||
def get(self):
|
||||
'''
|
||||
All logins are done over post, this is a parked enpoint
|
||||
All logins are done over post, this is a parked endpoint
|
||||
|
||||
.. http:get:: /login
|
||||
|
||||
|
@ -629,7 +628,7 @@ class SaltAuthHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
curl -i localhost:8000/login
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
GET /login HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -637,7 +636,7 @@ class SaltAuthHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 401 Unauthorized
|
||||
Content-Type: application/json
|
||||
|
@ -656,7 +655,7 @@ class SaltAuthHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
# TODO: make asynchronous? Underlying library isn't... and we ARE making disk calls :(
|
||||
def post(self):
|
||||
'''
|
||||
:ref:`Authenticate <rest_tornado-auth>` against Salt's eauth system
|
||||
:ref:`Authenticate <rest_tornado-auth>` against Salt's eauth system
|
||||
|
||||
.. http:post:: /login
|
||||
|
||||
|
@ -684,7 +683,7 @@ class SaltAuthHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
-d password='saltpass' \\
|
||||
-d eauth='pam'
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
POST / HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -696,7 +695,7 @@ class SaltAuthHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
@ -777,7 +776,7 @@ class SaltAPIHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
'''
|
||||
def get(self):
|
||||
'''
|
||||
An enpoint to determine salt-api capabilities
|
||||
An endpoint to determine salt-api capabilities
|
||||
|
||||
.. http:get:: /
|
||||
|
||||
|
@ -793,7 +792,7 @@ class SaltAPIHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
curl -i localhost:8000
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
GET / HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -801,7 +800,7 @@ class SaltAPIHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
@ -845,7 +844,7 @@ class SaltAPIHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
-d fun='test.ping' \\
|
||||
-d arg
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
POST / HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -857,11 +856,12 @@ class SaltAPIHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
fun=test.ping&arg&client=local&tgt=*
|
||||
|
||||
**Example response:**
|
||||
|
||||
Responses are an in-order list of the lowstate's return data. In the
|
||||
event of an exception running a command the return will be a string
|
||||
instead of a mapping.
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 200
|
||||
|
@ -876,10 +876,11 @@ class SaltAPIHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
ms-4: true
|
||||
|
||||
.. admonition:: multiple commands
|
||||
|
||||
Note that if multiple :term:`lowstate` structures are sent, the Salt
|
||||
API will execute them in serial, and will not stop execution upon failure
|
||||
of a previous job. If you need to have commands executed in order and
|
||||
stop on failure please use compount-command-execution.
|
||||
stop on failure please use compound-command-execution.
|
||||
|
||||
'''
|
||||
# if you aren't authenticated, redirect to login
|
||||
|
@ -977,7 +978,8 @@ class SaltAPIHandler(BaseSaltAPIHandler): # pylint: disable=W0223
|
|||
is_finished)
|
||||
|
||||
def more_todo():
|
||||
'''Check if there are any more minions we are waiting on returns from
|
||||
'''
|
||||
Check if there are any more minions we are waiting on returns from
|
||||
'''
|
||||
return any(x is False for x in six.itervalues(minions))
|
||||
|
||||
|
@ -1144,7 +1146,7 @@ class MinionSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
curl -i localhost:8000/minions/ms-3
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
GET /minions/ms-3 HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -1152,7 +1154,7 @@ class MinionSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 129005
|
||||
|
@ -1205,7 +1207,7 @@ class MinionSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
-d tgt='*' \\
|
||||
-d fun='status.diskusage'
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
POST /minions HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -1217,7 +1219,7 @@ class MinionSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 202 Accepted
|
||||
Content-Length: 86
|
||||
|
@ -1272,7 +1274,7 @@ class JobsSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
curl -i localhost:8000/jobs
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
GET /jobs HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -1280,7 +1282,7 @@ class JobsSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 165
|
||||
|
@ -1301,7 +1303,7 @@ class JobsSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
curl -i localhost:8000/jobs/20121130104633606931
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
GET /jobs/20121130104633606931 HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -1309,7 +1311,7 @@ class JobsSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 73
|
||||
|
@ -1390,7 +1392,7 @@ class RunSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
-d password='saltdev' \\
|
||||
-d eauth='pam'
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
POST /run HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -1402,7 +1404,7 @@ class RunSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 73
|
||||
|
@ -1449,14 +1451,14 @@ class EventsSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
curl -NsS localhost:8000/events
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
GET /events HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
||||
**Example response:**
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Connection: keep-alive
|
||||
|
@ -1604,7 +1606,7 @@ class WebhookSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
curl -sS localhost:8000/hook -d foo='Foo!' -d bar='Bar!'
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
POST /hook HTTP/1.1
|
||||
Host: localhost:8000
|
||||
|
@ -1615,7 +1617,7 @@ class WebhookSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
**Example response**:
|
||||
|
||||
.. code-block:: http
|
||||
.. code-block:: text
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 14
|
||||
|
@ -1628,7 +1630,9 @@ class WebhookSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
``http://localhost:8000/hook/mycompany/build/success`` which contains
|
||||
the result of a build and the SHA of the version that was built as
|
||||
JSON. That would then produce the following event in Salt that could be
|
||||
used to kick off a deployment via Salt's Reactor::
|
||||
used to kick off a deployment via Salt's Reactor:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
Event fired at Fri Feb 14 17:40:11 2014
|
||||
*************************
|
||||
|
@ -1653,7 +1657,7 @@ class WebhookSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
And finally deploy the new build:
|
||||
|
||||
.. code-block:: yaml
|
||||
.. code-block:: jinja
|
||||
|
||||
{% set secret_key = data.get('headers', {}).get('X-My-Secret-Key') %}
|
||||
{% set build = data.get('post', {}) %}
|
||||
|
@ -1708,9 +1712,9 @@ class WebhookSaltAPIHandler(SaltAPIHandler): # pylint: disable=W0223
|
|||
|
||||
|
||||
def _check_cors_origin(origin, allowed_origins):
|
||||
"""
|
||||
'''
|
||||
Check if an origin match cors allowed origins
|
||||
"""
|
||||
'''
|
||||
if isinstance(allowed_origins, list):
|
||||
if origin in allowed_origins:
|
||||
return origin
|
||||
|
|
|
@ -178,7 +178,7 @@ class AsyncRemotePillar(RemotePillarMixin):
|
|||
load,
|
||||
dictkey='pillar',
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Exception getting pillar:')
|
||||
raise SaltClientError('Exception getting pillar.')
|
||||
|
||||
|
|
|
@ -189,8 +189,6 @@ def ext_pillar(minion_id,
|
|||
except boto.exception.AWSConnectionError as exc:
|
||||
log.error('%s: invalid AWS credentials, %s', __name__, exc)
|
||||
return {}
|
||||
except:
|
||||
raise
|
||||
|
||||
if conn is None:
|
||||
log.error('%s: Could not connect to region %s', __name__, region)
|
||||
|
|
|
@ -515,7 +515,7 @@ def save_reg(data):
|
|||
try:
|
||||
with salt.utils.files.fopen(regfile, 'a') as fh_:
|
||||
msgpack.dump(data, fh_)
|
||||
except:
|
||||
except Exception:
|
||||
log.error('Could not write to msgpack file %s', __opts__['outdir'])
|
||||
raise
|
||||
|
||||
|
@ -529,6 +529,6 @@ def load_reg():
|
|||
try:
|
||||
with salt.utils.files.fopen(regfile, 'r') as fh_:
|
||||
return msgpack.load(fh_)
|
||||
except:
|
||||
except Exception:
|
||||
log.error('Could not write to msgpack file %s', __opts__['outdir'])
|
||||
raise
|
||||
|
|
|
@ -326,7 +326,7 @@ def save_load(jid, load, minions=None):
|
|||
cur.execute(sql, (jid, salt.utils.json.dumps(load)))
|
||||
except MySQLdb.IntegrityError:
|
||||
# https://github.com/saltstack/salt/issues/22171
|
||||
# Without this try:except: we get tons of duplicate entry errors
|
||||
# Without this try/except we get tons of duplicate entry errors
|
||||
# which result in job returns not being stored properly
|
||||
pass
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ def save_load(jid, load, minions=None):
|
|||
cur.execute(sql, (jid, psycopg2.extras.Json(load)))
|
||||
except psycopg2.IntegrityError:
|
||||
# https://github.com/saltstack/salt/issues/22171
|
||||
# Without this try:except: we get tons of duplicate entry errors
|
||||
# Without this try/except we get tons of duplicate entry errors
|
||||
# which result in job returns not being stored properly
|
||||
pass
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ def save_load(jid, load, minions=None): # pylint: disable=unused-argument
|
|||
salt.utils.json.dumps(load)))
|
||||
except psycopg2.IntegrityError:
|
||||
# https://github.com/saltstack/salt/issues/22171
|
||||
# Without this try:except: we get tons of duplicate entry errors
|
||||
# Without this try/except we get tons of duplicate entry errors
|
||||
# which result in job returns not being stored properly
|
||||
pass
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ def returner(ret):
|
|||
with salt.utils.files.flopen(opts['filename'], 'a') as logfile:
|
||||
salt.utils.json.dump(ret, logfile)
|
||||
logfile.write(str('\n')) # future lint: disable=blacklisted-function
|
||||
except:
|
||||
except Exception:
|
||||
log.error('Could not write to rawdata_json file %s', opts['filename'])
|
||||
raise
|
||||
|
||||
|
@ -79,6 +79,6 @@ def event_return(events):
|
|||
for event in events:
|
||||
salt.utils.json.dump(event, logfile)
|
||||
logfile.write(str('\n')) # future lint: disable=blacklisted-function
|
||||
except:
|
||||
except Exception:
|
||||
log.error('Could not write to rawdata_json file %s', opts['filename'])
|
||||
raise
|
||||
|
|
|
@ -271,7 +271,7 @@ class Loader(BaseLoader): # pylint: disable=W0232
|
|||
def construct_sls_aggregate(self, node):
|
||||
try:
|
||||
tag, deep = self.resolve_sls_tag(node)
|
||||
except:
|
||||
except Exception:
|
||||
raise ConstructorError('unable to build reset')
|
||||
|
||||
node = copy.copy(node)
|
||||
|
@ -288,7 +288,7 @@ class Loader(BaseLoader): # pylint: disable=W0232
|
|||
def construct_sls_reset(self, node):
|
||||
try:
|
||||
tag, deep = self.resolve_sls_tag(node)
|
||||
except:
|
||||
except Exception:
|
||||
raise ConstructorError('unable to build reset')
|
||||
|
||||
node = copy.copy(node)
|
||||
|
|
|
@ -77,7 +77,7 @@ def cert(name,
|
|||
window = None
|
||||
try:
|
||||
window = int(renew)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
comment = 'Certificate {0} '.format(name)
|
||||
|
|
|
@ -803,7 +803,7 @@ class _Swagger(object):
|
|||
method='')
|
||||
self._lambda_funcname_format.format(**known_kwargs)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
raise ValueError('Invalid lambda_funcname_format {0}. Please review '
|
||||
'documentation for known substitutable keys'.format(self._lambda_funcname_format))
|
||||
|
||||
|
|
|
@ -49,11 +49,9 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
import logging
|
||||
|
||||
try:
|
||||
HAS_VARSTACK = False
|
||||
import varstack
|
||||
HAS_VARSTACK = True
|
||||
except ImportError:
|
||||
pass
|
||||
varstack = None
|
||||
|
||||
# Set up logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -63,10 +61,7 @@ __virtualname__ = 'varstack'
|
|||
|
||||
|
||||
def __virtual__():
|
||||
if not HAS_VARSTACK:
|
||||
log.error("Can't find varstack master_top")
|
||||
return False
|
||||
return __virtualname__
|
||||
return (False, 'varstack not installed') if varstack is None else __virtualname__
|
||||
|
||||
|
||||
def top(**kwargs):
|
||||
|
|
|
@ -881,7 +881,7 @@ class SaltEvent(object):
|
|||
# shutdown-- where globals start going missing
|
||||
try:
|
||||
self.destroy()
|
||||
except: # pylint: disable=W0702
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -387,11 +387,11 @@ class CkMinions(object):
|
|||
try:
|
||||
# Target is an address?
|
||||
tgt = ipaddress.ip_address(tgt)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
try:
|
||||
# Target is a network?
|
||||
tgt = ipaddress.ip_network(tgt)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
log.error('Invalid IP/CIDR target: %s', tgt)
|
||||
return {'minions': [],
|
||||
'missing': []}
|
||||
|
|
|
@ -1349,7 +1349,7 @@ def mac2eui64(mac, prefix=None):
|
|||
net = ipaddress.ip_network(prefix, strict=False)
|
||||
euil = int('0x{0}'.format(eui64), 16)
|
||||
return '{0}/{1}'.format(net[euil], net.prefixlen)
|
||||
except: # pylint: disable=bare-except
|
||||
except Exception:
|
||||
return
|
||||
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ def render_mako_tmpl(tmplstr, context, tmplpath=None):
|
|||
uri=context['sls'].replace('.', '/') if 'sls' in context else None,
|
||||
lookup=lookup
|
||||
).render(**context)
|
||||
except:
|
||||
except Exception:
|
||||
raise SaltRenderError(mako.exceptions.text_error_template().render())
|
||||
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ class Terminal(object):
|
|||
if tty_fd >= 0:
|
||||
os.close(tty_fd)
|
||||
# which exception, shouldn't we catch explicitly .. ?
|
||||
except: # pylint: disable=W0702
|
||||
except Exception:
|
||||
# Already disconnected. This happens if running inside cron
|
||||
pass
|
||||
|
||||
|
@ -520,7 +520,7 @@ class Terminal(object):
|
|||
'still possible to open /dev/tty.'
|
||||
)
|
||||
# which exception, shouldn't we catch explicitly .. ?
|
||||
except: # pylint: disable=W0702
|
||||
except Exception:
|
||||
# Good! We are disconnected from a controlling tty.
|
||||
pass
|
||||
|
||||
|
|
|
@ -697,7 +697,8 @@ class GitModuleTest(ModuleCase):
|
|||
second_rev = self.run_function(
|
||||
'git.revision',
|
||||
[self.repo],
|
||||
rev=self.branches[1]
|
||||
rev=self.branches[1],
|
||||
timeout=120
|
||||
)
|
||||
# Make sure revision is a 40-char string
|
||||
self.assertTrue(len(second_rev) == 40)
|
||||
|
|
|
@ -102,7 +102,7 @@ class UseraddModuleTestLinux(ModuleCase):
|
|||
uid_info = self.run_function('user.info', [name])
|
||||
self.assertIn(primary_group, uid_info['groups'])
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
self.run_function('user.delete', [name])
|
||||
raise
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ class JSONTestCase(TestCase):
|
|||
Test dumping to and loading from a file handle
|
||||
'''
|
||||
with salt.utils.files.fopen(json_out, 'wb') as fp_:
|
||||
fp_.write(salt.utils.to_bytes(salt.utils.json.dumps(self.data)))
|
||||
fp_.write(salt.utils.stringutils.to_bytes(salt.utils.json.dumps(self.data)))
|
||||
with salt.utils.files.fopen(json_out, 'rb') as fp_:
|
||||
ret = salt.utils.json.loads(salt.utils.to_unicode(fp_.read()))
|
||||
ret = salt.utils.json.loads(salt.utils.stringutils.to_unicode(fp_.read()))
|
||||
# Loading should be equal to the original data
|
||||
self.assertEqual(ret, self.data)
|
||||
|
|
Loading…
Add table
Reference in a new issue