Skip to content

Commit

Permalink
Merge branch 'master' into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
untergeek committed Apr 22, 2016
2 parents 9f54de7 + 006249f commit e384bea
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion curator/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '4.0.0a3'
__version__ = '4.0.0a4'
6 changes: 4 additions & 2 deletions curator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import click
import copy
from .settings import ACTION_DEFAULTS, CONFIG_FILE, CLIENT_DEFAULTS, \
LOGGING_DEFAULTS
LOGGING_DEFAULTS, OPTION_DEFAULTS
from .exceptions import *
from .utils import *
from .indexlist import IndexList
Expand Down Expand Up @@ -176,7 +176,9 @@ def cli(config, dry_run, action_file):
else:
raise MissingArgument('No value for "action" provided')
logger.info('Action #{0}: {1}'.format(idx, action))

if not 'options' in actions[idx] or \
type(actions[idx]['options']) is not type(dict()):
actions[idx]['options'] = OPTION_DEFAULTS
# Assign and remove these keys from the options as the action will
# raise an exception if they are passed as kwargs
action_disabled = actions[idx]['options'].pop('disable_action', False)
Expand Down
5 changes: 5 additions & 0 deletions curator/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
'logformat': 'default',
}

OPTION_DEFAULTS = {
'continue_if_exception': False,
'disable_action': False,
}

REGEX_MAP = {
'timestring': r'^.*{0}.*$',
'regex': r'{0}',
Expand Down
10 changes: 9 additions & 1 deletion docs/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
Changelog
=========

4.0.0a4 (21 Apr 2016)
---------------------

**Bug Fixes**

* Require `pyyaml` 3.10 or better.
* In the case that no `options` are in an action, apply the defaults.

4.0.0a3 (21 Apr 2016)
---------------------

It's time for Curator 4.0 alpha 1!
It's time for Curator 4.0 alpha!

**Breaking Changes**

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
urllib3>=1.8.3
elasticsearch>=2.3.0,<5.1.0
click>=3.3
pyyaml>=3.10
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_version():
def get_install_requires():
res = ['elasticsearch>=2.3.0,<5.1.0' ]
res.append('click>=3.3')
res.append('pyyaml>=3.10')
return res

try:
Expand Down
17 changes: 17 additions & 0 deletions test/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,20 @@ def test_continue_if_exception_False(self):
)
self.assertEquals(10, len(curator.get_indices(self.client)))
self.assertEqual(1, result.exit_code)
def test_no_options_in_action(self):
self.create_indices(10)
self.write_config(
self.args['configfile'], testvars.client_config.format(host, port))
self.write_config(self.args['actionfile'],
testvars.no_options_proto.format('delete_indices'))
test = clicktest.CliRunner()
result = test.invoke(
curator.cli,
[
'--config', self.args['configfile'],
'--dry-run',
self.args['actionfile']

],
)
self.assertEqual(0, result.exit_code)
10 changes: 10 additions & 0 deletions test/integration/testvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@
' kind: prefix\n'
' value: my\n')

no_options_proto = ('---\n'
'actions:\n'
' 1:\n'
' description: "Act on indices as filtered"\n'
' action: {0}\n'
' filters:\n'
' - filtertype: pattern\n'
' kind: prefix\n'
' value: my\n')

actionless_proto = ('---\n'
'actions:\n'
' 1:\n'
Expand Down

0 comments on commit e384bea

Please sign in to comment.