Commit Graph

99 Commits

Author SHA1 Message Date
David Moreau Simard 33e4c1d841
Update README to explain ara-server was migrated back into ara
The ara-server standalone repository is being discontinued.
The clear and logical separation of components was nice but the overhead
in complexity was not worth it.

Change-Id: I9d5e3096db4972405932ae2af46ee63bfeef43b5
2019-03-02 08:47:26 -05:00
David Moreau Simard c0021b3e05
Use DurationSerializer for the results, they have a duration
DurationSerializer provides the duration of items that have "started",
"updated" and "ended" fields.

Change-Id: Ieeab1e1cc046b7ec52a0f86c5a38fe9c9ec6f7ad
2019-02-20 10:06:20 -05:00
Guillaume Vincent d3de8af4c8
Allow get results with multiple statuses
Change-Id: Id649fa95e908ba69d3e95502a47e203496e5b79e
2019-01-30 16:30:00 -05:00
Florian Apolloner c703bf8245 Added support for external auth via REMOTE_USER provided by webservers.
Change-Id: If36c3406c1a0d991633e08657e1441c322b3cf9d
2019-01-25 17:01:40 +01:00
Florian Apolloner ee8e1aa5ee Added very basic read/write authentication.
Auth is performed via basic auth, create a user in the admin if you want
to get access.

Change-Id: Ie6a4f7e440387b4472661284408213872f453473
2019-01-24 17:07:31 +00:00
Florian Apolloner 600a189b21 Renamed most of config to settings and dropped the default_ prefix.
Dropping the default prefix from the default settings file allows a user
to run an ARA production config by just changing that file. This seems
more in line with default configuration search paths of most other
programs out there.

Since the generated SECRET_KEY should be safe, there should be no
problem in reusing the generated file.

Change-Id: I1cfbc04cba378d7bda9386b344efae85b3490296
2019-01-16 13:56:37 +01:00
Zuul 2c8eb916b2 Merge "Fixed config code example if the path has spaces." 2019-01-16 12:47:17 +00:00
Zuul dd5f26fd14 Merge "Fixed default configuration loading and do not write default config if a config is specified." 2019-01-16 02:13:51 +00:00
Florian Apolloner 9c7c7c474f Fixed config code example if the path has spaces.
Change-Id: I3a9dd03c9957cde335a8d37b88bbfe257492012a
2019-01-16 02:09:50 +00:00
Zuul d29209dc17 Merge "Add Tasks, Records and Plays to Playbook serializer" 2019-01-15 23:19:14 +00:00
Florian Apolloner 5bae31785f Fixed default configuration loading and do not write default config if a config is specified.
Change-Id: I671f59256bbc5a5d5c68e3bfbabfd26375fbb406
2019-01-15 20:37:52 +01:00
David Moreau Simard e47f5afb2e
Load logging from settings.py to tell users about the things we do
This will tell them:
- If we created SERVER_DIR (info)
- If we generated a random SECRET_KEY (warn)
- What configuration file (ARA_SETTINGS) is in use (info)

Change-Id: I6a1bbc0032fc1d73859e9c7c3efec463e1574416
2019-01-15 11:41:53 -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
Guillaume Vincent ca5c065b18 Add Tasks, Records and Plays to Playbook serializer
Change-Id: Ic2456f021107d9397ea561fbc9a60661c34b5f2c
2019-01-15 16:01:48 +01:00
David Moreau Simard 6519a91289
Serialize the value provided by ara_record
We need to serialize the value provided by ara_record since
the values can be structured data such as lists, dicts or json.

Editorial note: the value field in ARA 0.x was already serialized
so this is considered a bug fix.

Change-Id: I9beea4a755db077806952d3fdf7cbb04aaad3209
2019-01-14 15:15:38 -05:00
Florian Apolloner 39339053ec Added endpoint exposing ara and python version.
Change-Id: Ic0fead79c0b87d87b990cc6c6526a44414a4546e
2018-12-21 11:39:30 +01: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
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 c5890ea0cc
Add playbook filtering by status
This allows to search playbook by status (running, failed, completed,
etc.)

Change-Id: I05bba5611bb1f18e48791d570575b6f57c5862d9
2018-12-06 18:03:43 -05: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
David Moreau Simard 1e2a936a18 Add record filtering by key
Change-Id: Iea6cae697a64b75ffda070f909d2fc5382ad9a82
2018-11-20 14:53:26 +00:00
David Moreau Simard cd66991bd1 Add record filtering by playbook id
Change-Id: Iadb7840e09f35f8e6bfd5c360edd4b3be7f7f5e4
2018-11-20 14:53:19 +00:00
Zuul d886b6012b Merge "model: change task.completed to task.status" 2018-11-15 16:44:41 +00:00
Zuul 34953a4783 Merge "model: change play.completed to play.status" 2018-11-15 16:43:51 +00:00
Zuul 41aaa10e0e Merge "Rewrite config error messages to be more instructive." 2018-11-14 21:09:23 +00:00
David Moreau Simard 2d7d15af49
model: change task.completed to task.status
We want a bit more granularity regarding the status of the
tasks, "completed" is not enough.
In 0.x, the status was inferred at runtime. We'll set it so we don't
need to compute it every time.

Change-Id: Idf2dbe9cde1b0cc8da1cbb7fe94894f1a06ea9cd
2018-11-14 14:42:22 -05:00
David Moreau Simard 2fc776a95f
model: change play.completed to play.status
We want a bit more granularity regarding the status of the
plays, "completed" is not enough.
In 0.x, the status was inferred at runtime. We'll set it so we don't
need to compute it every time.

Change-Id: I0184aab6cf1f839165fdcfdab4b7f567ec44442e
2018-11-14 14:42:22 -05:00
David Moreau Simard 9edb01ad32
Reduce page size from 1000 to 100
1000 items per page is kind of big.
100 is still big but it's a better default number to start with.

Change-Id: I2759fe14e638e784afd017018b0ecaa474e2d39a
2018-11-14 14:21:44 -05:00
Florian Apolloner fe9c590bca Rewrite config error messages to be more instructive.
Change-Id: I56a34244d13615e79f7b727eee568eadbed403a6
2018-11-10 14:35:21 +01:00
Florian Apolloner ddf4d9f526 Fixes parsing of lists in config files.
Sadly everett parses lists wrongly in configObj, this patch disables it
and also aborts after the first found config file (like the docs
suggest).

Change-Id: Ib1d94a7c523c42087e20f959e6133f4d9e220f4d
2018-11-05 20:45:01 +01:00
Florian Apolloner 05915224d7 Allow configuration of settings via config files.
Change-Id: I3ac35ef56453f5cc7ab0fd3ffc0816a9e89b7b55
2018-10-22 19:48:52 +02:00
Zuul da5af07d3d Merge "Use playbook.updated instead of "now" for calculating duration" 2018-10-17 15:31:47 +00:00
Zuul ed0247dabe Merge "One does not simply send emails to gvincent *scnr*" 2018-10-17 15:03:37 +00:00
Zuul 9060fc1ec4 Merge "Removed default search and ordering filters." 2018-10-16 23:28:30 +00:00
Zuul f1d33a1709 Merge "Add DjangoFilterBackend to default DRF filter backends" 2018-10-16 23:28:16 +00:00
Zuul 42e1278925 Merge "Add stats filtering by host" 2018-10-16 22:46:06 +00:00
Zuul 638816755e Merge "Add result filtering by status" 2018-10-16 22:46:05 +00:00
Zuul 8f8ea1a9f7 Merge "Add result filtering by playbook id" 2018-10-16 22:46:04 +00:00
Zuul 8abaa5f399 Merge "Add stats filtering by playbook id" 2018-10-16 22:46:04 +00:00
Zuul 2d2942f0ec Merge "Add host filtering by playbook id" 2018-10-16 22:46:03 +00:00
Zuul cbf81c8abd Merge "Add task filtering by playbook id" 2018-10-16 22:46:03 +00:00
Zuul 66ff45cc5e Merge "Add play filtering by uuid" 2018-10-16 22:46:02 +00:00
Zuul 53118108f7 Merge "Add play filtering by playbook id" 2018-10-16 19:58:31 +00:00
Zuul fd9ebc2795 Merge "model: change playbook.completed to playbook.status" 2018-10-16 19:41:35 +00:00
Florian Apolloner d6af2dfb3c One does not simply send emails to gvincent *scnr*
Change-Id: If41ad66431c636fc851b5fba3cf8408653f0dcf0
2018-10-16 21:36:11 +02:00
Florian Apolloner 065d6e8b3a Removed default search and ordering filters.
Removed the default search filter because django-admin-like FTS is not
something we want.

Removed the default ordering filter because it enables ordering by all
fields by default which can result in security issues.

Change-Id: I4438d592982a61a1b33956804ecf7769e41197c3
2018-10-16 21:29:33 +02:00
David Moreau Simard 7265ac64ee
Add DjangoFilterBackend to default DRF filter backends
This makes it so it's not required to add to every viewset.

Change-Id: Ibd1a9bde4750424c34986ada97d15550e2ba5e85
2018-10-16 14:51:17 -04:00
David Moreau Simard 299883fd35
Add stats filtering by host
Change-Id: Ib716398e45a9cd4ce9aef1308339c347aab95449
2018-10-16 13:27:29 -04:00
David Moreau Simard 63878f733e
Add result filtering by status
Change-Id: I8c4e8e4bbb6f0957b8c42a0328e00b12129d717a
2018-10-16 13:25:15 -04:00