Commit Graph

150 Commits

Author SHA1 Message Date
Andreas Jaeger 98234f46ab Retire python-cratonclient
Remove everything, add a README with explanation.

Change-Id: I9530985e91423a451f2f7d9f5a37d06de2b8a473
2018-01-18 15:21:03 +01:00
OpenStack Proposal Bot adad8bdc7e Updated from global requirements
Change-Id: If9c63f8e99b8f5fc15be4a285e8542de18399355
2017-04-12 04:20:53 +00:00
Jenkins 9d69e2184d Merge "Drop py34 target in tox.ini" 2017-03-27 18:02:51 +00:00
Jenkins 316315d849 Merge "Update link to documentation and bug tracker" 2017-03-27 17:51:34 +00:00
Jenkins 42c9dee528 Merge "Remove link to modindex" 2017-03-27 17:48:21 +00:00
Ian Cordasco c9df79f5ca Update link to documentation and bug tracker
ReadTheDocs provides TLS for all subdomains and with our updated
infrastructure jobs, we are updating the documentation here on every
push to master.

Further, we split out bug tracking for craton's API and it's client code
a while ago, this just points people at the right place to report those
bugs now.

Change-Id: Id946bba0cda9e4aa81d6df9088e3b18afaca8ee9
2017-03-25 12:30:45 +00:00
lingyongxu e21e19c44d Drop py34 target in tox.ini
We support py35 now.We do not have python 3.4 in setup.cfg which declares the explicit
supported versions.so it is no need to keep the supoort for py34.

see:https://review.openstack.org/#/c/349069/

Change-Id: Ic50f8395a9fe727f11aed65b5944b6d45a8be850
2017-03-25 17:11:33 +08:00
OpenStack Proposal Bot 89e870fb0b Updated from global requirements
Change-Id: I7ad0fc61c74ed18efd0a5375d846e08d95c17b8a
2017-03-24 16:35:35 +00:00
Jenkins 3ab76b97e0 Merge "Add convenience environment to re-record tests" 2017-03-24 15:10:58 +00:00
Jenkins df1635a286 Merge "Add integration tests for regions" 2017-03-24 15:10:53 +00:00
Jenkins febdd52b63 Merge "Add integration tests for clouds client" 2017-03-24 15:10:47 +00:00
Jenkins bf5249c66f Merge "Add tests for our cells integration" 2017-03-24 15:10:42 +00:00
Jenkins 37cc3e95af Merge "Add Betamax for testing" 2017-03-24 15:10:13 +00:00
Jenkins ab2d8c924a Merge "Add Python API Reference documentation" 2017-03-24 14:43:25 +00:00
Jenkins 33ab3e0b1b Merge "Add basic shell documentation for cratonclient" 2017-03-24 14:43:19 +00:00
Jenkins fb75adaf7e Merge "Add user documentation for the Python API" 2017-03-24 14:43:12 +00:00
Ian Cordasco f7abac3fea Add convenience environment to re-record tests
tox.ini's command specification doesn't expand globs (*) so one cannot
simply do:

    rm {posargs:cratonclient/tests/cassettes/*.yaml}

Instead one must be tricky and use find as we do in this commit. This
also allows folks to simply re-record only the cassettes they wish to
rerecord by doing

    tox -e rerecord -- TestHosts-test_create.yaml

As it will then execute

    find cratonclient/tests/cassettes -name 'TestHosts-test_create' \
        -delete

Or even use globs

    tox -e rerecord -- 'TestHosts*'

As that will translate to

    find cratonclient/tests/cassettes -name 'TestHosts*' -delete

This also ensures that new tests aren't recorded in our py27/py35
environments by setting the appropriate environment variable. Only the
rerecord environment may now record new cassettes.

Change-Id: I64e322548afc1b2d508fa129c0b151a8a91137a0
2017-03-22 10:30:47 -05:00
Ian Cordasco 4ae3199014 Add integration tests for regions
Use betamax to record interactions between cratonclient and a craton
server for the /v1/regions API.

Implements: bp testing-plan
Change-Id: I7f558a4516afdc3db27101639620534f4746b2af
2017-03-21 10:54:00 -05:00
Ian Cordasco 2e34424cda Add integration tests for clouds client
This adds more integration tests for the v1 client, specifically for
/v1/clouds.

Further, this introduces a new test method for the integration tests as
it was found to be reimplemented in a few different test modules. This
replaces the pattern used in the existing tests with the new pattern.

Implements: bp testing-plan
Change-Id: Ic4e342cf01be288b7a7c453659580c57169b1022
2017-03-21 10:50:36 -05:00
Ian Cordasco 4f0b316244 Add tests for our cells integration
Using our new Betamax testing integration, this adds tests to verify how
our cells management behaves against a real Craton API.

The majority of this commit lies in the cassettes. These contain the
real requests and responses for each of the tests. The cassette names
are generated from the tests themselves (combination of test class name
and test method).

Implements: bp testing-plan
Change-Id: I6c029f6ad1408508c61d3363f5ee709e9b8210d2
2017-03-21 10:28:36 -05:00
Ian Cordasco a510d64cec Add Betamax for testing
Use keystoneauth1's Betamax test fixture to start recording
request-response interaction pairs in files. I'm starting this bit of
work with our hosts API module.

As a result of this testing, I discovered that we were not handling
keystoneauth1 exceptions inside of our session. This adds handling for
that with a new function for finding the right cratonclient exception to
raise in cratonclient.exceptions. Thus, this also includes testing for
the convenience functions in that module.

Users need only setup 4 environment variables for testing:

* CRATON_DEMO_USERNAME
* CRATON_DEMO_PROJECT
* CRATON_DEMO_TOKEN
* CRATON_DEMO_URL

Depends-On: I45de545b040d2b99ac8f3f4d3c81359615d328e8
Change-Id: Ib69d825a50a7e4179aefd11bcbfbed39c27c7fbe
Partially-implements: bp testing-plan
2017-03-21 10:27:33 -05:00
Jenkins 5062af653b Merge "Enable coverage report in console output" 2017-03-21 15:14:13 +00:00
Ian Cordasco 87a9c75ea3 Add Python API Reference documentation
This corrects some typos in earlier documentation patches, removes
outdated API reference documentation, and organizes all API reference
documentation under one chapter.

This also leaves room for future API versions and more specific API
reference documentation being broken out into sub-sections.

Change-Id: I5391a1acc7d1669207b3d10039a196d026216f40
2017-03-17 14:38:02 -05:00
Ian Cordasco 1597da3f4c Add basic shell documentation for cratonclient
This adds a directory and some basic templates for creating shell
command documentation for python-cratonclient. This creates the shell
sub-directory to allow for individual pages which document each
sub-command in detail.

In the future, that documentation should be further scoped by the
version of the API that it happens to be relevant to. At the moment that
is not a concern so the flatter structure should work fine.

Change-Id: I07bb776c7713283283c86a2907e1c0ba1c763b79
2017-03-17 14:22:36 -05:00
Ian Cordasco 75c3531c43 Add user documentation for the Python API
Most of the copy is duplicated except for the places where it matters.
This allows for any page of this documentation to be page one. If
someone only cares about using hosts first, they can go directly there
and start listing hosts, creating them, etc. without much other
prompting.

Change-Id: Id621947af5d4c3ca53af24904f5f16d3d88bc8b8
2017-03-17 12:57:17 -05:00
Jeremy Liu 5ec0906d57 Enable coverage report in console output
Change-Id: I97caceffa5b7c95d1da47d50f333538365891c8e
2017-03-17 01:28:23 +00:00
Jenkins 5cba061157 Merge "Add testing plan to specifications" 2017-03-10 16:35:10 +00:00
Ian Cordasco 1c1bfaf0a1 Add testing plan to specifications
This describes cratonclient's path forward for testing.

Related-to: blueprint testing-spec
Change-Id: Id40eb42579599e70d8f98290432e0edad2b00075
2017-03-06 12:28:11 -06:00
Thomas Maddox 40e6be281c Ensure consistent vars shell behavior across resources
This patch DRYs out the variables shell test cases
even further to ensure the same pattern of behavior
across all resources' variables shell
implementations.

Closes-Bug: 1670446

Change-Id: I69cc3ac025dfdcd0b0bbe2084125014cb7f659e9
2017-03-06 18:11:26 +00:00
Jenkins ad85607773 Merge "Adds remaining shell tests for variables" 2017-03-06 17:20:20 +00:00
Jenkins cb8f49193b Merge "DRY out Variables shell tests" 2017-03-06 17:19:34 +00:00
Jenkins 858e4f144f Merge "Add variables support for remaining resources" 2017-03-06 17:19:29 +00:00
Jenkins 46d8cc83e8 Merge "CLI and client support for get/set/delete of resource vars" 2017-03-06 17:18:14 +00:00
Thomas Maddox e1f554595e Adds remaining shell tests for variables
This patch includes the shell integration tests
for remaining Resources' variables implementation

Change-Id: I44dc2c3463715321f70bb48514a70906d0c864ec
Closes-Bug: 1659110
2017-03-06 16:46:08 +00:00
Thomas Maddox 0ad237ed60 DRY out Variables shell tests
This patch pulls out the common setup bits for
Variables shell tests.

Change-Id: I8012f51b06a40d0c8d8b0aaeff407881789da9b2
Partial-Bug: 1659110
2017-03-06 16:43:36 +00:00
Thomas Maddox c0cdd3950f Add variables support for remaining resources
This patch implements the variables support
for the remaining resources that use variables

Change-Id: I8d5515742db2d62ff1dea38c10018cc9579a82f4
Partial-Bug: 1659110
2017-03-06 16:33:09 +00:00
Thomas Maddox 05b4f117bb CLI and client support for get/set/delete of resource vars
Functionality is supported both	for the	Python client:

host = craton.hosts.get(item_id=8)
host.variables.update(x='foo', y={'a': 47, 'b': True}, z='baz')
host.variables.delete("foo", "bar", "baz")

As well	as for the CLI:

craton host-vars-get 1
craton host-vars-set 3 x=true y=47 z=foo/bar w=3.14159
cat <<EOF | craton host-vars-set 13
{
    "glance_default_store": "not-so-swift",
    "neutron_l2_population": false,
    "make_stuff_up": true,
    "some/namespaced/variable": {"a": 1, "b": 2}
}
EOF
craton --format json host-vars-get 13 | jq -C
craton host-vars-delete 13 make_stuff_up
craton host-vars-set 13 x= y=42   # deletes x

This patch implements the basis for supporting this
in other resources as well, however we only address
hosts here as an initial implementation. We will
fast-follow with support in other resources.

Partial-Bug: 1659110
Change-Id: Id30188937518d7103d6f943cf1d038b039dc30cc
2017-03-06 14:27:35 +00:00
Sulochan Acharya fb30967d93 Include parent_id by default in devices
The whole point of devices is to be able to see
a parent of a device. So this patch includes parent id
in the default fields to display for all device-list
commands.

Change-Id: I797ac42adae9b8c5afae5710741dcd8fee68d4c3
2017-03-06 11:25:28 +00:00
Jenkins 69c747df3b Merge "Adds --vars filter to cell-list command" 2017-03-03 18:32:10 +00:00
Sulochan Acharya a273796f6a Adds --vars filter to cell-list command
Adds the ability to search cell by its defined
variables.
Allowed query:
cell-list --vars='a:b' --vars='c:d'
or
cell-list --vars='a:b,c:d'

Closes-Bug: 1669760

Change-Id: Iac4ec9dcb91280603f313223baf10b82916da8f1
2017-03-03 17:59:33 +00:00
Sulochan Acharya 3146f50e79 Add vars filtering to region-list
- Region listing is missing filtering using
variables. This patch allows users to filter
region listing using --vars='a:b', and we can
use multiple vars filters using the form

--vars='a:b' --vars='c:d'
or
--vars='a:b,c:d'

Closes-Bug: 1669457

Change-Id: I0e0cabaec8b399170902a0e3c0527d839d419913
2017-03-03 17:59:27 +00:00
Ian Cordasco 4bd5bc647e Clean up shell submodule unit tests
Since we no longer rely on print_dict/print_list we can remove it and
all of our test scaffolding that supported their usage.

Change-Id: I68dd335bf6cc3a50cdbf081d1a708595f914a949
2017-03-03 11:58:50 -06:00
Ian Cordasco 99fd7c88a3 Make column ordering of devices-* consistent
I missed this module in If5906780e501c7b9ba93ecf54a7bcf6db5ddfa1c

Closes-bug: #1659103
Closes-bug: #1659427
Closes-bug: #1668221
Change-Id: I4c3e3503568d426c116bdde48e2b11848f0d6aef
2017-03-03 11:57:55 -06:00
Jenkins 9694c6aacb Merge "Make column ordering consistent and predictable" 2017-03-03 17:40:37 +00:00
Ian Cordasco 683f342506 Make column ordering consistent and predictable
This changes how we sort columns in listings and how we display the
column headings. The default columns are now stored as lists so that
they are the same from run to run. This simplifies some of the logic in
the shell modules as well. Instead of keeping static mappings of
attributes to column headings, we now use some simple python logic, to
title case the columns.

This commit covers:

- cell-* commands
- cloud-* commands
- host-* commands
- project-* commands
- region-* commands

Finally, we noticed that the cloud-list and region-list commands were
behaving differently from the rest of the -list commands. This
unifies the interface to add the --detail flag.

Closes-bug: #1659103
Closes-bug: #1659427
Closes-bug: #1668221
Change-Id: If5906780e501c7b9ba93ecf54a7bcf6db5ddfa1c
2017-03-03 10:25:53 -06:00
Jenkins adaf64c626 Merge "Add devices-list to support /v1/devices" 2017-03-03 09:44:11 +00:00
git-harry 239bfd30c6 Add devices-list to support /v1/devices
This commit adds a new command, 'craton device-list', to support the
endpoint /v1/devices. Currently the endpoint only supports GET requests.

The command supports filtering by cloud, cell, region, parent and active
status. In addition, where a parent is specified, it is also possible to
request descendants.

The API response body is of the form:

    {
        "devices: {
            "hosts": [
            ],
            "network-devices": [
            ],
        },
        "links": [
        ],
    }

This object differs, from the other response bodies that return
collections, in that devices is not an array but is instead an object
whose values are arrays. This difference has necessitated modifying the
list and pagination functionality to support nested data.

Change-Id: I7cdec9935a360dae3910802f210ab9341ef7a696
Closes-bug: 1668705
2017-03-03 08:41:13 +00:00
OpenStack Proposal Bot cd1c025ae0 Updated from global requirements
Change-Id: Ib474399a8fb69acb4ba42adf55da293dd72754dd
2017-03-02 11:54:15 +00:00
Jenkins c558ab65cf Merge "Relax requirement of region-id for hosts and cells" 2017-03-01 15:19:47 +00:00
Jenkins da5d9c21d9 Merge "Fix help messages for resource-listing commands" 2017-03-01 15:09:14 +00:00