[Python-modules-commits] [elasticsearch-curator] 01/03: Imported Upstream version 3.5.1

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Mon Mar 21 21:06:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository elasticsearch-curator.

commit 31090ca535256de241b69937602041814d21fce0
Author: Apollon Oikonomopoulos <apoikos at debian.org>
Date:   Mon Mar 21 22:57:49 2016 +0200

    Imported Upstream version 3.5.1
---
 CONTRIBUTORS                             |  4 ++++
 curator/_version.py                      |  2 +-
 curator/api/filter.py                    |  7 +++---
 curator/api/seal.py                      | 19 ++++++++-------
 curator/api/snapshot.py                  |  4 ++--
 curator/cli/cli.py                       | 22 +++++++++++++++++-
 curator/cli/es_repo_mgr.py               |  6 +++--
 curator/cli/snapshot.py                  | 10 ++++++++
 curator/cli/utils.py                     | 12 +++++++---
 docs/Changelog.rst                       | 28 ++++++++++++++++++++++
 docs/asciidoc/flags/client-cert.asciidoc | 35 ++++++++++++++++++++++++++++
 docs/asciidoc/flags/client-key.asciidoc  | 33 ++++++++++++++++++++++++++
 docs/asciidoc/flags/help.asciidoc        | 32 ++++++++++++++-----------
 docs/asciidoc/flags/index.asciidoc       |  4 ++++
 docs/asciidoc/index.asciidoc             |  6 ++---
 docs/asciidoc/misc/installation.asciidoc | 29 ++++++++++++++++-------
 requirements.txt                         |  2 +-
 setup.py                                 |  3 +--
 test/integration/test_cli_commands.py    | 16 +++++++++++++
 test/integration/test_cli_utils.py       | 40 ++++++++++++++++++++++++++++++++
 test/unit/test_api_commands.py           | 11 ++++++++-
 test/unit/test_api_filter.py             |  2 +-
 test/unit/test_cli_utils.py              | 14 +++++++++++
 23 files changed, 290 insertions(+), 51 deletions(-)

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 6ea307a..d770d28 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -70,3 +70,7 @@ Contributors:
 * (pbamba)
 * Pavel Strashkin (xaka)
 * Wadim Kruse (wkruse)
+* Richard Megginson (richm)
+* Thibaut Ackermann (thib-ack)
+* (zzugg)
+* Julien Mancuso (petitout)
diff --git a/curator/_version.py b/curator/_version.py
index da4564d..bf5afe7 100644
--- a/curator/_version.py
+++ b/curator/_version.py
@@ -1 +1 @@
-__version__ = '3.4.1'
+__version__ = '3.5.1'
diff --git a/curator/api/filter.py b/curator/api/filter.py
index ab2dc0d..4ead8e2 100644
--- a/curator/api/filter.py
+++ b/curator/api/filter.py
@@ -23,20 +23,19 @@ DATE_REGEX = {
     'H' : '2',
     'M' : '2',
     'S' : '2',
-    'j' : '3',
+    'j' : '1,3',
 }
 
 def build_filter(
         kindOf=None, time_unit=None, timestring=None,
-        groupname='date', value=None, exclude=False,
+        groupname='date', value=None,
     ):
     """
     Return a filter object based on the arguments.
 
     :arg kindOf: Can be one of:
-        [older_than|newer_than|suffix|prefix|regex|timestring].
+        [older_than|newer_than|suffix|prefix|regex|timestring|exclude].
         This option defines what kind of filter you will be building.
-    :arg exclude: If `True`, exclude matches rather than include
     :arg groupname: The name of a named capture in pattern.  Currently only acts
         on 'date'
     :arg timestring: An strftime string to match the datestamp in an index name.
diff --git a/curator/api/seal.py b/curator/api/seal.py
index eeacb87..317cc06 100644
--- a/curator/api/seal.py
+++ b/curator/api/seal.py
@@ -1,6 +1,7 @@
 from .utils import *
 import elasticsearch
 import logging
+import urllib3
 logger = logging.getLogger(__name__)
 
 def seal_indices(client, indices):
@@ -14,19 +15,21 @@ def seal_indices(client, indices):
     :rtype: bool
     """
     indices = prune_closed(client, indices)
+    if not len(indices) > 0:
+        logger.info('No indices to seal.')
+        return True
     es_version = get_version(client)
+    if not es_version >= (1, 6, 0):
+        logger.warn('Your version of Elasticsearch ({0}) does not support index sealing (synced flush).  Must be 1.6.0 or higher.'.format(es_version))
+        return True # Non-fatal error
     errcode = ''
     results = {}
     try:
-        if es_version >= (1, 6, 0):
-            if len(indices) > 0:
-                results = client.indices.flush_synced(index=to_csv(indices))
-            else:
-                logger.warn('No indices to seal.')
-                return True
-        else:
-            logger.error('Your version of Elasticsearch ({0}) does not support index sealing (synced flush).  Must be 1.6.0 or higher.'.format(es_version))
+        results = client.indices.flush_synced(index=to_csv(indices))
     except Exception as e:
+        if str(type(e)) == "<class 'urllib3.exceptions.ReadTimeoutError'>":
+            logger.error('{0} consider using a larger value for --timeout'.format(e))
+            return False
         logger.warn('Non-fatal error encountered.')
         try:
             logger.debug('Error: {0}.  Message: {1}'.format(e.status_code, e.error))
diff --git a/curator/api/snapshot.py b/curator/api/snapshot.py
index 17cdb77..b5a3030 100644
--- a/curator/api/snapshot.py
+++ b/curator/api/snapshot.py
@@ -122,6 +122,6 @@ def delete_snapshot(client, snapshot=None, repository=None):
         logger.info("Deleting snapshot {0}".format(snapshot))
         client.snapshot.delete(repository=repository, snapshot=snapshot)
         return True
-    except elasticsearch.RequestError:
-        logger.error("Unable to delete snapshot {0} from repository {1}.  Run with --debug flag and/or check Elasticsearch logs for more information.".format(snapshot, repository))
+    except elasticsearch.TransportError as e:
+        logger.error("Unable to delete snapshot {0} from repository {1}. Error message: {2}.   Run with --debug flag and/or check Elasticsearch logs for more information.".format(snapshot, repository, e))
         return False
diff --git a/curator/cli/cli.py b/curator/cli/cli.py
index 43563b4..abbc905 100644
--- a/curator/cli/cli.py
+++ b/curator/cli/cli.py
@@ -35,6 +35,8 @@ DEFAULT_ARGS = {
 @click.option('--port', help='Elasticsearch port.', default=DEFAULT_ARGS['port'], type=int)
 @click.option('--use_ssl', help='Connect to Elasticsearch through SSL.', is_flag=True, default=DEFAULT_ARGS['use_ssl'])
 @click.option('--certificate', help='Path to certificate to use for SSL validation. (OPTIONAL)', type=str, default=None)
+ at click.option('--client-cert', help='Path to file containing SSL certificate for client auth. (OPTIONAL)', type=str, default=None)
+ at click.option('--client-key', help='Path to file containing SSL key for client auth. (OPTIONAL)', type=str, default=None)
 @click.option('--ssl-no-validate', help='Do not validate SSL certificate', is_flag=True)
 @click.option('--http_auth', help='Use Basic Authentication ex: user:pass', default=DEFAULT_ARGS['http_auth'])
 @click.option('--timeout', help='Connection timeout in seconds.', default=DEFAULT_ARGS['timeout'], type=int)
@@ -47,7 +49,7 @@ DEFAULT_ARGS = {
 @click.option('--quiet', help='Suppress command-line output.', is_flag=True)
 @click.version_option(version=__version__)
 @click.pass_context
-def cli(ctx, host, url_prefix, port, use_ssl, certificate, ssl_no_validate, http_auth, timeout, master_only, dry_run, debug, loglevel, logfile, logformat, quiet):
+def cli(ctx, host, url_prefix, port, use_ssl, certificate, client_cert, client_key, ssl_no_validate, http_auth, timeout, master_only, dry_run, debug, loglevel, logfile, logformat, quiet):
     """
     Curator for Elasticsearch indices.
 
@@ -84,6 +86,24 @@ def cli(ctx, host, url_prefix, port, use_ssl, certificate, ssl_no_validate, http
             msgout('Error: Could not open certificate at {0}'.format(certificate), error=True, quiet=quiet)
             sys.exit(1)
 
+    # Test whether client_cert is a valid file path
+    if use_ssl is True and client_cert is not None:
+        try:
+            open(client_cert, 'r')
+        except IOError:
+            logger.error('Could not open client cert at {0}'.format(client_cert))
+            msgout('Error: Could not open client cert at {0}'.format(client_cert), error=True, quiet=quiet)
+            sys.exit(1)
+
+    # Test whether client_key is a valid file path
+    if use_ssl is True and client_key is not None:
+        try:
+            open(client_key, 'r')
+        except IOError:
+            logger.error('Could not open client key at {0}'.format(client_key))
+            msgout('Error: Could not open client key at {0}'.format(client_key), error=True, quiet=quiet)
+            sys.exit(1)
+
     # Filter out logging from Elasticsearch and associated modules by default
     if not debug:
         for handler in logging.root.handlers:
diff --git a/curator/cli/es_repo_mgr.py b/curator/cli/es_repo_mgr.py
index f520099..679e2d0 100644
--- a/curator/cli/es_repo_mgr.py
+++ b/curator/cli/es_repo_mgr.py
@@ -105,7 +105,9 @@ def s3(
 @click.option('--port', help='Elasticsearch port.', default=DEFAULT_ARGS['port'], type=int)
 @click.option('--use_ssl', help='Connect to Elasticsearch through SSL.', is_flag=True, default=DEFAULT_ARGS['use_ssl'])
 @click.option('--certificate', help='Path to certificate to use for SSL validation. (OPTIONAL)', type=str, default=None)
- at click.option('--ssl-no-validate', help='Do not validate SSL certificate', is_flag=True)
+ at click.option('--client-cert', help='Path to file containing SSL certificate for client auth. (OPTIONAL)', type=str, default=None)
+ at click.option('--client-key', help='Path to file containing SSL key for client auth. (OPTIONAL)', type=str, default=None)
+ at click.option('--ssl-no-validate', help='Do not validate server\'s SSL certificate', is_flag=True)
 @click.option('--http_auth', help='Use Basic Authentication ex: user:pass', default=DEFAULT_ARGS['http_auth'])
 @click.option('--timeout', help='Connection timeout in seconds.', default=DEFAULT_ARGS['timeout'], type=int)
 @click.option('--master-only', is_flag=True, help='Only operate on elected master node.')
@@ -115,7 +117,7 @@ def s3(
 @click.option('--logformat', help='Log output format [default|logstash].', default=DEFAULT_ARGS['logformat'])
 @click.version_option(version=__version__)
 @click.pass_context
-def repomgrcli(ctx, host, url_prefix, port, use_ssl, certificate, ssl_no_validate, http_auth, timeout, master_only, debug, loglevel, logfile, logformat):
+def repomgrcli(ctx, host, url_prefix, port, use_ssl, certificate, client_cert, client_key, ssl_no_validate, http_auth, timeout, master_only, debug, loglevel, logfile, logformat):
     """Repository manager for Elasticsearch Curator.
     """
 
diff --git a/curator/cli/snapshot.py b/curator/cli/snapshot.py
index 6ae7ed2..643fc57 100644
--- a/curator/cli/snapshot.py
+++ b/curator/cli/snapshot.py
@@ -42,4 +42,14 @@ def snapshot(
         logger.error('Missing required parameter --repository')
         msgout('Missing required parameter --repository', error=True, quiet=ctx.parent.params['quiet'])
         sys.exit(1)
+    # Check if `name` contains upper-case characters, which are forbidden #562
+    if name:
+        if any(c.isupper() for c in name):
+            msgout(
+                'Snapshot name: "{0}" contains upper-case characters, which are not allowed.'.format(name),
+                error=True,
+                quiet=ctx.parent.params['quiet']
+            )
+            logger.error('Snapshot name: "{0}" contains upper-case characters, which are not allowed.'.format(name))
+            sys.exit(1)
 snapshot.add_command(indices)
diff --git a/curator/cli/utils.py b/curator/cli/utils.py
index f5b250c..e78ec5f 100644
--- a/curator/cli/utils.py
+++ b/curator/cli/utils.py
@@ -109,6 +109,8 @@ def get_client(**kwargs):
     kwargs['use_ssl'] = False if not 'use_ssl' in kwargs else kwargs['use_ssl']
     kwargs['ssl_no_validate'] = False if not 'ssl_no_validate' in kwargs else kwargs['ssl_no_validate']
     kwargs['certificate'] = False if not 'certificate' in kwargs else kwargs['certificate']
+    kwargs['client_cert'] = False if not 'client_cert' in kwargs else kwargs['client_cert']
+    kwargs['client_key'] = False if not 'client_key' in kwargs else kwargs['client_key']
     logger.debug("kwargs = {0}".format(kwargs))
     master_only = kwargs.pop('master_only')
     if kwargs['use_ssl']:
@@ -143,11 +145,15 @@ def override_timeout(ctx):
     Override the default timeout for optimize and snapshot operations if the
     default value of 30 is provided at the command-line.
     """
-    timeout = 21600
-    if ctx.parent.info_name in ['optimize', 'snapshot']:
+    if ctx.parent.info_name in ['optimize', 'snapshot', 'seal']:
+        # Check for default timeout of 30s
         if ctx.parent.parent.params['timeout'] == 30:
-            logger.warn('Overriding default connection timeout.  New timeout: {0}'.format(timeout))
+            if ctx.parent.info_name in ['optimize', 'snapshot']:
+                timeout = 21600
+            elif ctx.parent.info_name == 'seal':
+                timeout = 180
             ctx.parent.parent.params['timeout'] = timeout
+            logger.info('Overriding default connection timeout for {0} action.  New timeout: {1}'.format(ctx.parent.info_name,timeout))
 
 def filter_callback(ctx, param, value):
     """
diff --git a/docs/Changelog.rst b/docs/Changelog.rst
index 76f412f..2eacddd 100644
--- a/docs/Changelog.rst
+++ b/docs/Changelog.rst
@@ -3,6 +3,34 @@
 Changelog
 =========
 
+3.5.1 (21 March 2016)
+---------------------
+
+**Bug fixes**
+
+  * Add more logging information to snapshot delete method #582 (untergeek)
+  * Improve default timeout, logging, and exception handling for `seal` command
+    #583 (untergeek)
+  * Fix use of default snapshot name. #584 (untergeek)
+
+3.5.0 (16 March 2016)
+---------------------
+
+**General**
+
+  * Add support for the `--client-cert` and `--client-key` command line parameters
+    and client_cert and client_key parameters to the get_client() call. #520 (richm)
+
+**Bug fixes**
+
+  * Disallow users from creating snapshots with upper-case letters, which is not
+    permitted by Elasticsearch. #562 (untergeek)
+  * Remove `print()` command from ``setup.py`` as it causes issues with command-
+    line retrieval of ``--url``, etc. #568 (thib-ack)
+  * Remove unnecessary argument from `build_filter()` #530 (zzugg)
+  * Allow day of year filter to be made up with 1, 2 or 3 digits #578 (petitout)
+
+
 3.4.1 (10 February 2016)
 ------------------------
 
diff --git a/docs/asciidoc/flags/client-cert.asciidoc b/docs/asciidoc/flags/client-cert.asciidoc
new file mode 100644
index 0000000..9027fb4
--- /dev/null
+++ b/docs/asciidoc/flags/client-cert.asciidoc
@@ -0,0 +1,35 @@
+[[client-cert]]
+== --client-cert
+
+[float]
+Summary
+~~~~~~~
+
+Allows the use of a specified SSL client cert file to authenticate to
+Elasticsearch.  The file may contain both an SSL client certificate and an SSL
+key, in which case `--client-key` is not used.  If using `--client-cert`, and
+the file specified does not also contain the key, use `--client-key` to specify
+the file containing the SSL key.  The cert file must be in PEM format, and the
+key part, if used, must be an unencrypted key in PEM format as well.
+
+[float]
+Flags
+~~~~~
+
+* `--client-cert` Path to client certificate file to use for SSL client authentication.
+
+IMPORTANT: This flag must come before any <<commands,command>>.
+
+[float]
+Example
+~~~~~~~
+
+Connect to a cluster at `https://example.com/` via SSL using SSL client authentication:
+
+---------------------------------------------------------------------
+curator --host example.com --port 443 --use_ssl \
+        --certificate /path/to/cacert.pem \
+        --client-cert /path/to/clientcert.pem \
+        --client-key /path/to/clientkey.pem \
+        <<command>> <<flags>>
+---------------------------------------------------------------------
diff --git a/docs/asciidoc/flags/client-key.asciidoc b/docs/asciidoc/flags/client-key.asciidoc
new file mode 100644
index 0000000..72c2c2a
--- /dev/null
+++ b/docs/asciidoc/flags/client-key.asciidoc
@@ -0,0 +1,33 @@
+[[client-key]]
+== --client-key
+
+[float]
+Summary
+~~~~~~~
+
+Allows the use of a specified SSL client key file to authenticate to
+Elasticsearch.  If using `--client-cert` and the file specified does not also
+contain the key, use `--client-key` to specify the file containing the
+SSL key.  The key file must be an unencrypted key in PEM format.
+
+[float]
+Flags
+~~~~~
+
+* `--client-key` Path to client key file to use for SSL client authentication.
+
+IMPORTANT: This flag must come before any <<commands,command>>.
+
+[float]
+Example
+~~~~~~~
+
+Connect to a cluster at `https://example.com/` via SSL using SSL client authentication:
+
+---------------------------------------------------------------------
+curator --host example.com --port 443 --use_ssl \
+        --certificate /path/to/cacert.pem \
+        --client-cert /path/to/clientcert.pem \
+        --client-key /path/to/clientkey.pem \
+        <<command>> <<flags>>
+---------------------------------------------------------------------
diff --git a/docs/asciidoc/flags/help.asciidoc b/docs/asciidoc/flags/help.asciidoc
index c0be7e7..6349ceb 100644
--- a/docs/asciidoc/flags/help.asciidoc
+++ b/docs/asciidoc/flags/help.asciidoc
@@ -36,20 +36,24 @@ Usage: curator [OPTIONS] COMMAND [ARGS]...
   See http://elastic.co/guide/en/elasticsearch/client/curator/current
 
 Options:
-  --host TEXT        Elasticsearch host.
-  --url_prefix TEXT  Elasticsearch http url prefix.
-  --port INTEGER     Elasticsearch port.
-  --use_ssl          Connect to Elasticsearch through SSL.
-  --http_auth TEXT   Use Basic Authentication ex: user:pass
-  --timeout INTEGER  Connection timeout in seconds.
-  --master-only      Only operate on elected master node.
-  --dry-run          Do not perform any changes.
-  --debug            Debug mode
-  --loglevel TEXT    Log level
-  --logfile TEXT     log file
-  --logformat TEXT   Log output format [default|logstash].
-  --version          Show the version and exit.
-  --help             Show this message and exit.
+  --host TEXT         Elasticsearch host.
+  --url_prefix TEXT   Elasticsearch http url prefix.
+  --port INTEGER      Elasticsearch port.
+  --use_ssl           Connect to Elasticsearch through SSL.
+  --ssl-no-validate   Use SSL but do not validate the certificate (WARNING: UNSAFE!).
+  --certificate TEXT  Path to CA certificate to use for SSL validation.
+  --client-cert TEXT  Path to client certificate file to use for SSL client authentication.
+  --client-key TEXT   Path to client key file to use for SSL client authentication.
+  --http_auth TEXT    Use Basic Authentication ex: user:pass
+  --timeout INTEGER   Connection timeout in seconds.
+  --master-only       Only operate on elected master node.
+  --dry-run           Do not perform any changes.
+  --debug             Debug mode
+  --loglevel TEXT     Log level
+  --logfile TEXT      log file
+  --logformat TEXT    Log output format [default|logstash].
+  --version           Show the version and exit.
+  --help              Show this message and exit.
 
 Commands:
   alias       Index Aliasing
diff --git a/docs/asciidoc/flags/index.asciidoc b/docs/asciidoc/flags/index.asciidoc
index d97d9fe..b53b72d 100644
--- a/docs/asciidoc/flags/index.asciidoc
+++ b/docs/asciidoc/flags/index.asciidoc
@@ -19,6 +19,8 @@
 * <<url_prefix,--url_prefix>>
 * <<use_ssl,--use_ssl>>
 * <<certificate,--certificate>>
+* <<client-cert,--client-cert>>
+* <<client-key,--client-key>>
 * <<ssl-no-validate,--ssl-no-validate>>
 * <<version,--version>>
 
@@ -64,6 +66,8 @@ include::timeout.asciidoc[]
 include::url_prefix.asciidoc[]
 include::use_ssl.asciidoc[]
 include::certificate.asciidoc[]
+include::client-cert.asciidoc[]
+include::client-key.asciidoc[]
 include::ssl-no-validate.asciidoc[]
 include::version.asciidoc[]
 
diff --git a/docs/asciidoc/index.asciidoc b/docs/asciidoc/index.asciidoc
index 2bc28d4..e610240 100644
--- a/docs/asciidoc/index.asciidoc
+++ b/docs/asciidoc/index.asciidoc
@@ -1,7 +1,7 @@
-:curator_version: 3.4.0
+:curator_version: 3.5.0
 :curator_major: 3
-:es_py_version: 1.8.0
-:ref:  http://www.elastic.co/guide/en/elasticsearch/reference/2.0
+:es_py_version: 2.3.0
+:ref:  http://www.elastic.co/guide/en/elasticsearch/reference/2.2
 
 [[curator-reference]]
 = Curator Reference
diff --git a/docs/asciidoc/misc/installation.asciidoc b/docs/asciidoc/misc/installation.asciidoc
index 1e59f87..9852331 100644
--- a/docs/asciidoc/misc/installation.asciidoc
+++ b/docs/asciidoc/misc/installation.asciidoc
@@ -25,7 +25,7 @@ PIP installation of a specific version:
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 ----------------------------------------
-pip install elasticsearch-curator==2.0.0
+pip install elasticsearch-curator==3.5.0
 ----------------------------------------
 
  
@@ -47,8 +47,8 @@ Download and install the https://github.com/shazow/urllib3[urllib3] dependency
 Download and install the http://click.pocoo.org/[click] dependency (3.3 or
 greater):
 
-. `wget https://pypi.python.org/packages/source/c/click/click-5.1.tar.gz -O click-5.1.tar.gz`
-. `pip install click-5.1.tar.gz`
+. `wget https://pypi.python.org/packages/source/c/click/click-6.2.tar.gz -O click-6.3.tar.gz`
+. `pip install click-6.3.tar.gz`
 
 
  
@@ -238,14 +238,27 @@ command again.
 [[windows-binary]]
 === Windows Binary Package
 If you do not wish to install and maintain Python on Windows, there is a
-compiled binary version available (64bit only).  It is in a directory with EXE
+compiled binary version available.  It is in a directory with EXE
 files and all necessary libraries that Python requires.  You can navigate to the
-directory and run the `curator` command just as you otherwise would.
+directory and run the `curator` and `es_repo_mgr` commands just as you otherwise would.
 
 WARNING: If you do have Python installed, do not uncompress the zip file into
 your Python directory.  It can cause library path collisions which will prevent
 Curator from properly functioning.
 
-* http://packages.elastic.co/curator/{curator_major}/windows/curator-{curator_version}-win64.zip[Download Curator]
-** http://packages.elastic.co/curator/{curator_major}/windows/curator-{curator_version}-win64.zip.md5.txt[MD5]
-** http://packages.elastic.co/curator/{curator_major}/windows/curator-{curator_version}-win64.zip.sha1.txt[SHA1]
+* https://packages.elastic.co/curator/{curator_major}/windows/curator-{curator_version}-win32.zip[Download Curator]
+** https://packages.elastic.co/curator/{curator_major}/windows/curator-{curator_version}-win32.zip.md5.txt[MD5]
+** https://packages.elastic.co/curator/{curator_major}/windows/curator-{curator_version}-win32.zip.sha1.txt[SHA1]
+
+=== Experimental: Windows MSI Installer
+There is now a rudimentary MSI installer available for you to try.  One known issue
+is that upgrades are not possible.  Subsequent installs will be side-by-side.  The
+recommended course of action is to uninstall the old version, then install the new one.
+
+The installation will default to `"C:\Program Files (x86)\elasticsearch-curator"`.
+The same binaries and libraries found in the Windows Binary Package will be installed
+into this directory.
+
+* https://packages.elastic.co/curator/{curator_major}/windows/elasticsearch-curator-{curator_version}-win32.msi[Download Curator Installer]
+** https://packages.elastic.co/curator/{curator_major}/windows/elasticsearch-curator-{curator_version}-win32.msi.md5.txt[MD5]
+** https://packages.elastic.co/curator/{curator_major}/windows/elasticsearch-curator-{curator_version}-win32.msi.sha1.txt[SHA1]
diff --git a/requirements.txt b/requirements.txt
index 4e0ebce..b2e7c50 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 urllib3>=1.8.3
-elasticsearch>=1.8.0,<2.1.0
+elasticsearch>=2.3.0,<3.0.0
 click>=3.3
diff --git a/setup.py b/setup.py
index 243951c..752963c 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ def get_version():
     return VERSION
 
 def get_install_requires():
-    res = ['elasticsearch>=1.8.0,<2.4.0' ]
+    res = ['elasticsearch>=2.3.0,<3.0.0' ]
     res.append('click>=3.3')
     return res
 
@@ -97,7 +97,6 @@ try:
     )
     ### end cx_Freeze ###
 except ImportError:
-    print('Unable to load cx_Freeze.  Cannot do \'build_exe\' or \'bdist_msi\'.\n')
     setup(
         name = "elasticsearch-curator",
         version = get_version(),
diff --git a/test/integration/test_cli_commands.py b/test/integration/test_cli_commands.py
index 4386249..22b72a3 100644
--- a/test/integration/test_cli_commands.py
+++ b/test/integration/test_cli_commands.py
@@ -728,6 +728,22 @@ class TestCLISnapshot(CuratorTestCase):
                     ],
                     obj={"filters":[]})
         self.assertEqual(1, result.exit_code)
+    def test_snapshot_name_with_uppercase_chars(self):
+        test = clicktest.CliRunner()
+        result = test.invoke(
+                    curator.cli,
+                    [
+                        '--logfile', os.devnull,
+                        '--host', host,
+                        '--port', str(port),
+                        'snapshot',
+                        '--repository', self.args['repository'],
+                        '--name', 'BadSnapName',
+                        'indices',
+                        '--all-indices',
+                    ],
+                    obj={"filters":[]})
+        self.assertEqual(1, result.exit_code)
     def test_cli_snapshot_indices(self):
         self.create_indices(5)
         self.create_repository()
diff --git a/test/integration/test_cli_utils.py b/test/integration/test_cli_utils.py
index 31f96b5..fcf48d2 100644
--- a/test/integration/test_cli_utils.py
+++ b/test/integration/test_cli_utils.py
@@ -96,3 +96,43 @@ class TestSSLFlags(CuratorTestCase):
                     ],
                     obj={"filters":[]})
         self.assertTrue(1, result.exit_code)
+    def test_bad_client_cert(self):
+        self.create_indices(10)
+        test = clicktest.CliRunner()
+        result = test.invoke(
+                    curator.cli,
+                    [
+                        '--logfile', os.devnull,
+                        '--host', host,
+                        '--port', str(port),
+                        '--use_ssl',
+                        '--client-cert', '/path/to/nowhere',
+                        'show',
+                        'indices',
+                        '--older-than', '5',
+                        '--time-unit', 'days',
+                        '--timestring', '%Y.%m.%d',
+                    ],
+                    obj={"filters":[]})
+        self.assertEqual(1, result.exit_code)
+        self.assertEqual('Error: Could not open client cert at /path/to/nowhere\n', result.output)
+    def test_bad_client_key(self):
+        self.create_indices(10)
+        test = clicktest.CliRunner()
+        result = test.invoke(
+                    curator.cli,
+                    [
+                        '--logfile', os.devnull,
+                        '--host', host,
+                        '--port', str(port),
+                        '--use_ssl',
+                        '--client-key', '/path/to/nowhere',
+                        'show',
+                        'indices',
+                        '--older-than', '5',
+                        '--time-unit', 'days',
+                        '--timestring', '%Y.%m.%d',
+                    ],
+                    obj={"filters":[]})
+        self.assertEqual(1, result.exit_code)
+        self.assertEqual('Error: Could not open client key at /path/to/nowhere\n', result.output)
diff --git a/test/unit/test_api_commands.py b/test/unit/test_api_commands.py
index 0f67e2b..640433b 100644
--- a/test/unit/test_api_commands.py
+++ b/test/unit/test_api_commands.py
@@ -1,5 +1,6 @@
 from datetime import datetime, timedelta
 from unittest import TestCase
+import urllib3
 from mock import Mock
 import sys
 try:
@@ -509,6 +510,14 @@ class TestSeal(TestCase):
         client.indices.flush_synced.side_effect = fake_fail
         client.info.return_value = {'version': {'number': '1.6.0'} }
         self.assertTrue(curator.seal_indices(client, named_index))
+    def test_seal_indices_timeout_error(self):
+        client = Mock()
+        client.cluster.state.return_value = open_index
+        client.indices.flush_synced.return_value = synced_fail
+        client.indices.flush_synced.side_effect = urllib3.exceptions.ReadTimeoutError('foo', 'bar', 'message')
+        client.info.return_value = {'version': {'number': '1.6.0'} }
+        self.assertFalse(curator.seal_indices(client, named_index))
+
 
 class TestShow(TestCase):
     def setUp(self):
@@ -687,5 +696,5 @@ class TestDeleteSnapshot(TestCase):
         self.assertTrue(curator.delete_snapshot(client, repository=repo_name, snapshot=snap_name))
     def test_delete_snapshot_negative(self):
         client = Mock()
-        client.snapshot.delete.side_effect = elasticsearch.RequestError
+        client.snapshot.delete.side_effect = elasticsearch.TransportError(400, 'This is an error message')
         self.assertFalse(curator.delete_snapshot(client, repository=repo_name, snapshot=snap_name))
diff --git a/test/unit/test_api_filter.py b/test/unit/test_api_filter.py
index fa0c548..dbf9d5a 100644
--- a/test/unit/test_api_filter.py
+++ b/test/unit/test_api_filter.py
@@ -239,7 +239,7 @@ class TestGetDateRegex(TestCase):
         self.assertEqual('\\d{4}\\.\\d{2}\\.\\d{2}\\-\\d{2}\\-\\d{2}\\d{2}\\d{2}\\d{2}\\d{2}',
             curator.get_date_regex('%Y.%y.%m-%W-%U%d%H%M%S'))
     def test_get_date_regex_date_map2(self):
-        self.assertEqual('\\d{4}\\-\\d{3}',
+        self.assertEqual('\\d{4}\\-\\d{1,3}',
             curator.get_date_regex('%Y-%j'))
 
 
diff --git a/test/unit/test_cli_utils.py b/test/unit/test_cli_utils.py
index 66c58c5..08c584b 100644
--- a/test/unit/test_cli_utils.py
+++ b/test/unit/test_cli_utils.py
@@ -130,3 +130,17 @@ class TestGetClient(TestCase):
             curator.get_client(**kwargs)
             self.assertEqual(sys.stdout.getvalue(),'ERROR: Connection failure.\n')
         self.assertEqual(cm.exception.code, 1)
+    def test_client_cert_logic(self):
+        client = Mock()
+        kwargs = { 'use_ssl' : True, 'client_cert' : 'myclientcert.pem' }
+        with self.assertRaises(SystemExit) as cm:
+            curator.get_client(**kwargs)
+            self.assertEqual(sys.stdout.getvalue(),'ERROR: Connection failure.\n')
+        self.assertEqual(cm.exception.code, 1)
+    def test_client_key_logic(self):
+        client = Mock()
+        kwargs = { 'use_ssl' : True, 'client_key' : 'myclientkey.pem' }
+        with self.assertRaises(SystemExit) as cm:
+            curator.get_client(**kwargs)
+            self.assertEqual(sys.stdout.getvalue(),'ERROR: Connection failure.\n')
+        self.assertEqual(cm.exception.code, 1)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/elasticsearch-curator.git



More information about the Python-modules-commits mailing list