From 72bf5af9e63920cbee3caff8c4a50c193b63acdd Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Tue, 18 Apr 2017 10:54:48 -0400 Subject: [PATCH 1/9] Set sfn if cached_sum == source_sum --- salt/modules/file.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/salt/modules/file.py b/salt/modules/file.py index 1dcde9bd24..52cc78a152 100644 --- a/salt/modules/file.py +++ b/salt/modules/file.py @@ -3793,6 +3793,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 From ea4592de91dd6b0eff0345f6da6b10788ae96153 Mon Sep 17 00:00:00 2001 From: Nathan Fish Date: Fri, 21 Apr 2017 11:27:54 -0400 Subject: [PATCH 2/9] rsync.py: Don't return changes when clean No longer returns changes when they are "N/A" Fixes https://github.com/saltstack/salt/issues/37714 --- salt/states/rsync.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/salt/states/rsync.py b/salt/states/rsync.py index 7485da87ae..4c62fc6658 100644 --- a/salt/states/rsync.py +++ b/salt/states/rsync.py @@ -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, @@ -138,12 +143,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 From 1b304bb47656d0ef002e7c4be31e5cef5602835c Mon Sep 17 00:00:00 2001 From: Mike Place Date: Fri, 21 Apr 2017 11:47:02 -0600 Subject: [PATCH 3/9] Extra space before inline comment --- salt/states/rsync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/states/rsync.py b/salt/states/rsync.py index 4c62fc6658..194e364977 100644 --- a/salt/states/rsync.py +++ b/salt/states/rsync.py @@ -152,7 +152,7 @@ def synchronized(name, source, 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 + del ret['changes']['changed'] # Don't need to print the boolean # Clean else: ret['comment'] = _get_summary(result['stdout']) From 889540a31324f6956273e2385e78ad4300c54209 Mon Sep 17 00:00:00 2001 From: Ch3LL Date: Mon, 24 Apr 2017 13:27:15 -0400 Subject: [PATCH 4/9] [2016.3] Bump latest release version to 2016.11.4 --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 9c8ecd4281..1c19720558 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -213,7 +213,7 @@ on_saltstack = 'SALT_ON_SALTSTACK' in os.environ project = 'Salt' version = salt.version.__version__ -latest_release = '2016.11.3' # latest release +latest_release = '2016.11.4' # latest release previous_release = '2016.3.6' # latest release from previous branch previous_release_dir = '2016.3' # path on web server for previous branch next_release = '' # next release From 958ecdace87fda48920f21530a7f55858a1a745e Mon Sep 17 00:00:00 2001 From: Sergey Kizunov Date: Mon, 24 Apr 2017 11:35:59 -0500 Subject: [PATCH 5/9] Fix TCP Transport to work with Tornado 4.5 TCP transport's `TCPClientKeepAlive` derives from `tornado.tcpclient.TCPClient` and overrides `_create_stream`. Tornado 4.5 added the kwargs `source_ip` and `source_port` to `_create_stream`. This new functionality is not needed by Salt. To be backwards and forwards compatible, add `**kwargs` to swallow these and any future kwargs that are added. Signed-off-by: Sergey Kizunov --- salt/transport/tcp.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/salt/transport/tcp.py b/salt/transport/tcp.py index 29ef0746d5..185a113ec1 100644 --- a/salt/transport/tcp.py +++ b/salt/transport/tcp.py @@ -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) From 87ec1da771df88c0904e61438b04d96c2e045465 Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Mon, 24 Apr 2017 14:13:43 -0600 Subject: [PATCH 6/9] status should be an int --- salt/states/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/states/http.py b/salt/states/http.py index be4277c143..ac99a3d740 100644 --- a/salt/states/http.py +++ b/salt/states/http.py @@ -60,7 +60,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 From 2ca627d02d3cc548b264543652557a2fed071ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Tue, 25 Apr 2017 14:04:33 +0200 Subject: [PATCH 7/9] states: sqlite3: fix table_present with multi-line schema With a sqlite3 database containing a table with this schema: CREATE TABLE `user` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , `login` TEXT NOT NULL) using `sqlite3.table_present` with this definition: user: sqlite3.table_present: - db: /tmp/sqlite.db - schema: | CREATE TABLE `user` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , `login` TEXT NOT NULL) returns an error indicating that the schemas do not match. That's because the `schema` variable in the YAML ends with a newline, while the schema returned by python-sqlite3 doesn't. This commit strips leading and trailing whitespace from the YAML schema. --- salt/states/sqlite3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/states/sqlite3.py b/salt/states/sqlite3.py index 60a7442999..7c612cc9d0 100644 --- a/salt/states/sqlite3.py +++ b/salt/states/sqlite3.py @@ -394,7 +394,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) From fb607bab75e3a7d2d886ce82415384e3341eaa53 Mon Sep 17 00:00:00 2001 From: senthilkumar-e Date: Wed, 26 Apr 2017 11:22:12 +0530 Subject: [PATCH 8/9] Fix for broken /jobs/ in 2016.11.4 Fixes #40845 --- salt/runner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/salt/runner.py b/salt/runner.py index a1f61938eb..cfb4c1037a 100644 --- a/salt/runner.py +++ b/salt/runner.py @@ -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 From 2f55b26e08a5d7942b1d5cd9251499fad08734ae Mon Sep 17 00:00:00 2001 From: senthilkumar-e Date: Wed, 26 Apr 2017 20:51:14 +0530 Subject: [PATCH 9/9] Fixing the pylint issue --- salt/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/runner.py b/salt/runner.py index cfb4c1037a..f495a4a128 100644 --- a/salt/runner.py +++ b/salt/runner.py @@ -74,7 +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', + '__current_eauth_groups', '__current_eauth_user', ] if i in low]) # Run name=value args through parse_input. We don't need to run kwargs