mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #40932 from rallytime/merge-nitrogen
[nitrogen] Merge forward from 2016.11 to nitrogen
This commit is contained in:
commit
abb42d1de3
@ -3838,6 +3838,8 @@ def get_managed(
|
||||
source_sum = {'hsum': cached_sum, 'hash_type': htype}
|
||||
elif cached_sum != source_sum.get('hsum', __opts__['hash_type']):
|
||||
cache_refetch = True
|
||||
else:
|
||||
sfn = cached_dest
|
||||
|
||||
# If we didn't have the template or remote file, let's get it
|
||||
# Similarly when the file has been updated and the cache has to be refreshed
|
||||
|
@ -74,6 +74,7 @@ class RunnerClient(mixins.SyncClientMixin, mixins.AsyncClientMixin, object):
|
||||
|
||||
reserved_kwargs = dict([(i, low.pop(i)) for i in [
|
||||
'username', 'password', 'eauth', 'token', 'client', 'user', 'key',
|
||||
'__current_eauth_groups', '__current_eauth_user',
|
||||
] if i in low])
|
||||
|
||||
# Run name=value args through parse_input. We don't need to run kwargs
|
||||
|
@ -62,7 +62,7 @@ def query(name, match=None, match_type='string', status=None, wait_for=None, **k
|
||||
query_example:
|
||||
http.query:
|
||||
- name: 'http://example.com/'
|
||||
- status: '200'
|
||||
- status: 200
|
||||
|
||||
'''
|
||||
# Monitoring state, but changes may be made over HTTP
|
||||
|
@ -62,11 +62,16 @@ def _get_changes(rsync_out):
|
||||
else:
|
||||
copied.append(line)
|
||||
|
||||
return {
|
||||
ret = {
|
||||
'copied': os.linesep.join(sorted(copied)) or "N/A",
|
||||
'deleted': os.linesep.join(sorted(deleted)) or "N/A",
|
||||
}
|
||||
|
||||
# Return whether anything really changed
|
||||
ret['changed'] = not ((ret['copied'] == 'N/A') and (ret['deleted'] == 'N/A'))
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def synchronized(name, source,
|
||||
delete=False,
|
||||
@ -135,12 +140,18 @@ def synchronized(name, source,
|
||||
ret['comment'] = _get_summary(result['stdout'])
|
||||
return ret
|
||||
|
||||
# Failed
|
||||
if result.get('retcode'):
|
||||
ret['result'] = False
|
||||
ret['comment'] = result['stderr']
|
||||
ret['changes'] = result['stdout']
|
||||
else:
|
||||
# Changed
|
||||
elif _get_changes(result['stdout'])['changed']:
|
||||
ret['comment'] = _get_summary(result['stdout'])
|
||||
ret['changes'] = _get_changes(result['stdout'])
|
||||
|
||||
del ret['changes']['changed'] # Don't need to print the boolean
|
||||
# Clean
|
||||
else:
|
||||
ret['comment'] = _get_summary(result['stdout'])
|
||||
ret['changes'] = {}
|
||||
return ret
|
||||
|
@ -407,7 +407,7 @@ def table_present(name, db, schema, force=False):
|
||||
if len(tables) == 1:
|
||||
sql = None
|
||||
if isinstance(schema, str):
|
||||
sql = schema
|
||||
sql = schema.strip()
|
||||
else:
|
||||
sql = _get_sql_from_schema(name, schema)
|
||||
|
||||
|
@ -745,7 +745,14 @@ class TCPClientKeepAlive(tornado.tcpclient.TCPClient):
|
||||
super(TCPClientKeepAlive, self).__init__(
|
||||
resolver=resolver, io_loop=io_loop)
|
||||
|
||||
def _create_stream(self, max_buffer_size, af, addr):
|
||||
def _create_stream(self, max_buffer_size, af, addr, **kwargs): # pylint: disable=unused-argument
|
||||
'''
|
||||
Override _create_stream() in TCPClient.
|
||||
|
||||
Tornado 4.5 added the kwargs 'source_ip' and 'source_port'.
|
||||
Due to this, use **kwargs to swallow these and any future
|
||||
kwargs to maintain compatibility.
|
||||
'''
|
||||
# Always connect in plaintext; we'll convert to ssl if necessary
|
||||
# after one connection has completed.
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
Loading…
Reference in New Issue
Block a user