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
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
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
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
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
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
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
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.