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 201a8d95f4
CLI: Port "ara playbook list" command from ara 0.x
This is the first command being ported and so it includes the base
framework for integrating other commands with cliff.

The docs are also re-arranged to include the new commands, some
examples, as well as the existing ara-manage commands.

Change-Id: Ia758e4b70ec0a6821e97b5b66d123dfe33cc63d3
2020-07-15 22:10:00 -04:00
David Moreau Simard 416c16b95e
Add a comment in requirements.txt about location of server deps
Change-Id: I8d011668f3cb470b70e69dcf0e21056b5b031dc7
2019-06-02 21:19:29 -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 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 4fb1b9049f
Repository merge: reconcile ara-clients back into ara-server
This merge commit recovers the ara/clients directory from the
ara-clients project along with the commit history since it is being
retired.
2019-03-01 14:05:02 -05:00
Florian Apolloner 47dc0ad989 Fixed XSS issue from DRF.
Details in https://github.com/encode/django-rest-framework/issues/6330

Change-Id: Icea25569b92c3559029ae1c93712e746684187f1
2019-01-17 22:40:43 +01:00
Florian Apolloner cf2bda747b Adjusted requirements to include yaml for dynaconf.
Change-Id: I5eccfde22fdd0725d41258bc4acc7fe771289874
2019-01-15 18:11:38 +01:00
Florian Apolloner 1039878100 Updated Django dependency to 2.1.5
This is needed so that
e1721ece48 (diff-f6d1c75ec606389da5af6558bf57f171)
is included and saves us from having compat code in https://review.openstack.org/#/c/617112/1

This is also a good idea in preparation of the Django 2.2 release which
will be LTS and probably the version ARA should target.

Change-Id: I36d74c6c0a0165dd1ceaf695185809af5d6da18e
2019-01-04 17:01:42 +01:00
David Moreau Simard 71a2e122d7
Remove requirement on django-environ
It was used in the previous implementation of settings.py which has
since been replaced with dynaconf.

Change-Id: Id8bca7a35cbc817120e04d3fc6247eaee48bef01
2018-12-21 10:04:18 -05:00
David Moreau Simard 2bd8c3f654
Refactor and standardize how files are added to playbooks
Files are now (once again) related to playbooks.
We expect the playbook to be created first and then it's files are
created and associated to it.

- the /api/v1/playbook/<id>/files endpoint was removed
- the playbook id is now required when doing a POST on /api/v1/files
- playbook.file referenced a file object and no longer exists.
- playbook.file was replaced by "path" which is the path for the playbook
  file.
- playbook.files still exists but, from an API standpoint, this means
  that to find the files associated to a playbook, we can now do
  something like:

    "/api/v1/files?playbook=%s" % playbook.id

To find the playbook file itself, we can do something like:

    "/api/v1/files?playbook=%s&path=%s" % (playbook.id, playbook.path)

Change-Id: Id51129757e1626313caee4005b081027e5694aba
2018-12-20 17:49:01 -05: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
Florian Apolloner 05915224d7 Allow configuration of settings via config files.
Change-Id: I3ac35ef56453f5cc7ab0fd3ffc0816a9e89b7b55
2018-10-22 19:48:52 +02:00
Guillaume Vincent fef942b62f
Add search by name on playbook endpoint
Change-Id: I1ffb958aff4aa466cb15e3e2c2e9f0bb28207224
2018-10-16 09:48:33 -04:00
David Moreau Simard 8834105645
Add requests to requirements.txt
It was forgotten when adding in the http client
and ara-clients no longer worked when we started
not installing ara/ara-server for nothing.

Change-Id: I056d1a2822cddb2a6058a86fa5cccef8e810ee2e
2018-09-28 19:21:44 -04:00
Florian Apolloner 028010c9b0 Dropped hard dependency to ara-server.
It is only required for the offline client.

Change-Id: I80c66bcc097150cd23e48c2a2cfca7139e0c8e66
2018-09-28 15:32:27 +02:00
Florian Apolloner 509bbb8486 Small cleanups for django best practices.
Changes include:

 * Custom admin app config instead of monkey patching attributes.
 * DRF Routers & Viewsets instead of manual view configuration.
 * nested viewsets from drf-extensions (for now) to scope files to playbooks.
 * Removed media serving since runserver does this alreay in dev;
    deployment will need another option anyways.

Change-Id: I409bd3f7faa5f133fcb204613baebf2512d34c1a
2018-09-28 08:51:36 +02:00
Florian Apolloner 6590ecdf45 Fixed namespacing to use python3 style namespace packages.
Note: the egg name is not allowed to have a dash, because that is
interpreted as version by at least pbr.
See https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

Change-Id: Ib6666e4aee84a54050a5788de1c12ca36aa130ce
2018-09-27 19:16:48 +02:00
David Moreau Simard 6a1dd890f0
Add CORS middleware for webapp development
Otherwise it won't work because the API server listens on 127.0.0.1,
not localhost.
The right fix is probably to set the nodejs server to start on
127.0.0.1, though.
Figure this out later.

Change-Id: I260e794e8ff842f6b854d313d6c243e431220fcd
2018-09-05 10:08:01 -04:00
David Moreau Simard d50ebdd1a3
Add ara-server to ara-clients requirements
The default offline client requires django and the rest of the
things.

Change-Id: Ice97247a20b0e49c155aac3fc27a67a969a5e570
2018-06-20 09:22:33 -04:00
David Moreau Simard 353293f1ad
Bootstrap the ara-clients repository
This is the basic machinery to make it installable and things like
that.

Change-Id: I618ae1a8680ec2275fcf813b1efca4fe180fae3f
2018-06-20 00:18:16 -04:00
David Moreau Simard fe079a66fc
Bump Django to >2
If we're starting something from scratch, we might as well do it on the
new release of Django.

Change-Id: I9b82fdb02aa0f38f8a7c6ec970e8abb835468ed5
2018-03-29 12:36:23 -04: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
Guillaume Vincent 3d42296683
Remove DRF nested router and make api flat
Change-Id: Ib71519b9fab19d58b23467b811bc7aa482c1455b
2018-03-29 12:36:20 -04:00
Guillaume Vincent a889a71bcd
💥 first commit
Change-Id: I42df36220dce581a929c604a13bba0ccb3d580e6
2018-03-29 12:36:14 -04:00