The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.
Change-Id: I781b979d11c3b974701ae38574899e6160fdc6bb
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I9f7227ec5ed4d84efd36d87fec7f0536276fc151
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found by updated hacking version.
Remove hacking and friends from lower-constraints, they are not needed
there.
Change-Id: I7614df314c211dc3acca2e3e8cb647bddddd6c16
The change updates the imports to use simplejson instead of ujson and
monasca_log_api.common.rest instead of monasca_common.rest
Temporarily set monascalog-python3-tempest as voting false
This is an alternative to this change
https://review.opendev.org/#/c/724658/
Change-Id: Iae94376b38cae8a1eb8aa6a704fc2ca5d383adaf
Story: 2007549
Task: 39601
Use rpartition instead of replace to do a more targeted stripping of
path to render a correct base_uri.
Change-Id: Idc2a5a6bd0e9e2675883f2188d4856b01ba5fdb8
Story: 2006147
Task: 35643
Falcon 2.0.0 introduces some breaking changes. The relevant ones here are:
- falcon.testing.TestCase.api property was removed
- falcon.testing.TestBase class was removed
- falcon.HTTPRequestEntityTooLarge exception was renamed to
falcon.HTTPPayloadTooLarge
Additionally, the default behaviour for handling trailing slashes on
URIs also changed:
https://falcon.readthedocs.io/en/latest/user/faq.html#how-does-falcon-
handle-a-trailing-slash-in-the-request-path
This commit adds support for using the new release.
Story: 2005695
Task: 33474
Change-Id: I2379522efef81b919098a0143b66cc259a184e70
log-api.conf is the deprecated path for the configuration file. The
new path is /etc/monasca/monasca-log-api.conf .
Change-Id: Ib58d926c1551a6eade66127b7d05a16a311f87f0
Story: 2004831
Task: 29023
The constants used for configuring default policy rules were initialized
before configuration file was parsed. As the result the configuration
options in 'roles_middleware' group didn't have effect on registered
policy rules. The behavior can be reproduced in devstack plugin where
monasca-log-agent using 'monasca-agent' role is not authorized to send
logs to the API.
The change postpones the initilization of these constants. Additionally
obsolete 'roles' filter was removed from the paste pipelines.
Change-Id: I0ca38f2cc7d63b9b47eedb304ba7b00a94816f9a
Story: 2001233
Task: 24250
Added policies and used policy enforcement engine
from monasca-common.
- Updated role_middleware to remove authorization into the routes.
- Updated unit tests and implemented some new tests.
- Added a new entry point for generating sample policy file by tox.
story: 2001233
task: 22086
Change-Id: I3d199fac244eca94fc434d19c78bc5a17e804c37
Signed-off-by: Amir Mofakhar <amofakhar@op5.com>
Change oslo config to support valid IP addresses and valid
host domain names for statsd host.
Change-Id: I4f9a136f2183be8adfd1456e0e65da17e461cf56
Story: 2002596
Task: 22207
The builtin type 'unicode' does not exist under python 3. The runtime
check here is already looking at the python version, but the linter
does not perform the same check and it fails because the name is not
defined. Replace the explicit use of unicode here with six.text_type
so that the linter is happy.
Change-Id: I22a13fddaed1338c0f3e670d199bb6aa5f99bbf7
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* Partial revert of 0a82af18ab
to restore main() method
* Add global `application` variable which will be set by main method to
problem to preserve the fix from 0a82af18ab.
* Add check for application name starting with '_mod_wsgi' to ensure
application runs in Devstack as well (Devstack does not use the entry point)
* Modify Devstack plugin to run WSGI entry point rather than app/wsgi.py from
module directory.
Change-Id: I07001dccb663ed4e6e3347089ab96e6f8ec196d4
Story: 2001197
Task: 5702
Old project tree had everything mixed up
in different locations. Not to mention
that actual REST controllers resided in
package that's name did not reflect the content.
Reorganized the tree to be more predictable
and easier to maintain.
Change-Id: Ic9acc80a4cf7416394702d43141c96953c03beea
Passing any CLI arguments to log-api is not possible
for the case where it runs under gunicorn server.
Gunicorn's argument parsing processes clashes with oslo's.
Effectivelly that means that either of them cannot understand
the arguments of another. However log-api is capable of being launched
under, for example, apache_mod-wsgi.
That permits passing oslo CLI arguments.
Added simple method that detect the executable that was used to run
log-api. If that is not gunicorn, CLI opts will be enabled.
Otherwise log-api will print out warning and proceed as it was.
Extra:
* reworked to use fixtures
Change-Id: I6b2fc386aeb823ab735270ffc1d3f7e15985830f
It is common for OpenStack projects to use oslo-config-generator to generate
a sample config file which contains all available configuration options.
Work items:
* removed etc/monasca/log-api.conf (it is autogenerated)
* keep all config in one place to mimic the configuration file
* added configuration files to documentation
Story: 2000970
Task: 4121
Change-Id: I8777ed6cd38739e87b19be248b9c120e84626ad1
Migration of Openstack Project is held in
*.rst files and build with Sphinx.
Following change provides:
* technical documention
* api guide
* api ref
* releasenotes
Note:
For now, generating codebase documentation is disabled.
It caused gate failures because of, yet unnown, reasons.
In order to pull this foundation, this part is skipped.
Extra:
* provided venvs descriptions to let user know what is the scope
Story: 2001058
Task: 4665
Change-Id: Ieb2b58e165de1617748d97d997af368bd91d5c0e
Currently mod_wsgi returns the following error:
Target WSGI script '/var/www/monasca-log-api/monasca_log_api'
does not contain WSGI application 'application'.
Also fix a type in README.
Change-Id: Ic70c3ddb8aaa076c09fc2434f6e890be24b599d5
Added proper handling of unicode messages by expiclit
usage of unicode and utf-8 encoding for Python2.
For Python3 it was just sufficient to ensure that message
is properly UTF-8 encoded. Results of that change can be examined
inside Kibana (or using link [2]).
To prevent any regression, a set of unicode messages has been
added. It contains:
* 'Unicode is evil...' sentence translated to several languages
* border conditions of UnicodeStressTest [1]
* some funnier examples just because programming is fun
Extra:
* unified setting up API test case
[1]: http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
[2]: https://pasteboard.co/x9gQqicR.png
Story: 2001084
Task: 4734
Change-Id: I36e3c2f1ea5788ecb19089089d84924b7d6666bf
Add mixin class to mock monascastatsd to avoid error about connection
to the daemons. Add new 2 classes which inherits from mixin class
and oslotest, falcon depending on the test.
Change-Id: Ib44357d9355400f603f76bf2a99fc89c05eae831
Following commit introduces using composite
paste file to describe application pipelines.
With the help of composite feature it was possible to
define 4 distinct supapplications, each having different
pipeline setup:
* version_app => no keystoneauth, simple data return with error trap
* healthcheck_app => no keystoneauth, simple data return with error trap
* api_v2 => as it was, added error_trap though
* api_v3 => as it was, added error_trap though
Following approach opens up the possibilities of modelling an API
in far more flexible way and removes the need of any hacking inside
the codebase.
Note:
Keeps backward compatibility with older codebase.
Extra:
* removed dirty hack around skipping certain request.path
in keystonemiddleware (now described in paste file)
* removed 404 when issuing ```curl api_host:api_port/```. Request
is redirected down to VersionApp
Depends-On: I0323eacb5cbba8418550e3322189104c35cf4c36
Change-Id: I873e1376665c8cf66c8ee503975324f9b93ddb45
We should avoid using six.iteritems to achieve
iterators. We can use dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will more readable.
Change-Id: I974a9e5001266aab878bf77af001d1ba61d761e2
Initial groundwork for the implementation of the log listing API.
This comprises interface extensions to the HTTP API, and the beginnings
of a repository model in keeping with the design of the monasca-api.
Change-Id: I5bc641b01f260c3e4e062ff8a2b4014cbe807f3c
Partially-Implements: blueprint log-query-api
Story: 2000934
Task: 4058
Following commits adds possiblity to run monasca-log-api
with Apache2 (mod_wsgi) in devstack environment.
Change-Id: I4aca9bebacb4799a0e45b785ba1997003c6b7165
Similar to other openstack projects,
monasca-log-api should provide information
about request's context in the log information.
This is done by:
* implementing custom Request that creates context (oslo.context)
* changing logging configuration to use ContextLogFormatter
Additionally, since information like tenant-id can be
retrieved from the context, modified resource code to use
that.
Change-Id: I992a2f4de64b54a705cc2bafdb3e83de0b1691c7
Following commits drops Java implementation of monasca-log-api,
which is no longer maintained and at given point contains
no feature that Python implemention has.
Depends-On: I892aad540a63db822e416c13f298270b33cc5f53
Change-Id: Id7b2c27136ab91fe9126585bde1bb6f0540549b8
* sending 'None' as a request body implies header
'Content-Length: 0', but the test was expecting
no header.
* invalid parameters were passed to call_until_true
Depends-On: Icce74fd6d7e674f408277e328468bedbc3d0aa6b
Change-Id: Ia4fc7cdec0a38d0b46aadfedd6cc9919edaa1963
Some of tests use different method of assertTrue(isinstance(A, B))
or assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B)
provided by testtools
Change-Id: Ia94ff8a08d298e5e90bfdefca00a9ff0efa31053
In python 3, range() does what xrange() used to do and xrange() does not
exist. If you want to write code that will run on both Python 2 and
Python 3, you can't use xrange().
range() can actually be faster in some cases - eg. if iterating over the
same sequence multiple times. xrange() has to reconstruct the integer
object every time, but range() will have real integer objects.
(It will always perform worse in terms of memory however)
xrange() isn't usable in all cases where a real list is needed.
For instance, it doesn't support slices, or any list methods.
Change-Id: Ibe90272e96eea042f78038ec1029a5ca8e8669d8
By default log file is rotated after reaching size of 100MB and 5 files
are archived.
Closes-Bug: 1621329
Related Change-Id: Iac7f29b3909354f75e5d3264ef2c987c9f3e2aec
Change-Id: I8d7e071e899eca1247b2db56ea348bb8775d68c3