diff --git a/.travis.yml b/.travis.yml index ac84eec7..e012e4d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,8 @@ env: - ES_VERSION=5.3.3 - ES_VERSION=5.4.3 - ES_VERSION=5.5.2 - - ES_VERSION=5.6.4 - - ES_VERSION=6.0.0-rc2 + - ES_VERSION=5.6.5 + - ES_VERSION=6.0.0 os: linux diff --git a/curator/_version.py b/curator/_version.py index 38792d17..4635742a 100644 --- a/curator/_version.py +++ b/curator/_version.py @@ -1,2 +1,2 @@ -__version__ = '5.4.0' +__version__ = '5.4.1' diff --git a/curator/cli.py b/curator/cli.py index 86fbff5c..df8e3995 100644 --- a/curator/cli.py +++ b/curator/cli.py @@ -66,18 +66,18 @@ def process_action(client, config, **kwargs): # Special behavior for this action, as it has 2 index lists logger.debug('Running "{0}" action'.format(action.upper())) action_obj = action_class(**mykwargs) - if 'add' in config: - logger.debug('Adding indices to alias "{0}"'.format(opts['name'])) - adds = IndexList(client) - adds.iterate_filters(config['add']) - action_obj.add(adds, warn_if_no_indices=opts['warn_if_no_indices']) + removes = IndexList(client) + adds = IndexList(client) if 'remove' in config: logger.debug( 'Removing indices from alias "{0}"'.format(opts['name'])) - removes = IndexList(client) removes.iterate_filters(config['remove']) action_obj.remove( removes, warn_if_no_indices= opts['warn_if_no_indices']) + if 'add' in config: + logger.debug('Adding indices to alias "{0}"'.format(opts['name'])) + adds.iterate_filters(config['add']) + action_obj.add(adds, warn_if_no_indices=opts['warn_if_no_indices']) elif action in [ 'cluster_routing', 'create_index', 'rollover']: action_obj = action_class(client, **mykwargs) elif action == 'delete_snapshots' or action == 'restore': diff --git a/docs/Changelog.rst b/docs/Changelog.rst index f5ff000a..87b67a2f 100644 --- a/docs/Changelog.rst +++ b/docs/Changelog.rst @@ -3,6 +3,32 @@ Changelog ========= +5.4.1 (? ? ?) +------------- + +**Bug Fixes** + + * Improve Dockerfile to build from source and produce slimmer image + #1111 (mikn) + * Fix ``filter_kibana`` to correctly use ``exclude`` argument + #1116 (cjuroz) + * Fix `ssl_no_validate` behavior within AWS ES #1118 (igalarzab) + * Improve command-line exception management #1119 (4383) + * Make ``alias`` action always process ``remove`` before ``add`` + to prevent undesired alias removals. #1120 (untergeek) + +**General** + + * Bump ES versions in Travis CI + +**Documentation** + + * Remove ``unit_count`` parameter doc for parameter that no longer + exists #1107 (dashford) + * Add missing ``exclude: True`` in ``timestring`` docs #1117 (GregMefford) + + + 5.4.0 (13 November 2017) ------------------------ diff --git a/docs/asciidoc/index.asciidoc b/docs/asciidoc/index.asciidoc index ea1d9281..1ead8514 100644 --- a/docs/asciidoc/index.asciidoc +++ b/docs/asciidoc/index.asciidoc @@ -1,7 +1,7 @@ -:curator_version: 5.4.0 +:curator_version: 5.4.1 :curator_major: 5 :curator_doc_tree: 5.4 -:es_py_version: 5.4.0 +:es_py_version: 5.4.1 :es_doc_tree: 5.6 :pybuild_ver: 3.6.3 :ref: http://www.elastic.co/guide/en/elasticsearch/reference/{es_doc_tree} diff --git a/test/integration/test_alias.py b/test/integration/test_alias.py index 6407fdbf..f8ca6d93 100644 --- a/test/integration/test_alias.py +++ b/test/integration/test_alias.py @@ -286,3 +286,43 @@ def test_extra_options(self): ], ) self.assertEqual(-1, result.exit_code) + def test_add_and_remove_sorted(self): + alias = 'testalias' + alias_add_remove = ( + '---\n' + 'actions:\n' + ' 1:\n' + ' description: "Add/remove specified indices from designated alias"\n' + ' action: alias\n' + ' options:\n' + ' name: {0}\n' + ' continue_if_exception: False\n' + ' disable_action: False\n' + ' add:\n' + ' filters:\n' + ' - filtertype: none\n' + ' remove:\n' + ' filters:\n' + ' - filtertype: pattern\n' + ' kind: prefix\n' + ' value: my\n' + + ) + self.write_config( + self.args['configfile'], testvars.client_config.format(host, port)) + self.write_config(self.args['actionfile'], alias_add_remove.format(alias)) + self.create_index('my_index') + self.create_index('dummy') + self.client.indices.put_alias(index='my_index', name=alias) + test = clicktest.CliRunner() + result = test.invoke( + curator.cli, + [ + '--config', self.args['configfile'], + self.args['actionfile'] + ], + ) + self.assertEqual( + {'dummy': {'aliases': {alias: {}}}, 'my_index': {'aliases': {alias: {}}}}, + self.client.indices.get_alias(name=alias) + ) \ No newline at end of file