Commit Graph

28 Commits

Author SHA1 Message Date
Andreas Jaeger e88f6b747a Retire craton
Remove everything, add a README with explanation.

Change-Id: I7c8fcfac0d904f144b6a3838d25db0987d1e74a5
2018-01-18 15:22:28 +01:00
Thomas Maddox 606926b89d JSON Path-like querying for variables
This patch implements the ability to query for values
in nested variable documents. For instance, if we had
hosts with a variables that look like:

{
    "hardware_profiles": {
        "disks": [
            {
                "manufacturer": "seagate",
                "capacity_quantity": 2,
                "capacity_unit": "TB"
            },
            {
                "manufacturer": "western",
                "capacity_quantity": 3,
                "capacity_unit": "TB"
            }
        ]
    }
}

and we wanted to grab all of them with a disk that was
manufactured by Seagate, we would like to be able to
query like so:

GET /v1/hosts?vars=hardware_profiles.disks[*].manufacturer:"seagate"

This does modify the variables query to expect valid JSON
values. So, strings need to be quoted, for instance.

Change-Id: Id597d3e57d2e28766fecd1b314f53176543e1b9d
Closes-Bug: 1671116
2017-03-28 15:23:52 +00:00
Thomas Maddox 6884f8ff8c Move to MySQL 5.7 and SQLAlchemy>=1.1.0
In an effort to support JSON Path variable
queries, we need to:
* Pin to MySQL 5.7
* Use JSON column type
* Use a newer SQLAlchemy library.

Change-Id: I98ae021c9cd9755f51e67e56135db164e8ae1f50
Partial-Bug: 1671116
Depends-On: I36b7ae9cf68aeef0e5dbcb1f17db52b81efd6ffe
2017-03-21 21:22:55 +00:00
OpenStack Proposal Bot 1cfaa93f21 Updated from global requirements
Change-Id: I8486a2cb0a9e6e075f5975a48f24b5d667efe2c2
2017-03-02 11:43:35 +00:00
OpenStack Proposal Bot ccf53b3416 Updated from global requirements
Change-Id: Id1f5c2c1f11c405273e197a6d099a61d8a7e830d
2017-03-01 04:05:48 +00:00
OpenStack Proposal Bot b46d836e15 Updated from global requirements
Change-Id: Ia479d0d0d0dfc2774a57c0f6425c23d9ac843258
2017-02-22 22:25:06 +00:00
Thomas Maddox 47ea14c8c9 Add PyMySQL to project requirements
This patch adds "PyMySQL>=0.7.6  # MIT License",
according to the OpenStack global requirements,
to the project's requirements to afford for the
default SQLAlchemy configuration for the project.

Change-Id: I779b0cca305638c2e0c24702f8ad464982d541e3
Closes-Bug: 1666930
2017-02-22 14:56:48 +00:00
OpenStack Proposal Bot c80c45dc04 Updated from global requirements
Change-Id: Ibc0197fc0f7bead10727171dd701a7728c7a95ef
2017-02-10 09:39:05 +00:00
OpenStack Proposal Bot 1f11f58a00 Updated from global requirements
Change-Id: I41ce82a8e24fb620092e51d7380051f788723b8f
2017-01-18 23:56:21 +00:00
git-harry 97b8775301 Remove code related to Python versions before 3.5
This commit removes any occurrence of the library six.

Six is used to aid in writing code that is compatible with both Python 2
and Python 3. Craton no longer supports the use of Python 2.x, and so
six is no longer required.

The minimum version of Python supported is 3.5, the classifiers are
updated accordingly in setup.cfg.

The docs have been updated to specify 3.5 as the minimum version.

Tox no longer attempts to test against Python 3.4.

This change also removes .travis.yml because it is left over from
from before the project was moved to the OpenStack project namespace and
is no longer required.

Closes-bug: #1630003
Change-Id: I63cba2b6f21a507c0ff02edbef24b663af400c12
2016-11-24 12:31:14 +00:00
Ian Cordasco 2407803170 Fix Keystone integration
We add the necessary Paste filters for Keystone middleware and context
usage inside of Craton so that operators can use Keystone for Identity
and Access Management of Craton.

We also clean up our Keystone Context Middleware to access the
attributes that the keystonemiddleware library set on a request object
so we can determine if the token sent has been validated and what the
roles the user own.

Due to the effort exerted to get this working, this also adds
documentation around how to set up Craton to use Keystone for identity
and adds a tiny script in the `tools/` directory so that one can explore
the API interactively with keystone authentication.

Change-Id: Ida86881f1e6097b1a1f6dec912f094c53c2f4cc2
2016-10-20 15:36:57 -05:00
Jim Baker 952a948d53 Simplify device labeling
Use a child table relation from Device to Label, instead of a
many-to-many relationship of Device to Label; and remove variable
mixin support from Label objects. By doing so this greatly simplifies
actual usage.

Labels from the Python object model are now easier to work with. All
standard set operations are supported, including union, intersection,
and set difference. Examples:

host.labels.add('foo')
host.labels |=  {'bar', 'baz', 'foo'}  # or use update
host.labels.remove('baz')

etc.

Change-Id: Ic50f552fc75c015da5d3c9b21a24818ef5791db9
Closes-Bug: 1632431
2016-10-11 12:46:28 -06:00
Jim Baker 33349891a7 Refactor REST API support to remove boilerplate
This change removes the following boilerplate:

* Most filter setup, along with output to a JSON response, is now
  captured in the new craton.api.v1.base.filtered_context decorator.

* Provides standard exception to HTTP status code mapping using the
  new craton.api.v1.base.http_codes decorator.

There are additional opportunities for boilerplate removal, especially
in scenarios where we have multiple ways of looking up a specific cell
or region; but this boilerplate is not addressed in this fix.

This change does not implement related opportunities for cleanup, such
as import reordering or doc strings. These should be in separate
changes, per discussion on Gerrit.

In addition, this change now returns 204 upon DELETE in the API; and
adds version info to requirements.txt for Flask to conform to Jenkins
gate check.

Change-Id: I7da8e9620c2fb07ebd3953cc6d76d47c08651fe7
Partial-Bug: 1623095
Closes-Bug: 1628050
2016-10-04 08:45:17 -06:00
sulochan acharya 9fcb694351 Bump oslo.serialization version and remove types import
- bump to 2.9.0
- remove custom types import from migrations
2016-06-14 17:50:19 +01:00
Sulochan Acharya 26a41bf36a Merge pull request #69 from rackerlabs/python-api-#18
Python api for resolving variables and corresponding blame #18
2016-06-14 17:26:27 +01:00
Jim Baker bc20add2a9 Remove netaddr workaround now that oslo.serialization supports ipaddress 2016-06-13 21:44:49 -06:00
Jim Baker e847a638d2 Resolved conflict 2016-06-01 21:16:46 -04:00
Angus Lees bbcdd4e26f Implement basic taskflow worker
A taskflow worker process, that runs flows from a persistent job board
in a parallel thread worker pool.  Tasks are defined through stevedore
plugins in the 'craton.workflow' namespace - see the TestFlow example.

Defaults are set to use an in-memory fake "persistent storage", for ease
of testing.  We will want to change this default at some point in the
future.

Also, the worker main() is currently hardcoded to feed in a single
TestFlow job.  Again, we will want to add a command-line tool and/or web
interface to post jobs once we have an out-of-process job board.
2016-05-19 21:42:58 +10:00
Jim Baker ff2e302ab8 Merge branch 'master' of github.com:rackerlabs/craton into python-api-#18 2016-05-17 20:18:15 -06:00
Jim Baker a636afe8ef Adds resolving of scoped variables, along with blame query 2016-05-17 20:18:04 -06:00
Jim Baker 76006593e8 Fix outstanding Python 3 failures and PEP 8 violations 2016-05-14 10:31:12 -06:00
sulochan acharya 8c891df659 Changes project id to be integer
Resolves #43
2016-05-13 11:06:53 +01:00
sulochan acharya 138ecc671d Few improvements to python and rest api for inventory 2016-05-10 22:00:22 +01:00
sulochan acharya 2fc9e827de Add auth middleware for basic auth
- Adds paste based deploy
- Adds middleware for both simple and keystone based auth
- Few restructuring
2016-05-03 19:16:58 +01:00
Jim Baker ab96f818ea Minor cleanup for PR 2016-03-29 19:30:26 -06:00
Angus Lees 455e5086b2 Initial Cookiecutter Commit (with minor tweaks) 2016-03-23 16:57:20 +11:00
Jim Baker fd722dcd9f Python build reasonableness, initial 2016-03-16 22:07:25 -06:00
Jim Baker 340fdeabef Skeleton setup 2016-03-16 21:48:37 -06:00