ceilometermiddleware-1.2.0/0000775000175100017510000000000013234444030015721 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/0000775000175100017510000000000013234444030020412 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/source/0000775000175100017510000000000013234444030021712 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/source/_static/0000775000175100017510000000000013234444030023340 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/source/_static/.placeholder0000666000175100017510000000000013234443472025624 0ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/source/conf.py0000666000175100017510000002144313234443472023230 0ustar zuulzuul00000000000000#!/usr/bin/env python3 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'openstackdocstheme', 'reno.sphinxext', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. author = 'Ceilometer Middleware Contributors' category = 'Miscellaneous' copyright = u'2016, Ceilometer Middleware Developers' project = u'Ceilometer Middleware Release Notes' description = 'Ceilometer Middleware publishes traffic measures for Swift.' title = 'Ceilometer Middleware Release Notes' target_name = 'ceilometermiddleware' # Release notes do not need a version number in the title, they # cover multiple releases. # The full version, including alpha/beta/rc tags. release = '' # The short X.Y version. version = '' # openstackdocstheme options repository_name = 'openstack/ceilometermiddleware' bug_project = 'ceilometermiddleware' bug_tag = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%Y-%m-%d %H:%M' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = target_name + '-docs' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, target_name + '.tex', title, author, 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, target_name, title, [author], 1), ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, target_name, title, author, project, description, category), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # -- Options for Internationalization output ------------------------------ locale_dirs = ['locale/'] ceilometermiddleware-1.2.0/releasenotes/source/pike.rst0000666000175100017510000000021713234443472023407 0ustar zuulzuul00000000000000=================================== Pike Series Release Notes =================================== .. release-notes:: :branch: stable/pike ceilometermiddleware-1.2.0/releasenotes/source/mitaka.rst0000666000175100017510000000022213234443472023721 0ustar zuulzuul00000000000000============================== Mikata Series Release Notes ============================== .. release-notes:: :branch: origin/stable/mitaka ceilometermiddleware-1.2.0/releasenotes/source/index.rst0000666000175100017510000000031013234443472023560 0ustar zuulzuul00000000000000==================================== Ceilometer Middleware Release Notes ==================================== .. toctree:: :maxdepth: 1 unreleased pike ocata newton mitaka ceilometermiddleware-1.2.0/releasenotes/source/unreleased.rst0000666000175100017510000000016013234443472024603 0ustar zuulzuul00000000000000============================== Current Series Release Notes ============================== .. release-notes:: ceilometermiddleware-1.2.0/releasenotes/source/_templates/0000775000175100017510000000000013234444030024047 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/source/_templates/.placeholder0000666000175100017510000000000013234443472026333 0ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/source/ocata.rst0000666000175100017510000000023013234443472023541 0ustar zuulzuul00000000000000=================================== Ocata Series Release Notes =================================== .. release-notes:: :branch: origin/stable/ocata ceilometermiddleware-1.2.0/releasenotes/source/newton.rst0000666000175100017510000000022213234443472023765 0ustar zuulzuul00000000000000============================== Newton Series Release Notes ============================== .. release-notes:: :branch: origin/stable/newton ceilometermiddleware-1.2.0/releasenotes/notes/0000775000175100017510000000000013234444030021542 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/notes/.placeholder0000666000175100017510000000000013234443472024026 0ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/releasenotes/notes/background-thread-notifier-21b36a5f5c8dec0e.yaml0000666000175100017510000000113313234443472032210 0ustar zuulzuul00000000000000--- features: - Introduced option to send notifications from a background thread instead of blocking the service response to send the notification. This option is disabled by default, retaining previous behavior. Enable by setting ``nonblocking_notify`` to ``True`` in the middleware configuration. When enabled notifications will be queued for delivery in a single thread. Set ``send_queue_size`` to customize the length of this delivery queue (default size 1000). - Introduced option to customize the logging level using the ``log_level`` option (default WARNING). ceilometermiddleware-1.2.0/releasenotes/notes/bug-1679196-ab9d6bb2134120e0.yaml0000666000175100017510000000026213234443472026253 0ustar zuulzuul00000000000000--- fixes: - Corrects retrieval of (notification) transport_url for oslo.messaging. Issue would occur when oslo.messaging RPC and Notification backends were separated. ceilometermiddleware-1.2.0/ChangeLog0000664000175100017510000000701213234444030017473 0ustar zuulzuul00000000000000CHANGES ======= 1.2.0 ----- * Fix documentation url 404 error * Remove setting of version/release from releasenotes * Update reno for stable/pike * Fix default service project to "service" * retrieve project id to ignore from keystone 1.1.0 ----- * Switch to get\_notification\_transport for Notifier 1.0.1 ----- * Trivial: remove support for py34 * switch to topics when declaring notifier * Update reno for stable/ocata * Fix releasenotes branches * Use https instead of http for git.openstack.org * Remove link to modindex * [doc] Note lack of constraints is a choice * Revert "Show team and repo badges on README" * Show team and repo badges on README * Bump hacking to 0.12 1.0.0 ----- * Convert nonblocking\_notify value from string to boolean * No reason to start with '\_' define a general variable * Enable release notes translation * Clean imports in code * Bump the oslo.messaging version * clean up oslo-incubator related stuff * Add release note for background thread notifier * Delete openstack/common from the exclude list of flake8 in tox * Add reno for release notes management * Avoid useless dependency on oslo\_utils * Update the home-page with developer documentation * Fix bug in background sending * Add support for Python 3.5 * Remove py33 from tox envlist 0.5.0 ----- * Add background thread notifier sending ability * Upgrade hacking * Updated from global requirements * Only install hacking in pep8 * Remove oslo.context dependency * Remove unused requirements * Add missing requirements for mock * Updated from global requirements * [Trivial] Remove executable privilege of doc/source/conf.py * Updated from global requirements * Updated from global requirements * use path as resource id when missing RESELLER prefix 0.4.0 ----- * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Use assertTrue/False instead of assertEqual(T/F) * Updated from global requirements * Removes MANIFEST.in as it is not needed explicitely by PBR * Remove py26 support from ceilometermiddleware * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * swift: upgrade messaging to v2 * Updated from global requirements * Updated from global requirements * Fix the mistakes in .gitignore file * Change ignore-errors to ignore\_errors 0.3.0 ----- * Ignore request with swift.source in env * Updated from global requirements * Fixes parsing req path for account HEAD/GET * HTTP\_X\_TENANT\_ID is deprecated and replaced by HTTP\_X\_PROJECT\_ID * Updated from global requirements * Activate pep8 check that \_ is imported * Updated from global requirements * Drop use of 'oslo' namespace package * Updated from global requirements * Add test which asserts non-empty target\_id * Updated from global requirements * add support to skip event/meter generation for certain projects * Set correct config choice for transport url 0.2.0 ----- * Updated from global requirements * Drop use of 'oslo' namespace package * Update README to work with release tools * Updated from global requirements * Add \*paste.filter\_factory\* entry point * use pycadf helper module to assign action * Updated from global requirements * remove gitignore files 0.1.0 ----- * add README template * add options to configure messaging * ignore changelog * fix py34 tests * fix gitignore * fix gitignore * initial checkin * initial checkin * Initial commit ceilometermiddleware-1.2.0/tox.ini0000666000175100017510000000165613234443472017257 0ustar zuulzuul00000000000000[tox] minversion = 1.8 envlist = py35,py27,pypy,pep8,releasenotes skipsdist = True [testenv] usedevelop = True # NOTE(tonyb): This project has chosen to *NOT* consume upper-constraints.txt install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = python setup.py testr --slowest --testr-args='{posargs}' [testenv:pep8] deps = hacking>=0.12,<0.13 commands = flake8 [testenv:venv] commands = {posargs} [testenv:cover] commands = python setup.py testr --coverage --testr-args='{posargs}' [testenv:docs] commands = python setup.py build_sphinx [testenv:debug] commands = oslo_debug_helper {posargs} [testenv:releasenotes] commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build ceilometermiddleware-1.2.0/setup.py0000666000175100017510000000200413234443472017442 0ustar zuulzuul00000000000000# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools # In python < 2.7.4, a lazy loading of package `pbr` will break # setuptools if some other modules registered functions in `atexit`. # solution from: http://bugs.python.org/issue15881#msg170215 try: import multiprocessing # noqa except ImportError: pass setuptools.setup( setup_requires=['pbr>=1.8'], pbr=True) ceilometermiddleware-1.2.0/PKG-INFO0000664000175100017510000000320313234444030017014 0ustar zuulzuul00000000000000Metadata-Version: 1.1 Name: ceilometermiddleware Version: 1.2.0 Summary: OpenStack Telemetry middleware for generating metrics Home-page: http://docs.openstack.org/developer/ceilometermiddleware Author: OpenStack Author-email: openstack-dev@lists.openstack.org License: UNKNOWN Description-Content-Type: UNKNOWN Description: =============================================== Middleware for OpenStack Telemetry (Ceilometer) =============================================== This library provides middleware modules designed to enable metric and event data generation to be consumed by Ceilometer. For information on contributing, see ``CONTRIBUTING.rst``. * License: Apache License, Version 2.0 * Documentation: https://docs.openstack.org/ceilometermiddleware/latest/ * Source: http://git.openstack.org/cgit/openstack/ceilometermiddleware * Bugs: http://bugs.launchpad.net/ceilometermiddleware For any other information, refer to the parent project, Ceilometer: https://github.com/openstack/ceilometer Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 ceilometermiddleware-1.2.0/requirements.txt0000666000175100017510000000067213234443472021225 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. oslo.config>=3.9.0 # Apache-2.0 oslo.messaging>=5.2.0 # Apache-2.0 oslo.utils pbr>=1.6 # Apache-2.0 pycadf!=2.0.0,>=1.1.0 # Apache-2.0 six>=1.9.0 # MIT keystoneauth1>=2.18.0 # Apache-2.0 python-keystoneclient>=3.8.0 # Apache-2.0 ceilometermiddleware-1.2.0/AUTHORS0000664000175100017510000000211513234444030016770 0ustar zuulzuul00000000000000Andreas Jaeger Andrew Smith Cao Xuan Hoang Chris Dent Clément Contini Darren Hague Doug Hellmann Flavio Percoco Hanxi Liu Julien Danjou Mehdi Abaakouk Monty Taylor Nadya Privalova OpenStack Release Bot Rohit Jaiswal Romain Soufflet Steve Lewis Swapnil Kulkarni (coolsvap) Tom Cocozzello Tony Breeds Yuanbin.Chen ZhiQiang Fan Zuul aditi gengchc2 gord chung gordon chung sonu.kumar venkatamahesh xiaozhuangqing ceilometermiddleware-1.2.0/.coveragerc0000666000175100017510000000016513234443472020057 0ustar zuulzuul00000000000000[run] branch = True source = ceilometermiddleware omit = ceilometermiddleware/tests/* [report] ignore_errors = True ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/0000775000175100017510000000000013234444030023601 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/dependency_links.txt0000664000175100017510000000000113234444030027647 0ustar zuulzuul00000000000000 ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/PKG-INFO0000664000175100017510000000320313234444030024674 0ustar zuulzuul00000000000000Metadata-Version: 1.1 Name: ceilometermiddleware Version: 1.2.0 Summary: OpenStack Telemetry middleware for generating metrics Home-page: http://docs.openstack.org/developer/ceilometermiddleware Author: OpenStack Author-email: openstack-dev@lists.openstack.org License: UNKNOWN Description-Content-Type: UNKNOWN Description: =============================================== Middleware for OpenStack Telemetry (Ceilometer) =============================================== This library provides middleware modules designed to enable metric and event data generation to be consumed by Ceilometer. For information on contributing, see ``CONTRIBUTING.rst``. * License: Apache License, Version 2.0 * Documentation: https://docs.openstack.org/ceilometermiddleware/latest/ * Source: http://git.openstack.org/cgit/openstack/ceilometermiddleware * Bugs: http://bugs.launchpad.net/ceilometermiddleware For any other information, refer to the parent project, Ceilometer: https://github.com/openstack/ceilometer Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/requires.txt0000664000175100017510000000022113234444030026174 0ustar zuulzuul00000000000000oslo.config>=3.9.0 oslo.messaging>=5.2.0 oslo.utils pbr>=1.6 pycadf!=2.0.0,>=1.1.0 six>=1.9.0 keystoneauth1>=2.18.0 python-keystoneclient>=3.8.0 ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/pbr.json0000664000175100017510000000005613234444030025260 0ustar zuulzuul00000000000000{"git_version": "e316920", "is_release": true}ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/SOURCES.txt0000664000175100017510000000246513234444030025474 0ustar zuulzuul00000000000000.coveragerc .testr.conf AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst babel.cfg requirements.txt setup.cfg setup.py test-requirements.txt tox.ini ceilometermiddleware/__init__.py ceilometermiddleware/swift.py ceilometermiddleware.egg-info/PKG-INFO ceilometermiddleware.egg-info/SOURCES.txt ceilometermiddleware.egg-info/dependency_links.txt ceilometermiddleware.egg-info/entry_points.txt ceilometermiddleware.egg-info/not-zip-safe ceilometermiddleware.egg-info/pbr.json ceilometermiddleware.egg-info/requires.txt ceilometermiddleware.egg-info/top_level.txt ceilometermiddleware/tests/__init__.py ceilometermiddleware/tests/base.py ceilometermiddleware/tests/test_swift.py ceilometermiddleware/tests/data/list_projects.yaml doc/source/conf.py doc/source/contributing.rst doc/source/index.rst doc/source/installation.rst doc/source/readme.rst doc/source/usage.rst releasenotes/notes/.placeholder releasenotes/notes/background-thread-notifier-21b36a5f5c8dec0e.yaml releasenotes/notes/bug-1679196-ab9d6bb2134120e0.yaml releasenotes/source/conf.py releasenotes/source/index.rst releasenotes/source/mitaka.rst releasenotes/source/newton.rst releasenotes/source/ocata.rst releasenotes/source/pike.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholderceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/entry_points.txt0000664000175100017510000000011213234444030027071 0ustar zuulzuul00000000000000[paste.filter_factory] swift = ceilometermiddleware.swift:filter_factory ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/top_level.txt0000664000175100017510000000002513234444030026330 0ustar zuulzuul00000000000000ceilometermiddleware ceilometermiddleware-1.2.0/ceilometermiddleware.egg-info/not-zip-safe0000664000175100017510000000000113234444012026027 0ustar zuulzuul00000000000000 ceilometermiddleware-1.2.0/README.rst0000666000175100017510000000125113234443472017422 0ustar zuulzuul00000000000000=============================================== Middleware for OpenStack Telemetry (Ceilometer) =============================================== This library provides middleware modules designed to enable metric and event data generation to be consumed by Ceilometer. For information on contributing, see ``CONTRIBUTING.rst``. * License: Apache License, Version 2.0 * Documentation: https://docs.openstack.org/ceilometermiddleware/latest/ * Source: http://git.openstack.org/cgit/openstack/ceilometermiddleware * Bugs: http://bugs.launchpad.net/ceilometermiddleware For any other information, refer to the parent project, Ceilometer: https://github.com/openstack/ceilometer ceilometermiddleware-1.2.0/babel.cfg0000666000175100017510000000002113234443472017453 0ustar zuulzuul00000000000000[python: **.py] ceilometermiddleware-1.2.0/setup.cfg0000666000175100017510000000253113234444030017545 0ustar zuulzuul00000000000000[metadata] name = ceilometermiddleware summary = OpenStack Telemetry middleware for generating metrics description-file = README.rst author = OpenStack author-email = openstack-dev@lists.openstack.org home-page = http://docs.openstack.org/developer/ceilometermiddleware classifier = Environment :: OpenStack Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.5 [files] packages = ceilometermiddleware [entry_points] paste.filter_factory = swift = ceilometermiddleware.swift:filter_factory [build_sphinx] source-dir = doc/source build-dir = doc/build all_files = 1 [upload_sphinx] upload-dir = doc/build/html [compile_catalog] directory = ceilometermiddleware/locale domain = ceilometermiddleware [update_catalog] domain = ceilometermiddleware output_dir = ceilometermiddleware/locale input_file = ceilometermiddleware/locale/ceilometermiddleware.pot [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = ceilometermiddleware/locale/ceilometermiddleware.pot [egg_info] tag_build = tag_date = 0 ceilometermiddleware-1.2.0/ceilometermiddleware/0000775000175100017510000000000013234444030022107 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/ceilometermiddleware/__init__.py0000666000175100017510000000124413234443472024234 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import pbr.version __version__ = pbr.version.VersionInfo( 'ceilometermiddleware').version_string() ceilometermiddleware-1.2.0/ceilometermiddleware/swift.py0000666000175100017510000003453413234443472023641 0ustar zuulzuul00000000000000# # Copyright 2012 eNovance # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. """ Telemetry Middleware for Swift Proxy Configuration: In /etc/swift/proxy-server.conf on the main pipeline add "ceilometer" just before "proxy-server" and add the following filter in the file: .. code-block:: python [filter:ceilometer] paste.filter_factory = ceilometermiddleware.swift:filter_factory # Some optional configuration this allow to publish additional metadata metadata_headers = X-TEST # Set reseller prefix (defaults to "AUTH_" if not set) reseller_prefix = AUTH_ # Set control_exchange to publish to. control_exchange = swift # Set transport url url = rabbit://me:passwd@host:5672/virtual_host # set messaging driver driver = messagingv2 # set topic topic = notifications # skip metering of requests from listed project ids ignore_projects = , , # Whether to send events to messaging driver in a background thread nonblocking_notify = False # Queue size for sending notifications in background thread (0=unlimited). # New notifications will be discarded if the queue is full. send_queue_size = 1000 # Logging level control log_level = WARNING # All keystoneauth1 options can be set to query project name for # ignore_projects option, here is just a example: auth_type = password auth_url = https://[::1]:5000 project_name = service project_domain_name = Default username = user user_domain_name = Default password = a_big_secret interface = public """ import datetime import functools import logging from keystoneauth1 import exceptions as ksa_exc from keystoneauth1.loading import adapter as ksa_adapter from keystoneauth1.loading import base as ksa_base from keystoneauth1.loading import session as ksa_session from keystoneclient.v3 import client as ks_client from oslo_config import cfg import oslo_messaging from oslo_utils import strutils from pycadf import event as cadf_event from pycadf.helper import api from pycadf import measurement as cadf_measurement from pycadf import metric as cadf_metric from pycadf import resource as cadf_resource import six import six.moves.queue as queue import six.moves.urllib.parse as urlparse import threading LOG = logging.getLogger(__name__) def list_from_csv(comma_separated_str): if comma_separated_str: return list( filter(lambda x: x, map(lambda x: x.strip(), comma_separated_str.split(',')))) return [] def _log_and_ignore_error(fn): @functools.wraps(fn) def wrapper(*args, **kwargs): try: return fn(*args, **kwargs) except Exception as e: LOG.exception('An exception occurred processing ' 'the API call: %s ', e) return wrapper class InputProxy(object): """File-like object that counts bytes read. To be swapped in for wsgi.input for accounting purposes. Borrowed from swift.common.utils. Duplicated here to avoid dependency on swift package. """ def __init__(self, wsgi_input): self.wsgi_input = wsgi_input self.bytes_received = 0 def read(self, *args, **kwargs): """Pass read request to the underlying file-like object Add bytes read to total. """ chunk = self.wsgi_input.read(*args, **kwargs) self.bytes_received += len(chunk) return chunk def readline(self, *args, **kwargs): """Pass readline request to the underlying file-like object Add bytes read to total. """ line = self.wsgi_input.readline(*args, **kwargs) self.bytes_received += len(line) return line class KeystoneClientLoader(ksa_adapter.Adapter): """Keystone client adapter loader. Keystone client and Keystoneauth1 adapter take exactly the same options, so it's safe to create a keystone client with keystoneauth adapter options. """ @property def plugin_class(self): return ks_client.Client class Swift(object): """Swift middleware used for counting requests.""" event_queue = None threadLock = threading.Lock() DEFAULT_IGNORE_PROJECT_NAMES = ['service'] def __init__(self, app, conf): self._app = app self.ignore_projects = self._get_ignore_projects(conf) oslo_messaging.set_transport_defaults(conf.get('control_exchange', 'swift')) self._notifier = oslo_messaging.Notifier( oslo_messaging.get_notification_transport(cfg.CONF, url=conf.get('url')), publisher_id='ceilometermiddleware', driver=conf.get('driver', 'messagingv2'), topics=[conf.get('topic', 'notifications')]) self.metadata_headers = [h.strip().replace('-', '_').lower() for h in conf.get( "metadata_headers", "").split(",") if h.strip()] self.reseller_prefix = conf.get('reseller_prefix', 'AUTH_') if self.reseller_prefix and self.reseller_prefix[-1] != '_': self.reseller_prefix += '_' LOG.setLevel(getattr(logging, conf.get('log_level', 'WARNING'))) # NOTE: If the background thread's send queue fills up, the event will # be discarded # # For backward compatibility we default to False and therefore wait for # sending to complete. This causes swift proxy to hang if the # destination is unavailable. self.nonblocking_notify = strutils.bool_from_string( conf.get('nonblocking_notify', False)) # Initialize the sending queue and thread, but only once if self.nonblocking_notify and Swift.event_queue is None: Swift.threadLock.acquire() if Swift.event_queue is None: send_queue_size = int(conf.get('send_queue_size', 1000)) Swift.event_queue = queue.Queue(send_queue_size) self.start_sender_thread() Swift.threadLock.release() def _get_ignore_projects(self, conf): if 'auth_type' not in conf: LOG.info("'auth_type' is not set assuming ignore_projects are " "only project uuid.") return list_from_csv(conf.get('ignore_projects')) if 'ignore_projects' in conf: ignore_projects = list_from_csv(conf.get('ignore_projects')) else: ignore_projects = self.DEFAULT_IGNORE_PROJECT_NAMES if not ignore_projects: return [] def opt_getter(opt): # TODO(sileht): This method does not support deprecated opt names val = conf.get(opt.name) if val is None: val = conf.get(opt.dest) return val auth_type = conf.get('auth_type') plugin = ksa_base.get_plugin_loader(auth_type) auth = plugin.load_from_options_getter(opt_getter) session = ksa_session.Session().load_from_options_getter( opt_getter, auth=auth) client = KeystoneClientLoader().load_from_options_getter( opt_getter, session=session) projects = [] for name_or_id in ignore_projects: projects.extend(self._get_keystone_projects(client, name_or_id)) return projects @staticmethod def _get_keystone_projects(client, name_or_id): try: return [client.projects.get(name_or_id)] except ksa_exc.NotFound: pass if isinstance(name_or_id, six.binary_type): name_or_id = name_or_id.decode('utf-8', 'strict') projects = client.projects.list(name=name_or_id) if not projects: LOG.warning("fail to find project '%s' in keystone", name_or_id) return [p.id for p in projects] def __call__(self, env, start_response): start_response_args = [None] input_proxy = InputProxy(env['wsgi.input']) env['wsgi.input'] = input_proxy def my_start_response(status, headers, exc_info=None): start_response_args[0] = (status, list(headers), exc_info) def iter_response(iterable): iterator = iter(iterable) try: chunk = next(iterator) while not chunk: chunk = next(iterator) except StopIteration: chunk = '' if start_response_args[0]: start_response(*start_response_args[0]) bytes_sent = 0 try: while chunk: bytes_sent += len(chunk) yield chunk chunk = next(iterator) finally: self.emit_event(env, input_proxy.bytes_received, bytes_sent) try: iterable = self._app(env, my_start_response) except Exception: self.emit_event(env, input_proxy.bytes_received, 0, 'failure') raise else: return iter_response(iterable) @_log_and_ignore_error def emit_event(self, env, bytes_received, bytes_sent, outcome='success'): if ((env.get('HTTP_X_SERVICE_PROJECT_ID') or env.get('HTTP_X_PROJECT_ID') or env.get('HTTP_X_TENANT_ID')) in self.ignore_projects or env.get('swift.source') is not None): return path = urlparse.quote(env['PATH_INFO']) method = env['REQUEST_METHOD'] headers = {} for header in env: if header.startswith('HTTP_') and env[header]: key = header[5:] if isinstance(env[header], six.text_type): headers[key] = six.text_type(env[header]) else: headers[key] = str(env[header]) try: container = obj = None path = path.replace('/', '', 1) version, account, remainder = path.split('/', 2) except ValueError: try: version, account = path.split('/', 1) remainder = None except ValueError: return try: if not version or not account: raise ValueError('Invalid path: %s' % path) if remainder: if '/' in remainder: container, obj = remainder.split('/', 1) else: container = remainder except ValueError: return now = datetime.datetime.utcnow().isoformat() resource_metadata = { "path": path, "version": version, "container": container, "object": obj, } for header in self.metadata_headers: if header.upper() in headers: resource_metadata['http_header_%s' % header] = headers.get( header.upper()) # build object store details target = cadf_resource.Resource( typeURI='service/storage/object', id=account.partition(self.reseller_prefix)[2] or path) target.metadata = resource_metadata target.action = method.lower() # build user details initiator = cadf_resource.Resource( typeURI='service/security/account/user', id=env.get('HTTP_X_USER_ID')) initiator.project_id = (env.get('HTTP_X_PROJECT_ID') or env.get('HTTP_X_TENANT_ID')) # build notification body event = cadf_event.Event(eventTime=now, outcome=outcome, action=api.convert_req_action(method), initiator=initiator, target=target, observer=cadf_resource.Resource(id='target')) # measurements if bytes_received: event.add_measurement(cadf_measurement.Measurement( result=bytes_received, metric=cadf_metric.Metric( name='storage.objects.incoming.bytes', unit='B'))) if bytes_sent: event.add_measurement(cadf_measurement.Measurement( result=bytes_sent, metric=cadf_metric.Metric( name='storage.objects.outgoing.bytes', unit='B'))) if self.nonblocking_notify: try: Swift.event_queue.put(event, False) if not Swift.event_sender.is_alive(): Swift.threadLock.acquire() self.start_sender_thread() Swift.threadLock.release() except queue.Full: LOG.warning('Send queue FULL: Event %s not added', event.id) else: Swift.send_notification(self._notifier, event) def start_sender_thread(self): Swift.event_sender = SendEventThread(self._notifier) Swift.event_sender.daemon = True Swift.event_sender.start() @staticmethod def send_notification(notifier, event): notifier.info({}, 'objectstore.http.request', event.as_dict()) class SendEventThread(threading.Thread): def __init__(self, notifier): super(SendEventThread, self).__init__() self.notifier = notifier def run(self): """Send events without blocking swift proxy.""" while True: try: LOG.debug('Wait for event from send queue') event = Swift.event_queue.get() LOG.debug('Got event %s from queue - now send it', event.id) Swift.send_notification(self.notifier, event) LOG.debug('Event %s sent.', event.id) except BaseException: LOG.exception("SendEventThread loop exception") def filter_factory(global_conf, **local_conf): conf = global_conf.copy() conf.update(local_conf) def filter(app): return Swift(app, conf) return filter ceilometermiddleware-1.2.0/ceilometermiddleware/tests/0000775000175100017510000000000013234444030023251 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/ceilometermiddleware/tests/test_swift.py0000666000175100017510000005300013234443472026027 0ustar zuulzuul00000000000000# # Copyright 2012 eNovance # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import threading import mock from oslo_config import cfg import six from ceilometermiddleware import swift from ceilometermiddleware.tests import base as tests_base from keystoneauth1.fixture import keystoneauth_betamax as betamax class FakeApp(object): def __init__(self, body=None): self.body = body or ['This string is 28 bytes long'] def __call__(self, env, start_response): yield start_response('200 OK', [ ('Content-Type', 'text/plain'), ('Content-Length', str(sum(map(len, self.body)))) ]) while env['wsgi.input'].read(5): pass for line in self.body: yield line class FakeRequest(object): """A bare bones request object The middleware will inspect this for request method, wsgi.input and headers. """ def __init__(self, path, environ=None, headers=None): environ = environ or {} headers = headers or {} environ['PATH_INFO'] = path if 'wsgi.input' not in environ: environ['wsgi.input'] = six.moves.cStringIO('') for header, value in six.iteritems(headers): environ['HTTP_%s' % header.upper()] = value self.environ = environ @mock.patch('oslo_messaging.get_transport', mock.MagicMock()) class TestSwift(tests_base.TestCase): def setUp(self): super(TestSwift, self).setUp() cfg.CONF([], project='ceilometermiddleware') self.addCleanup(cfg.CONF.reset) @staticmethod def start_response(*args): pass def test_get(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: resp = app(req.environ, self.start_response) self.assertEqual(["This string is 28 bytes long"], list(resp)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(28, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.outgoing.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('get', data[2]['target']['action']) def test_get_background(self): notified = threading.Event() app = swift.Swift(FakeApp(), {"nonblocking_notify": "True", "send_queue_size": "1"}) req = FakeRequest('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info', side_effect=lambda *args, **kwargs: notified.set() ) as notify: resp = app(req.environ, self.start_response) self.assertEqual(["This string is 28 bytes long"], list(resp)) notified.wait() self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(28, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.outgoing.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('get', data[2]['target']['action']) def test_put(self): app = swift.Swift(FakeApp(body=['']), {}) req = FakeRequest( '/1.0/account/container/obj', environ={'REQUEST_METHOD': 'PUT', 'wsgi.input': six.moves.cStringIO('some stuff')}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(10, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.incoming.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('put', data[2]['target']['action']) def test_post(self): app = swift.Swift(FakeApp(body=['']), {}) req = FakeRequest( '/1.0/account/container/obj', environ={'REQUEST_METHOD': 'POST', 'wsgi.input': six.moves.cStringIO('some other stuff')}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(16, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.incoming.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('post', data[2]['target']['action']) def test_head(self): app = swift.Swift(FakeApp(body=['']), {}) req = FakeRequest('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'HEAD'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertIsNone(data[2].get('measurements')) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('head', data[2]['target']['action']) def test_bogus_request(self): """Test even for arbitrary request method, this will still work.""" app = swift.Swift(FakeApp(body=['']), {}) req = FakeRequest('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'BOGUS'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertIsNone(data[2].get('measurements')) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('bogus', data[2]['target']['action']) def test_get_container(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(28, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.outgoing.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) def test_no_metadata_headers(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(0, len(http_headers)) def test_metadata_headers(self): app = swift.Swift(FakeApp(), { 'metadata_headers': 'X_VAR1, x-var2, x-var3, token' }) req = FakeRequest('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}, headers={'X_VAR1': 'value1', 'X_VAR2': 'value2', 'TOKEN': 'token'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(3, len(http_headers)) self.assertEqual('value1', metadata['http_header_x_var1']) self.assertEqual('value2', metadata['http_header_x_var2']) self.assertEqual('token', metadata['http_header_token']) self.assertFalse('http_header_x_var3' in metadata) def test_metadata_headers_unicode(self): app = swift.Swift(FakeApp(), { 'metadata_headers': 'unicode' }) uni = u'\xef\xbd\xa1\xef\xbd\xa5' req = FakeRequest('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}, headers={'UNICODE': uni}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(1, len(http_headers)) self.assertEqual(six.text_type(uni), metadata['http_header_unicode']) def test_metadata_headers_on_not_existing_header(self): app = swift.Swift(FakeApp(), { 'metadata_headers': 'x-var3' }) req = FakeRequest('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(0, len(http_headers)) def test_bogus_path(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/5.0//', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(0, len(notify.call_args_list)) def test_missing_resource_id(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/v1/', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(0, len(notify.call_args_list)) @mock.patch('six.moves.urllib.parse.quote') def test_emit_event_fail(self, mocked_func): mocked_func.side_effect = Exception("a exception") app = swift.Swift(FakeApp(body=["test"]), {}) req = FakeRequest('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: resp = list(app(req.environ, self.start_response)) self.assertEqual(0, len(notify.call_args_list)) self.assertEqual(["test"], resp) def test_reseller_prefix(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/1.0/AUTH_account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("account", data[2]['target']['id']) def test_custom_prefix(self): app = swift.Swift(FakeApp(), {'reseller_prefix': 'CUSTOM_'}) req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("account", data[2]['target']['id']) def test_incomplete_reseller_prefix(self): # Custom reseller prefix set, but without trailing underscore app = swift.Swift( FakeApp(), {'reseller_prefix': 'CUSTOM'}) req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("account", data[2]['target']['id']) def test_invalid_reseller_prefix(self): app = swift.Swift( FakeApp(), {'reseller_prefix': 'AUTH_'}) req = FakeRequest('/1.0/admin/bucket', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("1.0/admin/bucket", data[2]['target']['id']) def test_ignore_requests_from_project(self): app = swift.Swift(FakeApp(), {'ignore_projects': 'skip_proj'}) for proj_attr in ['HTTP_X_SERVICE_PROJECT_ID', 'HTTP_X_PROJECT_ID', 'HTTP_X_TENANT_ID']: for proj, calls in [('good', 1), ('skip_proj', 0)]: req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET', proj_attr: proj}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(calls, len(notify.call_args_list)) def test_ignore_requests_from_multiple_projects(self): app = swift.Swift(FakeApp(), {'ignore_projects': 'skip_proj, ignore'}) for proj_attr in ['HTTP_X_SERVICE_PROJECT_ID', 'HTTP_X_PROJECT_ID', 'HTTP_X_TENANT_ID']: for proj, calls in [('good', 1), ('skip_proj', 0), ('also_good', 1), ('ignore', 0)]: req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET', proj_attr: proj}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(calls, len(notify.call_args_list)) def test_empty_reseller_prefix(self): app = swift.Swift( FakeApp(), {'reseller_prefix': 'CUSTOM'}) req = FakeRequest('/1.0/CUSTOM/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) data = notify.call_args_list[0][0] self.assertIsNot(0, len(data[2]['target']['id'])) def test_head_account(self): app = swift.Swift(FakeApp(body=['']), {}) req = FakeRequest('/1.0/account', environ={'REQUEST_METHOD': 'HEAD'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertIsNone(data[2].get('measurements')) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertIsNone(metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('head', data[2]['target']['action']) def test_put_with_swift_source(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest( '/1.0/account/container/obj', environ={'REQUEST_METHOD': 'PUT', 'wsgi.input': six.moves.cStringIO('some stuff'), 'swift.source': 'RL'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertFalse(notify.called) def test_ignore_projects_without_keystone(self): app = swift.Swift(FakeApp(), { 'ignore_projects': 'cf0356aaac7c42bba5a744339a6169fa,' '18157dd635bb413c9e27686fee93c583', }) self.assertEqual(["cf0356aaac7c42bba5a744339a6169fa", "18157dd635bb413c9e27686fee93c583"], app.ignore_projects) @mock.patch.object(swift.LOG, 'warning') def test_ignore_projects_with_keystone(self, warning): self.useFixture(betamax.BetamaxFixture( cassette_name='list_projects', cassette_library_dir='ceilometermiddleware/tests/data', )) app = swift.Swift(FakeApp(), { 'auth_type': 'v2password', 'auth_url': 'https://[::1]:5000/v2.0', 'username': 'admin', 'tenant_name': 'admin', 'password': 'secret', 'ignore_projects': 'service,gnocchi', }) self.assertEqual(["147cc0a9263c4964926f3ee7b6ba3685"], app.ignore_projects) warning.assert_called_once_with( "fail to find project '%s' in keystone", "gnocchi") ceilometermiddleware-1.2.0/ceilometermiddleware/tests/__init__.py0000666000175100017510000000000013234443472025363 0ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/ceilometermiddleware/tests/data/0000775000175100017510000000000013234444030024162 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/ceilometermiddleware/tests/data/list_projects.yaml0000666000175100017510000003450513234443472027754 0ustar zuulzuul00000000000000http_interactions: - recorded_at: '2017-05-15T07:49:52' request: body: encoding: utf-8 string: |- { "auth": { "tenantName": "dummy", "passwordCredentials": { "username": "dummy", "password": "********" } } } headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive Content-Length: - '107' Content-Type: - application/json User-Agent: - run.py keystoneauth1/2.20.0 python-requests/2.14.2 CPython/2.7.13 method: POST uri: https://[::1]:5000/v2.0/tokens response: body: encoding: null string: |- { "access": { "serviceCatalog": [ { "type": "compute", "endpoints_links": [], "name": "nova", "endpoints": [ { "internalURL": "https://[::1]:8774/v2.1", "adminURL": "https://[::1]:8774/v2.1", "id": "1e879ab434b54b8abfd275feeb2ef9f3", "region": "RegionOne", "publicURL": "https://[::1]:8774/v2.1" } ] }, { "type": "network", "endpoints_links": [], "name": "neutron", "endpoints": [ { "internalURL": "http://[::1]:9696", "adminURL": "http://[::1]:9696", "id": "83fcb786f646437f9a61cef72a9e43d7", "region": "RegionOne", "publicURL": "http://[::1]:9696" } ] }, { "type": "volumev2", "endpoints_links": [], "name": "cinderv2", "endpoints": [ { "internalURL": "https://[::1]:8776/v2/ed980105f9d047e2bee738b3f261f126", "adminURL": "https://[::1]:8776/v2/ed980105f9d047e2bee738b3f261f126", "id": "973ef665c2ea4ec3b5c3d48932fad7a4", "region": "RegionOne", "publicURL": "https://[::1]:8776/v2/ed980105f9d047e2bee738b3f261f126" } ] }, { "type": "volumev3", "endpoints_links": [], "name": "cinderv3", "endpoints": [ { "internalURL": "https://[::1]:8776/v3/ed980105f9d047e2bee738b3f261f126", "adminURL": "https://[::1]:8776/v3/ed980105f9d047e2bee738b3f261f126", "id": "0e80fe643d4d44729db99d0a5c882d1b", "region": "RegionOne", "publicURL": "https://[::1]:8776/v3/ed980105f9d047e2bee738b3f261f126" } ] }, { "type": "image", "endpoints_links": [], "name": "glance", "endpoints": [ { "internalURL": "http://[::1]:9292", "adminURL": "http://[::1]:9292", "id": "7aad24b660a94254adc3546e4de4d668", "region": "RegionOne", "publicURL": "http://[::1]:9292" } ] }, { "type": "volume", "endpoints_links": [], "name": "cinder", "endpoints": [ { "internalURL": "https://[::1]:8776/v1/ed980105f9d047e2bee738b3f261f126", "adminURL": "https://[::1]:8776/v1/ed980105f9d047e2bee738b3f261f126", "id": "8191ee00b695483796a9531bca70279b", "region": "RegionOne", "publicURL": "https://[::1]:8776/v1/ed980105f9d047e2bee738b3f261f126" } ] }, { "type": "identity", "endpoints_links": [], "name": "keystone", "endpoints": [ { "internalURL": "https://[::1]:5000", "adminURL": "https://[::1]:35357", "id": "24ab268f1a7b47d4af493c4c74cd6130", "region": "RegionOne", "publicURL": "https://[::1]:5000" } ] } ], "user": { "username": "dummy", "roles_links": [], "id": "f18b121edda04346b86610fa23983a0e", "roles": [ { "name": "admin" } ], "name": "dummy" }, "token": { "issued_at": "2017-05-15T07:49:52.000000Z", "tenant": { "enabled": true, "id": "ed980105f9d047e2bee738b3f261f126", "name": "dummy", "description": "admin tenant" }, "audit_ids": [ "VzK7yoNFT0qlUWg5KhDuMQ" ], "expires": "9999-12-31T23:59:59Z", "id": "gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c" }, "metadata": { "is_admin": 0, "roles": [ "d3b61a4656d64cbbbdb0f13690e2ffe4" ] } } } headers: Connection: - Keep-Alive Content-Length: - '3183' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:51 GMT Keep-Alive: - timeout=3, max=100 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-84cb5714-49dc-4bab-93ba-2b66ba566c30 status: code: 200 message: OK url: https://[::1]:5000/v2.0/tokens - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - run.py keystoneauth1/2.20.0 python-requests/2.14.2 CPython/2.7.13 method: GET uri: https://[::1]:35357/ response: body: encoding: null string: |- { "versions": { "values": [ { "status": "stable", "updated": "2016-10-06T00:00:00Z", "id": "v3.7", "links": [ { "rel": "self", "href": "https://[::1]:35357/v3/" } ], "media-types": [ { "type": "application/vnd.openstack.identity-v3+json", "base": "application/json" } ] }, { "status": "deprecated", "updated": "2016-08-04T00:00:00Z", "id": "v2.0", "links": [ { "rel": "self", "href": "https://[::1]:35357/v2.0/" }, { "type": "text/html", "rel": "describedby", "href": "http://docs.openstack.org/" } ], "media-types": [ { "type": "application/vnd.openstack.identity-v2.0+json", "base": "application/json" } ] } ] } } headers: Connection: - Keep-Alive Content-Length: - '627' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:52 GMT Keep-Alive: - timeout=3, max=100 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu status: code: 300 message: Multiple Choices url: https://[::1]:35357/ - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects/service response: body: encoding: null string: |- { "error": { "code": 404, "title": "Not Found", "message": "Could not find project: service" } } headers: Connection: - Keep-Alive Content-Length: - '93' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=99 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-6107025c-e09e-437a-90c2-61a559154d32 status: code: 404 message: Not Found url: https://[::1]:35357/v3/projects/service - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects?name=service response: body: encoding: null string: |- { "projects": [ { "enabled": true, "id": "147cc0a9263c4964926f3ee7b6ba3685", "domain_id": "default", "parent_id": "default", "is_domain": false, "name": "service", "links": { "self": "https://[::1]:5000/v3/projects/147cc0a9263c4964926f3ee7b6ba3685" }, "description": "Tenant for the openstack service" } ], "links": { "self": "https://[::1]:5000/v3/projects?name=service", "next": null, "previous": null } } headers: Connection: - Keep-Alive Content-Length: - '440' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=98 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-1915b2be-f116-4831-a7c3-5ba0a32d416f status: code: 200 message: OK url: https://[::1]:35357/v3/projects?name=service - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects/gnocchi response: body: encoding: null string: |- { "error": { "code": 404, "title": "Not Found", "message": "Could not find project: gnocchi" } } headers: Connection: - Keep-Alive Content-Length: - '92' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=97 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-b23e72d3-742e-4e10-b9a7-d1161f1eeab4 status: code: 404 message: Not Found url: https://[::1]:35357/v3/projects/gnocchi - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects?name=gnocchi response: body: encoding: null string: |- { "projects": [], "links": { "self": "https://[::1]:5000/v3/projects?name=gnocchi", "next": null, "previous": null } } headers: Connection: - Keep-Alive Content-Length: - '134' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=96 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-fdeed726-18a4-4e73-bf8d-d24a5b56246e status: code: 200 message: OK url: https://[::1]:35357/v3/projects?name=gnocchi recorded_with: betamax/0.8.0 ceilometermiddleware-1.2.0/ceilometermiddleware/tests/base.py0000666000175100017510000000143213234443472024550 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslotest import base class TestCase(base.BaseTestCase): """Test case base class for all unit tests.""" ceilometermiddleware-1.2.0/.testr.conf0000666000175100017510000000026213234443472020022 0ustar zuulzuul00000000000000[DEFAULT] test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./ceilometermiddleware/tests $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list ceilometermiddleware-1.2.0/CONTRIBUTING.rst0000666000175100017510000000104713234443472020377 0ustar zuulzuul00000000000000If you would like to contribute to the development of OpenStack, you must follow the steps in this page: http://docs.openstack.org/infra/manual/developers.html Once those steps have been completed, changes to OpenStack should be submitted for review via the Gerrit tool, following the workflow documented at: http://docs.openstack.org/infra/manual/developers.html#development-workflow Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: https://bugs.launchpad.net/ceilometermiddleware ceilometermiddleware-1.2.0/LICENSE0000666000175100017510000002363713234443472016754 0ustar zuulzuul00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. ceilometermiddleware-1.2.0/doc/0000775000175100017510000000000013234444030016466 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/doc/source/0000775000175100017510000000000013234444030017766 5ustar zuulzuul00000000000000ceilometermiddleware-1.2.0/doc/source/usage.rst0000666000175100017510000000014513234443472021637 0ustar zuulzuul00000000000000======== Usage ======== To use ceilometermiddleware in a project:: import ceilometermiddleware ceilometermiddleware-1.2.0/doc/source/conf.py0000666000175100017510000000464413234443472021310 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx', 'oslosphinx' ] # autodoc generation is a bit aggressive and a nuisance when doing heavy # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. project = u'ceilometermiddleware' copyright = u'2013, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' # html_static_path = ['static'] # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', '%s.tex' % project, u'%s Documentation' % project, u'OpenStack Foundation', 'manual'), ] # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} ceilometermiddleware-1.2.0/doc/source/readme.rst0000666000175100017510000000003613234443472021767 0ustar zuulzuul00000000000000.. include:: ../../README.rst ceilometermiddleware-1.2.0/doc/source/index.rst0000666000175100017510000000077113234443472021647 0ustar zuulzuul00000000000000.. ceilometermiddleware documentation master file, created by sphinx-quickstart on Tue Jul 9 22:26:36 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to ceilometermiddleware's documentation! ======================================================== Contents: .. toctree:: :maxdepth: 2 readme installation usage contributing Indices and tables ================== * :ref:`genindex` * :ref:`search` ceilometermiddleware-1.2.0/doc/source/installation.rst0000666000175100017510000000034513234443472023236 0ustar zuulzuul00000000000000============ Installation ============ At the command line:: $ pip install ceilometermiddleware Or, if you have virtualenvwrapper installed:: $ mkvirtualenv ceilometermiddleware $ pip install ceilometermiddleware ceilometermiddleware-1.2.0/doc/source/contributing.rst0000666000175100017510000000011313234443472023235 0ustar zuulzuul00000000000000============ Contributing ============ .. include:: ../../CONTRIBUTING.rst ceilometermiddleware-1.2.0/HACKING.rst0000666000175100017510000000025413234443472017533 0ustar zuulzuul00000000000000ceilometermiddleware Style Commandments =============================================== Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ ceilometermiddleware-1.2.0/test-requirements.txt0000666000175100017510000000103213234443472022171 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. coverage>=3.6 # Apache-2.0 python-subunit>=0.0.18 # Apache-2.0/BSD sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 openstackdocstheme>=1.17.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD mock>=1.2 # BSD reno>=0.1.1 # Apache-2.0 betamax>=0.7.0 # Apache-2.0