Skip to content

Commit

Permalink
Merge pull request #92 from untergeek/1.1.0
Browse files Browse the repository at this point in the history
Correct tests to work on both Python2 and Python3
  • Loading branch information
untergeek committed Jun 11, 2014
2 parents ed9b66b + 567b69c commit 0925aac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions curator/curator.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def get_indices(client, prefix='logstash-', exclude_pattern=None):
_indices = sorted(client.indices.get_settings(index=prefix+'*', params={'expand_wildcards': 'closed'}).keys())
if exclude_pattern:
pattern = re.compile(exclude_pattern)
return filter(lambda x: not pattern.search(x), _indices)
return list(filter(lambda x: not pattern.search(x), _indices))
else:
return _indices

Expand Down Expand Up @@ -257,7 +257,7 @@ def get_object_list(client, data_type='index', prefix='logstash-', repository=No
logger.error('data_type \'{0}\' is neither \'index\' nor \'snapshot\'. Returning empty list.'.format(data_type))
if exclude_pattern:
pattern = re.compile(exclude_pattern)
return filter(lambda x: not pattern.search(x), object_list)
return list(filter(lambda x: not pattern.search(x), object_list))
else:
return object_list

Expand Down Expand Up @@ -597,7 +597,7 @@ def main():
parser = make_parser()
arguments = parser.parse_args()

# Initialize timeout_override
# Initialize timeout_override
timeout_override = True if arguments.command == 'optimize' else False

# Argparse nearly gets all conditions covered.
Expand Down Expand Up @@ -650,7 +650,7 @@ def main():
# Setting up NullHandler to handle nested elasticsearch.trace Logger instance in elasticsearch python client
logging.getLogger('elasticsearch.trace').addHandler(NullHandler())

# Override the timestamp in case the end-user doesn't.
# Override the timestamp in case the end-user doesn't.
if timeout_override and arguments.timeout == 30:
logger.info('Default timeout of 30 seconds is too low for command {}. Overriding to 21,600 seconds (6 hours).'.format(arguments.command.upper()))
arguments.timeout = 21600
Expand Down
2 changes: 1 addition & 1 deletion test_curator/integration/test_repo_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_repository_will_be_created_and_listed_and_deleted(self):
es_repo_mgr._create_repository(self.client, repository=self.args['repository'], repo_type='fs', location=self.args['location'])
pre = es_repo_mgr.get_repository(self.client, self.args['repository'])
self.assertEqual('fs', pre[self.args['repository']]['type'])
self.assertEqual(self.args['repository'], pre.keys()[0])
self.assertEqual(self.args['repository'], list(pre.keys())[0])
es_repo_mgr._delete_repository(self.client, repository=self.args['repository'])
post = es_repo_mgr.get_repository(self.client, self.args['repository'])
self.assertEqual(None, post)

0 comments on commit 0925aac

Please sign in to comment.