Commit Graph

25 Commits

Author SHA1 Message Date
David Moreau Simard 4a8711e73c
opendev: Remove content and leave an URL to the GitHub repository
Change-Id: I82a3238b6a8c21e6bb8056aca22ef71af9ea2538
2021-02-25 15:16:53 -05:00
David Moreau Simard b2cccd019c
tests: add a tox target to run benchmarks
Run benchmark with default settings:
    tox -e benchmark

Run benchmark with specified number of hosts or tasks:
    tox -e benchmark -- -e benchmark_host_count=50

Change-Id: I295967c6fb39ec5e02a80b863bde4c57fc6f2139
2020-11-04 09:22:24 -05:00
David Moreau Simard 6ae9af6858
docs: isolate docs requirements and add API server dependencies
This will allow us to build the docs properly for hosting on
readthedocs.

Change-Id: I6770146239350c1b4e0bed880a3bc9c7239eaa79
2019-11-28 10:11:45 -05:00
David Moreau Simard efd667a83d
docs: Add minimal docs for ara-manage
Change-Id: I75105eb0eaf1cfc07b48b50d053bcde352c121f3
Related: https://github.com/ansible-community/ara/issues/76
2019-11-27 22:48:16 -05:00
David Moreau Simard 6bcb1680ba
Re-structure integration tests
- Split zuul.yaml for readability
- Default everything to debug verbosity
- Remove ara-tests, replaced by basic.yaml
- Move tox -e ansible-integration to use basic.yaml

Change-Id: I37209271613b99fc8ad52e9e7286f8979e74c168
2019-06-20 10:22:27 -04:00
David Moreau Simard 6d00938099
Make API server deps optional, move them to extras
This makes it so "pip install ara" would only install a minimal
amount of dependencies (pbr and requests as of this commit) required
for running the Ansible callback plugin as well as ara_record.

The server dependencies can be installed by running
"pip install ara[server]".

Fixes: https://github.com/ansible-community/ara/issues/36
Change-Id: I67769d28ec24cade7753230dffd0b049358af29a
2019-05-03 16:01:30 -04:00
David Moreau Simard 4218c270a0
tox.ini: use envtmpdir for ephemeral data and allow custom base dir
ARA_BASE_DIR can be set to easily use "tox -e runserver" to load
a database at a particular location, for example.

Change-Id: If959b4217205bc27b9cf4d3f1b0595016f6805b5
2019-03-26 21:02:17 -04:00
David Moreau Simard c291f57e3a
Streamline integration test role and make it easier to run
- Rename the "integration-tests" role to "ara_tests" in order to be
  in line with the other roles
- Add an "ansible-integration" tox environment which takes care of
  installing Ansible and running a playbook which includes the ara_tests
  role.
- Add docs and improve existing docs

Change-Id: I0d272744bb27f2c923ef992d1b64de0032849f0e
2019-03-26 12:54:46 -04:00
David Moreau Simard 3b6b291967
Use whitenoise for serving static files
The usage of static files in the ARA API server is very limited.
They are used for displaying the API browser from django-rest-framework
and the Django admin interface.

By using whitenoise, Django can serve static files through "manage.py
runserver" and through the WSGI application without needing to enable
debug mode or adding specific routes.

This allows us to simplify the deployment a bit because we no longer
need to collect static files.
We're also taking this opportunity to simplify configuration a bit by no
longer exposing the following configuration options:

- STATIC_ROOT
- STATIC_URL
- MEDIA_ROOT
- MEDIA_URL

They'll still be loaded but there is no longer a use case for being able
to change the defaults -- at least for the time being.

Change-Id: I9fc853e84b3739fca574afcd2da799dc8c1fbad6
2019-03-07 15:39:13 -05:00
David Moreau Simard 3d5efff28c
Replace the ansible-integration job by the new integration jobs
ara-infra now provides a new and improved set of integration jobs
so we no longer need to have the ansible-integration job.

These new jobs test ara-server, ara-clients and ara-plugins against
a variety of operating systems and versions of Ansible.

It was convenient to be able to run these tests from ara-server by
itself, we'll re-introduce a wrapper so we can continue to do so
later.

Depends-On: https://review.openstack.org/#/c/630303
Change-Id: Iedf259e44af5165be08c5d6917e5af98b281202d
2019-01-23 13:44:28 -05:00
David Moreau Simard 8b8bc03f7c
Create a persistent default random secret key if none are set
If there are no SECRET_KEY or ARA_SECRET_KEY environment variables
set or if there is no configuration file with the SECRET_KEY variable
set, settings.py will generate a random secret key once and it will
be persisted to the default configuration.

Change-Id: Idf2f1ee5f8a70bc2411de51a154bc4504705d89a
2019-01-15 11:41:51 -05:00
Florian Apolloner fdcc003fd9 Made dynaconf integration more explicit.
Change-Id: I9557a0da5b1c643acc3581abc9e56b58f4df8bc9
2018-12-20 18:46:02 +01:00
David Moreau Simard 16aa41eaf8 Refactor configuration to use dynaconf
This changes the configuration engine from everett to dynaconf.
dynaconf allows loading configuration from files (json, ini, yaml, toml)
as well as environment variables prefixed by ARA_.

Our usage of dynaconf is similar to the use case from the Pulp [1]
project and they have documented an issue when loading database
parameters [2]. This issue is worked around by importing dynaconf in the
different entry points.

This introduces some other changes as well:
- We're now creating a default configuration and data directory at
  ~/.ara. The location of this directory is controlled with the
  ARA_BASE_DIR environment variable.
- We're now creating a default configuration template in
  ~/.ara/default_config.yaml.
- The default database is now located at ~/.ara/ara.sqlite. The location
  of this database can be customized with the ARA_DATABASE_NAME
  environment variable.
  Note that ARA 0.x used "~/.ara/ansible.sqlite" -- the file name change
  is deliberate in order to avoid user databases clashing between
  versions.

More documentation on this will be available in an upcoming patch.

[1]: https://github.com/pulp/pulp
[2]: https://github.com/rochacbruno/dynaconf/issues/89

Change-Id: I8178b4ca9f2b4d7f4c45c296c08391e84e8b990d
2018-12-20 17:53:11 +01:00
David Moreau Simard 90ac1acc51
Move manage.py to ara.server.__main__ and add an entry point
This moves manage.py inside the package and sets up an "ara-manage"
console entry point for doing something like "ara-manage runserver"
instead of "python manage.py runserver".

Putting this under __main__ also allows users to do "python -m
ara.server".

Change-Id: I86b57f11fed2fea0295b1980e2734e35289d84f3
2018-12-06 16:14:11 -05:00
Florian Apolloner 05915224d7 Allow configuration of settings via config files.
Change-Id: I3ac35ef56453f5cc7ab0fd3ffc0816a9e89b7b55
2018-10-22 19:48:52 +02:00
David Moreau Simard 1f205e2ad9
Merge the tox-pep8 and tox-format jobs and use tox-linters
black and isort fit into the category of linters.
Let's run everything from the same job so we can avoid wasting time
and resources from the CI infrastructure.

Previously, tox would exit immediately if there was an error with
black, preventing isort from running. You could then run into a
situation where you also had an issue picked up by isort.

Now bash will run all linters and return the appropriate
return code at the end.

Change-Id: I81abe61be65bd9f4f828cfc5f0b7a1d9f1eb1f22
2018-10-16 17:02:32 -04:00
Florian Apolloner c653d6a2c5
Added CI for black/isort.
Change-Id: Ib93e64fe1584210d1fe5dce6e0455f0ade0dacca
2018-10-02 09:50:15 -05:00
Florian Apolloner 6b6a206db8 Fixed tox warning.
I get:
  /home/florian/.local/venvs/tox/lib/python3.6/site-packages/tox/config.py:536: UserWarning: Conflicting basepython for environment 'py35'; resolve conflict or configure ignore_basepython_conflict
     testenv_config.envname, str(value), default
on newer tox versions.

Change-Id: I91ed0cf71ba81bf8bc4734ee310177aebbea32d7
2018-09-29 19:45:31 +02:00
Florian Apolloner 0d556051a0 Only ara is a namespace package, subpackages are not.
Change-Id: I3cdb501da1380acf53eaf8facab01be4b7187c67
2018-09-28 08:31:09 +02:00
David Moreau Simard 5772648b1a
Temporarily ignore Bandit test B303 for insecure sha1 usage
Our usage of the sha1 method is only to hash the contents of files so we
don't store a single file more than once.
We can likely use something more "secure" but let's temporarily disable
this check for now.

Change-Id: Ie7b07e489e6c442f34fc9930713b9dfdfa530aaf
2018-09-05 10:08:01 -04:00
David Moreau Simard 64df7943a4
Add a basic job to test integration between server, clients and plugins
The callback has been moved to ara-plugins.

Change-Id: Idf364871b0f1783b57332a992a0dcd0784353f80
2018-06-20 11:47:55 -04:00
Guillaume Vincent a14228c902 Fix flake8 and bandit tests
* enable voting job on pep8 tox env
 * fix pep8 tox job
 * add db.sqlite3 in ignore file

Change-Id: If11fb74553a6f1cb986cbed17e0fc8386d08c032
2018-06-20 12:39:48 +00:00
David Moreau Simard 1abe276bae
Refactor ara-server into namespaced python modules
This is a structure that will allow us to install everything under
"ara" as separate packages but inside the same module.

For example, installing ara-server will provide ara.server and
ara.api.
Installing ara-clients will provide ara.clients, ara-plugins will
supply ara.plugins, etc.

Change-Id: I27ee431c4e5d946f558befc12937ba2f3c0d020b
2018-06-20 08:38:49 -04:00
David Moreau Simard 68cbbe24bc First iteration of callback using API
- Remove mockdata.py (using the callback is better)
- Add first iteration of callback
  Note: This will eventually be moved, it's here for simplicity
- Add test playbook/role to exercise the callback

Note: The callback will be moved to ara-plugins

Change-Id: I8f590be4cfafd4714f40f4165e2973cb803b8756
2018-06-20 12:14:56 +00:00
David Moreau Simard 5fbbdac265
Bootstrap the repository with the basic machinery (#1)
- Make the project installable with pbr
- Use tox to run tests, build docs, runserver
- Flesh out the README a little bit
- Real docs is WIP.

Change-Id: I3dc92250cd93add0cdf11c6a67d8f1081560d4e1
2018-03-29 12:36:22 -04:00