[Python-modules-commits] [nagiosplugin] 06/11: Import nagiosplugin_1.2.4.orig.tar.gz

Jan Dittberner jandd at moszumanska.debian.org
Tue Jul 18 13:27:39 UTC 2017


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

jandd pushed a commit to branch master
in repository nagiosplugin.

commit 6040fc87c623f938fcc3c20955e240baa764b8c6
Author: Jan Dittberner <jandd at debian.org>
Date:   Tue Jul 18 15:19:48 2017 +0200

    Import nagiosplugin_1.2.4.orig.tar.gz
---
 HACKING.txt                            |  36 ++++---
 HISTORY.txt                            |  19 ++++
 PKG-INFO                               |  71 ++++++++------
 README.txt                             |   7 +-
 bootstrap.py                           | 170 ---------------------------------
 buildout.cfg                           |  14 ++-
 setup.py                               |   7 +-
 src/nagiosplugin.egg-info/PKG-INFO     |  71 ++++++++------
 src/nagiosplugin.egg-info/SOURCES.txt  |   1 -
 src/nagiosplugin.egg-info/requires.txt |   3 +-
 src/nagiosplugin/check.py              |  17 ++--
 src/nagiosplugin/context.py            |   6 +-
 src/nagiosplugin/metric.py             |   5 +-
 src/nagiosplugin/output.py             |  14 +--
 src/nagiosplugin/range.py              |   5 +-
 src/nagiosplugin/resource.py           |   3 -
 src/nagiosplugin/result.py             |   4 +-
 src/nagiosplugin/runtime.py            |  58 ++++++-----
 src/nagiosplugin/state.py              |   3 -
 src/nagiosplugin/summary.py            |   5 +-
 src/nagiosplugin/tests/test_check.py   |  32 ++++++-
 src/nagiosplugin/tests/test_output.py  |  17 +++-
 src/nagiosplugin/tests/test_range.py   |   2 +-
 src/nagiosplugin/tests/test_result.py  |   3 -
 src/nagiosplugin/tests/test_runtime.py |  19 +++-
 version.txt                            |   2 +-
 26 files changed, 250 insertions(+), 344 deletions(-)

diff --git a/HACKING.txt b/HACKING.txt
index c8b64d1..464b7f1 100644
--- a/HACKING.txt
+++ b/HACKING.txt
@@ -9,7 +9,9 @@ https://bitbucket.org/gocept/nagiosplugin::
 
    hg clone https://bitbucket.org/gocept/nagiosplugin
 
-This package supports installation in a virtualenv using zc.buildout.
+This package supports installation in a virtualenv using `zc.buildout`_.
+
+.. _zc.buildout: https://pypi.python.org/pypi/zc.buildout
 
 
 Creating a build with zc.buildout
@@ -17,24 +19,18 @@ Creating a build with zc.buildout
 
 First, create a virtualenv if not already present::
 
-   virtualenv -p python3.2 .
-
-If you want to use Python 2.7, specify this Python version while creating the
-virtualenv::
-
-   virtualenv -p python2.7 .
+   virtualenv -p python3.4 --no-setuptools .
 
-Sometimes, you will run into strange setuptools/distribute version conflicts.
-The best way around is to keep setuptools and distribute entirely out of the
-virtualenv::
+zc.buildout will take care of all required dependencies::
 
-   virtualenv -p python3.2 --no-setuptools .
-
-`bootstrap.py` and zc.buildout will take care of all required dependencies.
+   bin/pip3.2 install -U zc.buildout
+   bin/buildout
 
-Then launch the usual buildout steps::
+If you want to use another Python version like 2.7, just the same steps with the
+Python version substituted::
 
-   bin/python3.2 bootstrap.py
+   virtualenv -p python2.7 --no-setuptools .
+   bin/pip2.7 install -U zc.buildout
    bin/buildout
 
 
@@ -47,9 +43,9 @@ When the buildout succeeds, run the unit test by invoking::
 
 Our `build server`_ runs test against the trunk on a regular basis.
 
-.. image:: https://builds.gocept.com/job/nagiosplugin/badge/icon
-   :target: https://builds.gocept.com/job/nagiosplugin/
-.. _build server: https://builds.gocept.com/job/nagiosplugin/
+.. image:: https://builds.flyingcircus.io/job/nagiosplugin/PYTHON=System-CPython-2.7/badge/icon
+   :target: https://builds.flyingcircus.io/job/nagiosplugin/
+.. _build server: https://builds.flyingcircus.io/job/nagiosplugin/
 
 nagiosplugin also includes support for coverage reports. It aims at 100% test
 coverage where possible. The preferred way to get a coverate report is to use ::
@@ -88,8 +84,8 @@ the standard procedure, which usually boils down to::
 `nagiosplugin` tried to obey the semantic version numbering specification
 published on SemVer_ but adapts it a little bit to be `PEP 386`_ compliant.
 
-.. _zest.releaser: http://pypi.python.org/pypi/zest.releaser/
+.. _zest.releaser: https://pypi.python.org/pypi/zest.releaser/
 .. _SemVer: http://semver.org/
-.. _PEP 386: http://www.python.org/dev/peps/pep-0386/
+.. _PEP 386: https://www.python.org/dev/peps/pep-0386/
 
 .. vim: set ft=rst sw=3 sts=3 et:
diff --git a/HISTORY.txt b/HISTORY.txt
index ded985d..9529555 100644
--- a/HISTORY.txt
+++ b/HISTORY.txt
@@ -2,6 +2,25 @@ Release History
 ===============
 
 
+1.2.4 (2016-03-12)
+------------------
+
+- Add optional keyword parameter `verbose` to Runtime.guarded(). This parameter
+  allows to set verbose level in the early execution phase (#13).
+- Allow Context.evaluate() return either a Result or ServiceState object. In
+  case the latter is returned, it gets automatically wrapped in a Result object
+  (#6).
+
+
+1.2.3 (2015-10-30)
+------------------
+
+- Fix bug that caused a UnicodeDecodeError when using non-ASCII characters in
+  fmt_metric (#12).
+- Print perfdata always on a single line (even in multi-line mode) to improve
+  compatibility with various monitoring systems (#11).
+
+
 1.2.2 (2014-05-27)
 ------------------
 
diff --git a/PKG-INFO b/PKG-INFO
index cb619cb..0de6108 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: nagiosplugin
-Version: 1.2.2
+Version: 1.2.4
 Summary: Class library for writing Nagios (Icinga) plugins
-Home-page: http://projects.gocept.com/projects/nagiosplugin
+Home-page: https://bitbucket.org/flyingcircus/nagiosplugin
 Author: Christian Kauhaus
-Author-email: kc at gocept.com
+Author-email: kc at flyingcircus.io
 License: ZPL-2.1
-Download-URL: http://pypi.python.org/pypi/nagiosplugin
+Download-URL: https://pypi.python.org/pypi/nagiosplugin
 Description: The nagiosplugin library
         ========================
         
@@ -29,19 +29,18 @@ Description: The nagiosplugin library
         - No dependencies beyond the Python standard library (except for Python 2.6).
         
         nagiosplugin runs on POSIX and Windows systems. It is compatible with Python
-        3.4, Python 3.3, Python 3.2, Python 2.7, and Python 2.6.
+        3.4, Python 3.3, Python 3.2, and Python 2.7.
         
         
         Feedback and Suggestions
         ------------------------
         
         nagiosplugin is primarily written and maintained by Christian Kauhaus
-        <kc at gocept.com>. Feel free to contact the author for bugs, suggestions and
+        <kc at flyingcircus.io>. Feel free to contact the author for bugs, suggestions and
         patches.
         
         A public issue tracker can be found at
-        http://projects.gocept.com/projects/nagiosplugin/issues. There is also a forum
-        available at https://projects.gocept.com/projects/nagiosplugin/boards.
+        https://bitbucket.org/flyingcircus/nagiosplugin/issues/.
         
         
         License
@@ -75,7 +74,9 @@ Description: The nagiosplugin library
         
            hg clone https://bitbucket.org/gocept/nagiosplugin
         
-        This package supports installation in a virtualenv using zc.buildout.
+        This package supports installation in a virtualenv using `zc.buildout`_.
+        
+        .. _zc.buildout: https://pypi.python.org/pypi/zc.buildout
         
         
         Creating a build with zc.buildout
@@ -83,24 +84,18 @@ Description: The nagiosplugin library
         
         First, create a virtualenv if not already present::
         
-           virtualenv -p python3.2 .
-        
-        If you want to use Python 2.7, specify this Python version while creating the
-        virtualenv::
-        
-           virtualenv -p python2.7 .
-        
-        Sometimes, you will run into strange setuptools/distribute version conflicts.
-        The best way around is to keep setuptools and distribute entirely out of the
-        virtualenv::
+           virtualenv -p python3.4 --no-setuptools .
         
-           virtualenv -p python3.2 --no-setuptools .
+        zc.buildout will take care of all required dependencies::
         
-        `bootstrap.py` and zc.buildout will take care of all required dependencies.
+           bin/pip3.2 install -U zc.buildout
+           bin/buildout
         
-        Then launch the usual buildout steps::
+        If you want to use another Python version like 2.7, just the same steps with the
+        Python version substituted::
         
-           bin/python3.2 bootstrap.py
+           virtualenv -p python2.7 --no-setuptools .
+           bin/pip2.7 install -U zc.buildout
            bin/buildout
         
         
@@ -113,9 +108,9 @@ Description: The nagiosplugin library
         
         Our `build server`_ runs test against the trunk on a regular basis.
         
-        .. image:: https://builds.gocept.com/job/nagiosplugin/badge/icon
-           :target: https://builds.gocept.com/job/nagiosplugin/
-        .. _build server: https://builds.gocept.com/job/nagiosplugin/
+        .. image:: https://builds.flyingcircus.io/job/nagiosplugin/PYTHON=System-CPython-2.7/badge/icon
+           :target: https://builds.flyingcircus.io/job/nagiosplugin/
+        .. _build server: https://builds.flyingcircus.io/job/nagiosplugin/
         
         nagiosplugin also includes support for coverage reports. It aims at 100% test
         coverage where possible. The preferred way to get a coverate report is to use ::
@@ -154,9 +149,9 @@ Description: The nagiosplugin library
         `nagiosplugin` tried to obey the semantic version numbering specification
         published on SemVer_ but adapts it a little bit to be `PEP 386`_ compliant.
         
-        .. _zest.releaser: http://pypi.python.org/pypi/zest.releaser/
+        .. _zest.releaser: https://pypi.python.org/pypi/zest.releaser/
         .. _SemVer: http://semver.org/
-        .. _PEP 386: http://www.python.org/dev/peps/pep-0386/
+        .. _PEP 386: https://www.python.org/dev/peps/pep-0386/
         
         .. vim: set ft=rst sw=3 sts=3 et:
         
@@ -189,6 +184,25 @@ Description: The nagiosplugin library
         ===============
         
         
+        1.2.4 (2016-03-12)
+        ------------------
+        
+        - Add optional keyword parameter `verbose` to Runtime.guarded(). This parameter
+          allows to set verbose level in the early execution phase (#13).
+        - Allow Context.evaluate() return either a Result or ServiceState object. In
+          case the latter is returned, it gets automatically wrapped in a Result object
+          (#6).
+        
+        
+        1.2.3 (2015-10-30)
+        ------------------
+        
+        - Fix bug that caused a UnicodeDecodeError when using non-ASCII characters in
+          fmt_metric (#12).
+        - Print perfdata always on a single line (even in multi-line mode) to improve
+          compatibility with various monitoring systems (#11).
+        
+        
         1.2.2 (2014-05-27)
         ------------------
         
@@ -329,7 +343,6 @@ Classifier: Intended Audience :: System Administrators
 Classifier: License :: OSI Approved :: Zope Public License
 Classifier: Operating System :: Microsoft :: Windows
 Classifier: Operating System :: POSIX
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
diff --git a/README.txt b/README.txt
index 9a68cc4..d234fb6 100644
--- a/README.txt
+++ b/README.txt
@@ -20,19 +20,18 @@ and default logic commonly found in Nagios checks, including:
 - No dependencies beyond the Python standard library (except for Python 2.6).
 
 nagiosplugin runs on POSIX and Windows systems. It is compatible with Python
-3.4, Python 3.3, Python 3.2, Python 2.7, and Python 2.6.
+3.4, Python 3.3, Python 3.2, and Python 2.7.
 
 
 Feedback and Suggestions
 ------------------------
 
 nagiosplugin is primarily written and maintained by Christian Kauhaus
-<kc at gocept.com>. Feel free to contact the author for bugs, suggestions and
+<kc at flyingcircus.io>. Feel free to contact the author for bugs, suggestions and
 patches.
 
 A public issue tracker can be found at
-http://projects.gocept.com/projects/nagiosplugin/issues. There is also a forum
-available at https://projects.gocept.com/projects/nagiosplugin/boards.
+https://bitbucket.org/flyingcircus/nagiosplugin/issues/.
 
 
 License
diff --git a/bootstrap.py b/bootstrap.py
deleted file mode 100644
index 1b28969..0000000
--- a/bootstrap.py
+++ /dev/null
@@ -1,170 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Bootstrap a buildout-based project
-
-Simply run this script in a directory containing a buildout.cfg.
-The script accepts buildout command-line options, so you can
-use the -c option to specify an alternate configuration file.
-"""
-
-import os
-import shutil
-import sys
-import tempfile
-
-from optparse import OptionParser
-
-tmpeggs = tempfile.mkdtemp()
-
-usage = '''\
-[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
-
-Bootstraps a buildout-based project.
-
-Simply run this script in a directory containing a buildout.cfg, using the
-Python that you want bin/buildout to use.
-
-Note that by using --find-links to point to local resources, you can keep 
-this script from going over the network.
-'''
-
-parser = OptionParser(usage=usage)
-parser.add_option("-v", "--version", help="use a specific zc.buildout version")
-
-parser.add_option("-t", "--accept-buildout-test-releases",
-                  dest='accept_buildout_test_releases',
-                  action="store_true", default=False,
-                  help=("Normally, if you do not specify a --version, the "
-                        "bootstrap script and buildout gets the newest "
-                        "*final* versions of zc.buildout and its recipes and "
-                        "extensions for you.  If you use this flag, "
-                        "bootstrap and buildout will get the newest releases "
-                        "even if they are alphas or betas."))
-parser.add_option("-c", "--config-file",
-                  help=("Specify the path to the buildout configuration "
-                        "file to be used."))
-parser.add_option("-f", "--find-links",
-                  help=("Specify a URL to search for buildout releases"))
-
-
-options, args = parser.parse_args()
-
-######################################################################
-# load/install setuptools
-
-to_reload = False
-try:
-    import pkg_resources
-    import setuptools
-except ImportError:
-    ez = {}
-
-    try:
-        from urllib.request import urlopen
-    except ImportError:
-        from urllib2 import urlopen
-
-    # XXX use a more permanent ez_setup.py URL when available.
-    exec(urlopen('https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py'
-                ).read(), ez)
-    setup_args = dict(to_dir=tmpeggs, download_delay=0)
-    ez['use_setuptools'](**setup_args)
-
-    if to_reload:
-        reload(pkg_resources)
-    import pkg_resources
-    # This does not (always?) update the default working set.  We will
-    # do it.
-    for path in sys.path:
-        if path not in pkg_resources.working_set.entries:
-            pkg_resources.working_set.add_entry(path)
-
-######################################################################
-# Install buildout
-
-ws = pkg_resources.working_set
-
-cmd = [sys.executable, '-c',
-       'from setuptools.command.easy_install import main; main()',
-       '-mZqNxd', tmpeggs]
-
-find_links = os.environ.get(
-    'bootstrap-testing-find-links',
-    options.find_links or
-    ('http://downloads.buildout.org/'
-     if options.accept_buildout_test_releases else None)
-    )
-if find_links:
-    cmd.extend(['-f', find_links])
-
-setuptools_path = ws.find(
-    pkg_resources.Requirement.parse('setuptools')).location
-
-requirement = 'zc.buildout'
-version = options.version
-if version is None and not options.accept_buildout_test_releases:
-    # Figure out the most recent final version of zc.buildout.
-    import setuptools.package_index
-    _final_parts = '*final-', '*final'
-
-    def _final_version(parsed_version):
-        for part in parsed_version:
-            if (part[:1] == '*') and (part not in _final_parts):
-                return False
-        return True
-    index = setuptools.package_index.PackageIndex(
-        search_path=[setuptools_path])
-    if find_links:
-        index.add_find_links((find_links,))
-    req = pkg_resources.Requirement.parse(requirement)
-    if index.obtain(req) is not None:
-        best = []
-        bestv = None
-        for dist in index[req.project_name]:
-            distv = dist.parsed_version
-            if _final_version(distv):
-                if bestv is None or distv > bestv:
-                    best = [dist]
-                    bestv = distv
-                elif distv == bestv:
-                    best.append(dist)
-        if best:
-            best.sort()
-            version = best[-1].version
-if version:
-    requirement = '=='.join((requirement, version))
-cmd.append(requirement)
-
-import subprocess
-if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
-    raise Exception(
-        "Failed to execute command:\n%s",
-        repr(cmd)[1:-1])
-
-######################################################################
-# Import and run buildout
-
-ws.add_entry(tmpeggs)
-ws.require(requirement)
-import zc.buildout.buildout
-
-if not [a for a in args if '=' not in a]:
-    args.append('bootstrap')
-
-# if -c was provided, we push it back into args for buildout' main function
-if options.config_file is not None:
-    args[0:0] = ['-c', options.config_file]
-
-zc.buildout.buildout.main(args)
-shutil.rmtree(tmpeggs)
diff --git a/buildout.cfg b/buildout.cfg
index 1d3dea8..6e8a82e 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -7,7 +7,9 @@ package = nagiosplugin
 versions = versions
 
 [versions]
+alabaster = 0.7.4
 argparse = 1.1
+Babel = 1.3
 collective.xmltestreport = 1.3.1
 coverage = 3.7.1
 createcoverage = 1.2
@@ -15,13 +17,17 @@ docutils = 0.11
 iw.recipe.cmd = 0.3
 Jinja2 = 2.6
 nose = 1.3.3
-Pygments = 1.6
-setuptools = 3.6
-Sphinx = 1.2.2
+Pygments = 2.0.2
+pytz = 2015.2
+setuptools = 18.4
+six = 1.9.0
+snowballstemmer = 1.2.0
+Sphinx = 1.3.1
+sphinx-rtd-theme = 0.1.9
 tranchitella.recipe.nose = 0.1
 unittest2 = 0.5.1
 z3c.recipe.scripts = 1.0.1
-zc.buildout = 2.2.1
+zc.buildout = 2.4.5
 zc.recipe.egg = 2.0.1
 zope.exceptions = 4.0.7
 zope.interface = 4.1.1
diff --git a/setup.py b/setup.py
index 457bdef..a572149 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,6 @@ setup(
         'License :: OSI Approved :: Zope Public License',
         'Operating System :: Microsoft :: Windows',
         'Operating System :: POSIX',
-        'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3.2',
         'Programming Language :: Python :: 3.3',
@@ -43,9 +42,9 @@ setup(
     ],
     keywords='Nagios Icinga plugin check monitoring',
     author='Christian Kauhaus',
-    author_email='kc at gocept.com',
-    url='http://projects.gocept.com/projects/nagiosplugin',
-    download_url='http://pypi.python.org/pypi/nagiosplugin',
+    author_email='kc at flyingcircus.io',
+    url='https://bitbucket.org/flyingcircus/nagiosplugin',
+    download_url='https://pypi.python.org/pypi/nagiosplugin',
     license='ZPL-2.1',
     packages=find_packages('src'),
     package_dir={'': 'src'},
diff --git a/src/nagiosplugin.egg-info/PKG-INFO b/src/nagiosplugin.egg-info/PKG-INFO
index cb619cb..0de6108 100644
--- a/src/nagiosplugin.egg-info/PKG-INFO
+++ b/src/nagiosplugin.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: nagiosplugin
-Version: 1.2.2
+Version: 1.2.4
 Summary: Class library for writing Nagios (Icinga) plugins
-Home-page: http://projects.gocept.com/projects/nagiosplugin
+Home-page: https://bitbucket.org/flyingcircus/nagiosplugin
 Author: Christian Kauhaus
-Author-email: kc at gocept.com
+Author-email: kc at flyingcircus.io
 License: ZPL-2.1
-Download-URL: http://pypi.python.org/pypi/nagiosplugin
+Download-URL: https://pypi.python.org/pypi/nagiosplugin
 Description: The nagiosplugin library
         ========================
         
@@ -29,19 +29,18 @@ Description: The nagiosplugin library
         - No dependencies beyond the Python standard library (except for Python 2.6).
         
         nagiosplugin runs on POSIX and Windows systems. It is compatible with Python
-        3.4, Python 3.3, Python 3.2, Python 2.7, and Python 2.6.
+        3.4, Python 3.3, Python 3.2, and Python 2.7.
         
         
         Feedback and Suggestions
         ------------------------
         
         nagiosplugin is primarily written and maintained by Christian Kauhaus
-        <kc at gocept.com>. Feel free to contact the author for bugs, suggestions and
+        <kc at flyingcircus.io>. Feel free to contact the author for bugs, suggestions and
         patches.
         
         A public issue tracker can be found at
-        http://projects.gocept.com/projects/nagiosplugin/issues. There is also a forum
-        available at https://projects.gocept.com/projects/nagiosplugin/boards.
+        https://bitbucket.org/flyingcircus/nagiosplugin/issues/.
         
         
         License
@@ -75,7 +74,9 @@ Description: The nagiosplugin library
         
            hg clone https://bitbucket.org/gocept/nagiosplugin
         
-        This package supports installation in a virtualenv using zc.buildout.
+        This package supports installation in a virtualenv using `zc.buildout`_.
+        
+        .. _zc.buildout: https://pypi.python.org/pypi/zc.buildout
         
         
         Creating a build with zc.buildout
@@ -83,24 +84,18 @@ Description: The nagiosplugin library
         
         First, create a virtualenv if not already present::
         
-           virtualenv -p python3.2 .
-        
-        If you want to use Python 2.7, specify this Python version while creating the
-        virtualenv::
-        
-           virtualenv -p python2.7 .
-        
-        Sometimes, you will run into strange setuptools/distribute version conflicts.
-        The best way around is to keep setuptools and distribute entirely out of the
-        virtualenv::
+           virtualenv -p python3.4 --no-setuptools .
         
-           virtualenv -p python3.2 --no-setuptools .
+        zc.buildout will take care of all required dependencies::
         
-        `bootstrap.py` and zc.buildout will take care of all required dependencies.
+           bin/pip3.2 install -U zc.buildout
+           bin/buildout
         
-        Then launch the usual buildout steps::
+        If you want to use another Python version like 2.7, just the same steps with the
+        Python version substituted::
         
-           bin/python3.2 bootstrap.py
+           virtualenv -p python2.7 --no-setuptools .
+           bin/pip2.7 install -U zc.buildout
            bin/buildout
         
         
@@ -113,9 +108,9 @@ Description: The nagiosplugin library
         
         Our `build server`_ runs test against the trunk on a regular basis.
         
-        .. image:: https://builds.gocept.com/job/nagiosplugin/badge/icon
-           :target: https://builds.gocept.com/job/nagiosplugin/
-        .. _build server: https://builds.gocept.com/job/nagiosplugin/
+        .. image:: https://builds.flyingcircus.io/job/nagiosplugin/PYTHON=System-CPython-2.7/badge/icon
+           :target: https://builds.flyingcircus.io/job/nagiosplugin/
+        .. _build server: https://builds.flyingcircus.io/job/nagiosplugin/
         
         nagiosplugin also includes support for coverage reports. It aims at 100% test
         coverage where possible. The preferred way to get a coverate report is to use ::
@@ -154,9 +149,9 @@ Description: The nagiosplugin library
         `nagiosplugin` tried to obey the semantic version numbering specification
         published on SemVer_ but adapts it a little bit to be `PEP 386`_ compliant.
         
-        .. _zest.releaser: http://pypi.python.org/pypi/zest.releaser/
+        .. _zest.releaser: https://pypi.python.org/pypi/zest.releaser/
         .. _SemVer: http://semver.org/
-        .. _PEP 386: http://www.python.org/dev/peps/pep-0386/
+        .. _PEP 386: https://www.python.org/dev/peps/pep-0386/
         
         .. vim: set ft=rst sw=3 sts=3 et:
         
@@ -189,6 +184,25 @@ Description: The nagiosplugin library
         ===============
         
         
+        1.2.4 (2016-03-12)
+        ------------------
+        
+        - Add optional keyword parameter `verbose` to Runtime.guarded(). This parameter
+          allows to set verbose level in the early execution phase (#13).
+        - Allow Context.evaluate() return either a Result or ServiceState object. In
+          case the latter is returned, it gets automatically wrapped in a Result object
+          (#6).
+        
+        
+        1.2.3 (2015-10-30)
+        ------------------
+        
+        - Fix bug that caused a UnicodeDecodeError when using non-ASCII characters in
+          fmt_metric (#12).
+        - Print perfdata always on a single line (even in multi-line mode) to improve
+          compatibility with various monitoring systems (#11).
+        
+        
         1.2.2 (2014-05-27)
         ------------------
         
@@ -329,7 +343,6 @@ Classifier: Intended Audience :: System Administrators
 Classifier: License :: OSI Approved :: Zope Public License
 Classifier: Operating System :: Microsoft :: Windows
 Classifier: Operating System :: POSIX
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
diff --git a/src/nagiosplugin.egg-info/SOURCES.txt b/src/nagiosplugin.egg-info/SOURCES.txt
index 202f415..c386388 100644
--- a/src/nagiosplugin.egg-info/SOURCES.txt
+++ b/src/nagiosplugin.egg-info/SOURCES.txt
@@ -4,7 +4,6 @@ HISTORY.txt
 LICENSE.txt
 MANIFEST.in
 README.txt
-bootstrap.py
 buildout.cfg
 setup.cfg
 setup.py
diff --git a/src/nagiosplugin.egg-info/requires.txt b/src/nagiosplugin.egg-info/requires.txt
index 4fb25f6..9814528 100644
--- a/src/nagiosplugin.egg-info/requires.txt
+++ b/src/nagiosplugin.egg-info/requires.txt
@@ -1,4 +1,3 @@
 
-
 [test]
-setuptools
\ No newline at end of file
+setuptools
diff --git a/src/nagiosplugin/check.py b/src/nagiosplugin/check.py
index 9acc7f5..f82dec7 100644
--- a/src/nagiosplugin/check.py
+++ b/src/nagiosplugin/check.py
@@ -1,6 +1,3 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
 """Controller logic for check execution.
 
 This module contains the :class:`Check` class which orchestrates the
@@ -20,7 +17,7 @@ from .metric import Metric
 from .resource import Resource
 from .result import Result, Results
 from .runtime import Runtime
-from .state import Ok, Unknown
+from .state import Ok, Unknown, ServiceState
 from .summary import Summary
 import logging
 
@@ -82,7 +79,15 @@ class Check(object):
             for metric in metrics:
                 context = self.contexts[metric.context]
                 metric = metric.replace(contextobj=context, resource=resource)
-                self.results.add(metric.evaluate())
+                result = metric.evaluate()
+                if isinstance(result, Result):
+                    self.results.add(result)
+                elif isinstance(result, ServiceState):
+                    self.results.add(Result(result, metric=metric))
+                else:
+                    raise ValueError(
+                        'evaluate() returned neither Result nor ServiceState '
+                        'object', metric.name, result)
                 self.perfdata.append(str(metric.performance() or ''))
         except CheckError as e:
             self.results.add(Result(Unknown, str(e), metric))
@@ -100,7 +105,7 @@ class Check(object):
             self._evaluate_resource(resource)
         self.perfdata = sorted([p for p in self.perfdata if p])
 
-    def main(self, verbose=1, timeout=10):
+    def main(self, verbose=None, timeout=None):
         """All-in-one control delegation to the runtime environment.
 
         Get a :class:`~nagiosplugin.runtime.Runtime` instance and
diff --git a/src/nagiosplugin/context.py b/src/nagiosplugin/context.py
index 2d024a7..4da8263 100644
--- a/src/nagiosplugin/context.py
+++ b/src/nagiosplugin/context.py
@@ -1,6 +1,3 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
 """Metadata about metrics to perform data :term:`evaluation`.
 
 This module contains the :class:`Context` class, which is the base for
@@ -54,7 +51,8 @@ class Context(object):
         :param metric: associated metric that is to be evaluated
         :param resource: resource that produced the associated metric
             (may optionally be consulted)
-        :returns: :class:`~.result.Result` object
+        :returns: :class:`~.result.Result` or
+            :class:`~.state.ServiceState` object
         """
         return self.result_cls(Ok, metric=metric)
 
diff --git a/src/nagiosplugin/metric.py b/src/nagiosplugin/metric.py
index ecb496b..45fb1fd 100644
--- a/src/nagiosplugin/metric.py
+++ b/src/nagiosplugin/metric.py
@@ -1,6 +1,3 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
 """Structured representation for data points.
 
 This module contains the :class:`Metric` class whose instances are
@@ -79,7 +76,7 @@ class Metric(collections.namedtuple(
     def _human_readable_value(self):
         """Limit number of digits for floats."""
         if (isinstance(self.value, numbers.Real) and
-            not isinstance(self.value, numbers.Integral)):
+                not isinstance(self.value, numbers.Integral)):
             return '%.4g' % self.value
         return str(self.value)
 
diff --git a/src/nagiosplugin/output.py b/src/nagiosplugin/output.py
index 7c1c8b9..93446ed 100644
--- a/src/nagiosplugin/output.py
+++ b/src/nagiosplugin/output.py
@@ -1,6 +1,4 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
+from __future__ import unicode_literals
 import itertools
 
 
@@ -46,14 +44,8 @@ class Output(object):
     def format_perfdata(self, check, linebreak=None):
         if not check.perfdata:
             return ''
-        lines = ['|']
-        for item, i in zip(check.perfdata, itertools.count()):
-            if linebreak and len(lines[-1]) + len(item) >= linebreak:
-                lines.append(item)
-            else:
-                lines[-1] += ' ' + self._screen_chars(
-                    item, 'perfdata {0}'.format(i))
-        return '\n'.join(lines)
+        out = ' '.join(check.perfdata)
+        return '| ' + self._screen_chars(out, 'perfdata')
 
     def add_longoutput(self, text):
         if isinstance(text, list) or isinstance(text, tuple):
diff --git a/src/nagiosplugin/range.py b/src/nagiosplugin/range.py
index e46e133..5e83f74 100644
--- a/src/nagiosplugin/range.py
+++ b/src/nagiosplugin/range.py
@@ -27,12 +27,9 @@ class Range(collections.namedtuple('Range', 'invert start end')):
         if isinstance(spec, Range):
             return super(cls, Range).__new__(
                 cls, spec.invert, spec.start, spec.end)
-        elif isinstance(spec, str):
-            start, end, invert = cls._parse(spec)
         elif (isinstance(spec, int) or isinstance(spec, float)):
             start, end, invert = 0, spec, False
-        else:
-            raise TypeError('cannot recognize type of Range', spec)
+        start, end, invert = cls._parse(str(spec))
         cls._verify(start, end)
         return super(cls, Range).__new__(cls, invert, start, end)
 
diff --git a/src/nagiosplugin/resource.py b/src/nagiosplugin/resource.py
index 5dd7e07..9b110a0 100644
--- a/src/nagiosplugin/resource.py
+++ b/src/nagiosplugin/resource.py
@@ -1,6 +1,3 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
 """Domain model for data :term:`acquisition`.
 
 :class:`Resource` is the base class for the plugin's :term:`domain
diff --git a/src/nagiosplugin/result.py b/src/nagiosplugin/result.py
index b2e71bf..be6d848 100644
--- a/src/nagiosplugin/result.py
+++ b/src/nagiosplugin/result.py
@@ -1,6 +1,3 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
 """Outcomes from evaluating metrics in contexts.
 
 The :class:`Result` class is the base class for all evaluation results.
@@ -12,6 +9,7 @@ accomodate for special needs. :class:`~.context.Context` constructors
 accept custom Result subclasses in the `result_cls` parameter.
 """
 
+from __future__ import unicode_literals
 import collections
 import numbers
 import warnings
diff --git a/src/nagiosplugin/runtime.py b/src/nagiosplugin/runtime.py
index ecd1e71..321de8f 100644
--- a/src/nagiosplugin/runtime.py
+++ b/src/nagiosplugin/runtime.py
@@ -1,6 +1,3 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
 """Functions and classes to interface with the system.
 
 This module contains the :class:`Runtime` class that handles exceptions,
@@ -20,29 +17,43 @@ import functools
 import traceback
 
 
-def guarded(func):
-    """Runs a function in a newly created runtime environment.
+def guarded(original_function=None, verbose=None):
+    """Runs a function nagiosplugin's Runtime environment.
 
-    A guarded function behaves correctly with respect to the Nagios
-    plugin API if it aborts with an uncaught exception or a
-    timeout. It exits with an *unknown* exit code and prints a traceback
-    in a format acceptable by Nagios.
+    `guarded` makes the decorated function behave correctly with respect
+    to the Nagios plugin API if it aborts with an uncaught exception or
+    a timeout. It exits with an *unknown* exit code and prints a
+    traceback in a format acceptable by Nagios.
 
-    This function should be used as a decorator for the plugin's `main`
+    This function should be used as a decorator for the script's `main`
     function.
+
+    :param verbose: Optional keyword parameter to control verbosity
+        level during early execution (before
+        :meth:`~nagiosplugin.Check.main` has been called). For example,
+        use `@guarded(verbose=0)` to turn tracebacks in that phase off.
     """
-    @functools.wraps(func)
-    def wrapper(*args, **kwds):
-        runtime = Runtime()
-        try:
-            return func(*args, **kwds)
-        except Timeout as exc:
-            runtime._handle_exception(
-                'Timeout: check execution aborted after {0}'.format(
-                    exc))
-        except Exception:
-            runtime._handle_exception()
-    return wrapper
+    def _decorate(func):
+        @functools.wraps(func)
+        def wrapper(*args, **kwds):
+            runtime = Runtime()
+            if verbose is not None:
+                runtime.verbose = verbose
+            try:
+                return func(*args, **kwds)
+            except Timeout as exc:
+                runtime._handle_exception(
+                    'Timeout: check execution aborted after {0}'.format(
+                        exc))
+            except Exception:
+                runtime._handle_exception()
+        return wrapper
+    if original_function is not None:
+        assert callable(original_function), (
+            'Function {!r} not callable. Forgot to add "verbose=" keyword?'.
+            format(original_function))
+        return _decorate(original_function)
+    return _decorate
 
 
 class Runtime(object):
@@ -66,8 +77,7 @@ class Runtime(object):
         rootlogger.setLevel(logging.DEBUG)
         if not self.logchan:
             self.logchan = logging.StreamHandler(io.StringIO())
-            self.logchan.setFormatter(logging.Formatter(
-                '%(message)s (%(filename)s:%(lineno)d)'))
+            self.logchan.setFormatter(logging.Formatter('%(message)s'))
             rootlogger.addHandler(self.logchan)
         if not self.output:
             self.output = Output(self.logchan)
diff --git a/src/nagiosplugin/state.py b/src/nagiosplugin/state.py
index 15527f2..805b772 100644
--- a/src/nagiosplugin/state.py
+++ b/src/nagiosplugin/state.py
@@ -1,6 +1,3 @@
-# Copyright (c) gocept gmbh & co. kg
-# See also LICENSE.txt
-
 """Classes  to represent check outcomes.
 
 This module defines :class:`ServiceState` which is the abstract base
diff --git a/src/nagiosplugin/summary.py b/src/nagiosplugin/summary.py
index b420467..cb29f0b 100644
--- a/src/nagiosplugin/summary.py
+++ b/src/nagiosplugin/summary.py
@@ -16,6 +16,7 @@ usable, plugin authors should consider subclassing to provide a specific
 implementation that gets the output to the point.
 """
 
+from __future__ import unicode_literals
 from .state import Ok
 
 
@@ -36,7 +37,7 @@ class Summary(object):
         :param results: :class:`~nagiosplugin.result.Results` container
         :returns: status line
         """
-        return str(results[0])
+        return '{0}'.format(results[0])
 
     def problem(self, results):
         """Formats status line when overall state is not ok.
@@ -48,7 +49,7 @@ class Summary(object):
         :param results: :class:`~.result.Results` container
         :returns: status line
... 176 lines suppressed ...

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



More information about the Python-modules-commits mailing list