Commit Graph

146 Commits

Author SHA1 Message Date
Monty Taylor
d42811c405
Fix latest flake8 issues
The latest flake8 checks strings for escape chars, and also has a new
and better rule about line breaks before binary operators - which is
what knuth says should happen.

The escape char check was catching some asterisks in docstrings that
weren't actually providing much, since we already list type as "kwargs".
Just remove them.

Install latest flake8 so we can gate on this.

Change-Id: I89088adcc6f4ff5a894df5e677ae9b28a58edd9a
2018-10-29 16:44:05 -05:00
Monty Taylor
603ba0d7d9
Remove all the deprecated stuff
We're really close to a 1.0 release. Let's go ahead and remove the stuff
that was marked deprecated and see what breaks.

Depends-On: https://review.openstack.org/610695
Change-Id: I0b1b7a0060a3cc0ac1772e5ef2d2a9673159cd77
2018-10-15 13:21:57 -05:00
Dmitry Tantsur
5e4420763a Add set_provision_state and wait_for_provision_state for baremetal Node
This change adds set_provision_state and wait_for_provision_state
to openstack.baremetal.v1.Node, as well as set_node_provision_state
to the bare metal Proxy. Also adds wait_for_nodes_provision_state,
which is similar to Node.wait_for_provision_state but handles several
nodes at the same time, which is important for bulk operations.

The cloud's node_set_provision_state was updated to use the new calls.
As a nice side effect, it now supports all provision states and actions
up to the Queens release, as well as does proper microversioning.

Some documentation was written for the bare metal proxy.

Change-Id: I22a76c3623f4dd2cca0b2103cbd8b853d5cebb71
2018-07-17 13:58:43 +02:00
Yuanbin.Chen
9d56efeb39 Change clustering example test create parameter
This patch fix profile and policy create parameter error,
fix cluster test return to_dict error.

Change-Id: I3ba61df97588a35d11149ed5c2edcc69023b2f53
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-05-07 15:55:35 +08:00
Monty Taylor
16e045db32
Run examples tests with functional tests
The examples tests are currently not being run, which means they're
probably broken. Move them into the functional test dir so that they get
picked up when we run functional tests.

Change-Id: Id4dc9d48544134f304c2d2a0a292c04184316d70
2018-02-22 13:12:44 -08:00
Monty Taylor
958a35a5ca
Remove openstack_cloud factory function
This is mostly mechanical as these are no longer needed.

Change-Id: I632675506bef591704068d17ec3dfad963a4c4b5
2018-01-31 11:26:02 -06:00
Zuul
0d6e6e97c0 Merge "Add clustering guides cluster file, examples cluster code" 2018-01-24 19:39:52 +00:00
Zuul
1e715c05be Merge "Add clustering guides node file, examples node code" 2018-01-24 12:49:45 +00:00
Zuul
9c8a528917 Merge "Move openstack_cloud helper functions" 2018-01-24 09:46:46 +00:00
Yuanbin.Chen
7803466ed2 Add clustering guides node file, examples node code
Change-Id: I905c424f86ef1f838ad2b637cb623f9ce7025466
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-01-24 14:49:22 +08:00
Yuanbin.Chen
3c782b5582 Add clustering guides cluster file, examples cluster code
Change-Id: I7a86398b86a4317100b454f1bd45a8eafc6ae4d4
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-01-24 10:44:51 +08:00
Zuul
97a7e5358d Merge "Add clustering guides file, Examples code." 2018-01-21 02:57:33 +00:00
Yuanbin.Chen
c0b2d084d2 Add clustering guides file, Examples code.
Clustering guides add action/eventfile.
Clustering examples add action/event example code.

Change-Id: I47164b1539d53e51ac915817398ebf85fd8ddb24
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-01-20 14:25:51 +08:00
Yuanbin.Chen
27e767feed Replace clustering examples code cluster to clustering
Change-Id: I013d6eb917c93ccfeb44b4d9c96108d3d6cde607
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-01-20 12:36:51 +08:00
Yuanbin.Chen
aa52477e8e Add clustering guides receiver file,examples receiver code
Change-Id: I4a4a34c674195402aaa92929d2cfd2cb51775995
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-01-19 15:13:45 +08:00
Monty Taylor
e636890d59
Move openstack_cloud helper functions
We don't want these where they look like supported interfaces just yet.
Move them below openstack.cloud.

Change-Id: I653e5aaba8084e8c226fd0e787dfff01050e7a6c
2018-01-18 16:54:55 -06:00
Monty Taylor
da2406bace
Rationalize logging helpers and docs
shade and openstacksdk each have a logging doc and a logging setup helper
function. They both basically do the same thing, and we have a TODO item
about collapsing them.

This moves openstack.utils.enable_logging to openstack.enable_logging
(leaving behind a compat piece at openstack.utils.enable_logging) It
adds the shade functionality to it, and also changes the behavior to
match shade's WRT behavior when no parameters are passed (defaults to
logging to stdout)

Update the codebase to call openstack._log.setup_logging instead of
logging.getLogger directly, as setup_logging attaches a NullHandler by
default.

Collapse the docs into a single document.

There were only two places where openstacksdk was already logging to
something other than 'openstack'. Collapse those down to 'openstack'
until we come up with a reason to break them out more logically.

Change-Id: I45fd5ffd18255450d38a1f56c80f5c157ea19ae3
2018-01-16 14:46:44 -06:00
Monty Taylor
40d425c595
Merge user and users sections of the docs
The openstack doc standard location is 'user', so go with that.
Incorporate pages from the shade and occ docs into the appropriate
places in the user index file.

This still leaves user/logging and user/guide/logging which need to be
rationalized. That will come in the next commit, as it also needs to
actually rationalize the logging helper functions.

Remove the Makefile, as it's not used by things.

Change-Id: I26f36370ef9651f4bcaa7dee3b903309463d9592
2018-01-15 19:19:50 -06:00
Monty Taylor
18fe7b4e2b
Rename CloudConfig to CloudRegion
The name CloudConfig has always sucked. While working on the next patch,
it occurred to me that what a CloudConfig represents is the config for a
given region of a cloud. We even reference "Cloud Region" as a unit of
work when giving conference talks.

Take the opportunity while we're doing this sdk/occ merge to rename it.
Obviously we can provide naming compat shim in OCC itself.

Leave in *some* naming compat shims to get us past the 0.10 release so
that OSC continues to have the happies.

Change-Id: Ia0bbc20eb28a3a36e69adba3a4b45323e4aa284e
2018-01-09 11:56:04 -06:00
Monty Taylor
4bad718783
Rework config and rest layers
This is a large and invasive change to the underlying guts. Most casual
use should not notice a difference, but advanced users, especially those
using the Profile or Authenticator interfaces or making use of pluggable
providers will be broken.

The overall intent is to align directly on top of the mechanisms that
came from os-client-config for config and to use keystoneauth1's Adapter
interface to make use of the canonical implementations of such things as
service and version discovery. The end goal is that openstacksdk
provides the REST interaction layer for python-openstackclient, shade,
Ansible and nodepool.

Replace profile with openstack.config

os-client-config is used by shade and python-openstackclient to read
and process configuration. openstacksdk also can use the
os-client-config interface, but translates it internally into the
Profile object. As os-client-config has been injested into
openstack.config, remove Profile and just use the config classes.

Make proxy subclass of adapter

This gives every service a generic passthrough for REST calls, which
means we can map unknown service-type values to a generic proxy.

Strip endpoint_filter

We're passing Adapters around, not sessions. Doing so means that
self.service and endpoint_filter have become unnecessary.

Rename _Request.uri to _Request.url

This is a stepping-stone to replacing _Request with requests.Request and
using requests.Session.prepare_request inside of _prepare_request.

Rename service proxy instances to match their official service-type.

Aliases are kept for the old versions, but make the canonical versions
match the official name.

Rename bare_metal to baremetal
Rename cluster to clustering
Rename block_store to block_storage
Rename telemetry to meter

Create generic proxies for all services in STA

Every service listed in service types authority is an OpenStack service.
Even if we don't know about it in SDK, we should at the very least have
a low-level Adapter for it so that people can use REST calls while
waiting on the SDK to add higher-level constructs.

The pypy jobs are happily green. Run them as voting rather than
non-voting.

Add syntatic sugar alias for making connections

Typing:

  import openstack.connection
  conn = openstack.connection.Connection(cloud='example')

is annoying. This allows:

  import openstack
  conn = openstack.connect(cloud='example')

Use task_manager and Adapter from shade

As a stepping-stone towards shade and sdk codepaths being rationalized,
we need to get SDK using the Adapter from shade that submits requests
into the TaskManager. For normal operation this is a passthrough/no-op
sort of thing, but it's essential for high-volume consumers such as
nodepool.

This exposes a bunch of places in tests where we're mocking a bit too
deeply. We should go back through and fix all of those via
requests_mock, but that's WAY too much for today.

This was a 'for later' task, but it turns out that the move to Adapter
was causing exceptions to be thrown that were not the exceptions that
were intended to be caught in the SDK layer, which was causing
functional tests of things like GET operations to fail. So it became a
today task.

Change-Id: I7b46e263a76d84573bdfbbece57b1048764ed939
2017-11-15 11:46:50 -06:00
Monty Taylor
65293358a0
Move shade and os-client-config python content
Make shade be openstack.cloud and os-client-config be openstack.config.

Change-Id: I1d28be82a72cc1a30d6be306257fc1f0736ed604
2017-10-04 12:39:43 -05:00
zengjianfang
3c62c90f45 Use https instead of http in cluster examples
Change-Id: I674ec63232216729e953f6f5b11403b56eeb787d
2017-05-04 12:38:22 +00:00
Akihiro Motoki
dc9a3458ad functional tests: minor cleanup
* Check service availability for swift, heat and octavia

* Use OS_CLOUD=devstack-admin. DevStack sets up default clouds.yaml
  for member and admin roles. The current OpenStackSDK functest prepares
  its own clouds.yaml based on DevStack admin account, so there is no
  difference from 'devstack-admin'. It simplifies the post_gate_hook process.

* Skip openstack.tests.functional.network.v2.test_quota.TestQuota.test_set
  (Related-Bug: #1687202)

Change-Id: I571e437dd7e439d2ad8a1d7ed9a5a24361b1308e
2017-04-29 15:40:34 +00:00
Brian Curtin
237041aff9 Add image download example
I forgot to `git add` this file to the
Ie62ebcc895ca893321a10def18ac5d74c7c843b9 change and recently noticed it
causing `tox -e pep8` to fail locally.

Change-Id: Ib80eda80f27457f2db2672d58c4a6c4a7ecd3d7c
2017-03-13 11:14:45 -04:00
Terry Howe
52bd73e45d Update the image used for functional tests
The image used for functional tests is out of date.  This simeple
changes gets more tests to pass.

Change-Id: I60967b6da183ae88270c541abdb4d93913f45558
Partial-bug: #1665495
2017-02-17 21:55:50 -07:00
Brian Curtin
3c8c7299f8 Deprecate port and ping methods in Network proxy
The Network proxy contains two methods that are mostly there for example
purposes: security_group_allow_ping and security_group_open_port.
They haven't been included in documentation due to missing docstrings,
and they aren't used anywhere in the SDK or within OSC. They're better
off as actual examples in our documentation than being within code that
we need to support throughout the future.

Change-Id: I4c6b47860b0c2b952e50d4b564451780008b631a
2017-02-15 08:05:19 -05:00
Yuval Shalev
d8f62dc0e9 Added project role assignment
Change-Id: I4eb3d430365f3b22c1a77faea71f710fb565082f
2017-02-06 09:55:11 +02:00
Yuval Shalev
aa6aeac21a Add support for Role resource in Identity v3
This change adds the Role resource to Identity v3 and exposes the CRUD
methods in the proxy. It also adds a small example to the documentation.

Change-Id: I064c27fcd1d15bfd064c63b8c50bc2461b8c1156
2017-01-04 09:31:16 -05:00
Matthew Edmonds
6f2209e238 Clarify argparse connections
The user guide shows that options passed to connection.from_config do
not have to be an argparse Namespace, contrary to the comments in
connection.from_config. This change corrects those comments and adds
a user guide example showing how argparse may be used.

Change-Id: I2a9e92cbf0aab16476001be772034e9698a24c9f
Closes-Bug: #1629331
2016-10-03 09:49:49 -04:00
Brian Curtin
0a19263fac Refactor Key Manager for resource2
This change updates the Key Manager service for the resource2/proxy2
refactoring. Along with making it work with the new classes, it improves
usability--at least temporarily--by exposing the ID value necessary from
the HREFs that the service returns. The HREF that gets returned, e.g.,
from a list call, is not directly usable to then pass it into a get
call. A more long-term fix for this would potentially be to create a Key
Manager specific base class that fiddles around with IDs and looks to
see if they are an HREF and converts them to a UUID in the proper
direction depending on where the data is going, but that's too much to
tackle in this refactoring change.

Besides updating some of the resources to match the documented
attributes, one feature this does add is retrieval of the Secret
payload, which is done via a separate endpoint. However, like other
calls in Glance and Heat, we unify them in the proxy's `get_secret` call
so the user doesn't need to know it's a separate call.

This also includes some basic docs in the user guide to show how the
different ID usage is currently necessary.

Change-Id: I8b5753e121d8f79350b38803e8aac95d7b4d1627
2016-08-24 15:58:51 -04:00
Jenkins
7934570373 Merge "Cluster user guide - part 2" 2016-06-06 09:19:29 +00:00
tengqm
f72662aeb4 Cluster user guide - part 2
This patch adds more user guide to the cluster service.

Change-Id: I0cdbad1784350529b1ec7d1ed2c06cae95776e08
2016-06-03 10:29:46 -04:00
Michael Gugino
83aef9c8a0 Implement network agents
This commit adds api support for network agents.

Change-Id: I9755637f76787d5fac8ff295ae273b308fcb98d0
Implements: blueprint implement-network-agents
2016-05-18 13:41:17 -04:00
tengqm
9811503d16 Cluster user guide - first step
This is a first step to add user guide for cluster service. Will propose
more contents in patches that follow.

Change-Id: I1f9a8f45f00872c5d2f375b123260d32adaa6d66
2016-03-19 09:07:57 +00:00
Richard Theis
b4b9104d5c Fix compute tests for resource.prop ID attributes
Fix unit, functional and examples tests for [1]. Also
fix the documentation for the server image_id and flavor_id
properties.

[1] https://review.openstack.org/#/c/279618/

Change-Id: Ia37ecc7c9dccb90fabf7bf73601a6ad519212556
Partial-Bug: #1461200
2016-02-15 09:15:21 -06:00
Richard Theis
f71f6f0f13 Basic resource.prop for ID attributes (network)
This patch set updates all network resource objects to use basic
properties for ID attributes. In particular, the following changes
were made:
  - Use basic *_id resource.prop for ID attributes
  - Use list *_ids resource.prop for attributes containing a list of IDs
  - Clarify documentation for ID attributes

Change-Id: I725095bb07da55148e29c511e7e8506bc7dbb7ca
Partial-Bug: #1461200
2016-02-04 11:26:42 -06:00
Richard Theis
003ff67dc8 Add image user guide
Add an image user guide to replace the current placeholder. Also,
add image examples and related tests to go along with the guide.
Much of the content for the guide was pulled from [1].

[1] http://docs.openstack.org/image-guide/

Change-Id: I8b3a1618b09f3570f3b69d8c228bed56d4d1c151
Closes-Bug: #1466183
2016-01-05 15:53:20 -06:00
Everett Toews
88255cfdad Delete key pair and server for Compute example
Change-Id: Ic136296f3dec0327f95e246342819378834fd23c
2015-12-09 13:55:17 -06:00
Richard Theis
aae2623661 Fix 400 error in compute examples
The functional tests use the DevStack cirros image instead of a
fedora image. Update the examples tests to do the same since
the fedora image is not available in the test environment.

Change-Id: Ib90cff818d36fa71445109c6950d79c6f1b477a7
Related-Bug: #1522919
2015-12-09 08:32:54 -06:00
Everett Toews
1950fbfcb9 Fix failing compute example
Change-Id: I7fb8e940f36a042bfcdf94b1147ec96f4ea3f066
Closes-Bug: #1522919
2015-12-07 15:21:47 -06:00
Richard Theis
57ec9d4c4f Add identity user guide
Add an identity user guide to replace the current placeholder.  Also,
add identity examples and related tests to go along with the guide.
Much of the content for the guide was pulled from [1].

[1] http://docs.openstack.org/admin-guide-cloud/identity_management.html

Change-Id: Iec3caf601732c5c6f63331eac770d1325051aa82
Closes-Bug: #1466182
2015-12-04 14:55:56 -06:00
Richard Theis
f15dabeac8 Add network user guide
Add a network user guide to replace the current placeholder.  Also,
add to and update the network examples to go along with the guide.
And finally, add a test for the network examples.

Change-Id: Ib98a7632c3ccc9764a93831f0dbe597ce0bce606
Closes-Bug: #1466186
2015-12-02 08:48:27 -06:00
Jenkins
dadb1c0f3c Merge "Refactor os-client-config usage in from_config" 2015-11-20 00:07:56 +00:00
Brian Curtin
effb2a7d65 Refactor os-client-config usage in from_config
This change allows the from_config factory function to better support
two angles from which it will most commonly be used.

1. When SDK is being used from within OSC, OSC will have obtained
configuration data from OCC and is better served by passing it directly
into SDK rather than SDK additionally accessing that data.

2. Direct users of the SDK, such as customer applications, are less
likely to have dealt directly with OCC and are better served by just
passing in the name of the configuration they want to run with.

Closes-Bug:1513920

Change-Id: I06f871b822e4b8b0cc8cc8db9e7ccff91f918e5a
2015-11-19 10:25:52 -06:00
Everett Toews
405dd19bea Create Key Pair
Factor out key pair creation into its own method to make key pair
creation clearer.

Change-Id: I871c95df12cf5d00484775389816900849789a80
2015-11-10 20:24:18 -06:00
Everett Toews
6f2376ee8b Remove the example code that mimics a CLI
Change-Id: I84c990b5a73a4690c26d52bcc46eb936fdd4c1b8
Partial-Bug: #1487269
2015-11-03 20:40:26 -06:00
Everett Toews
6b2cec41d1 A better create server example
It's much more straight-forward for users to read a create server
example that does everything necessary to create the server
within the body of a single method. In this better example the user
doesn't have to refer to other examples to learn how to create a
server.

Change-Id: Iad7eef7946e93deb735fddcfbe39bbc8b56f507b
2015-11-02 16:17:44 -06:00
Everett Toews
7e98020b83 The Compute User Guide
The beginning of the compute user guide.

This also begins the simplification of the examples, makes them
more specific, and adds testing.

Change-Id: Ic4bac2fe30601c196b03ce73b2dd04a916231f33
Partial-Bug: #1487269
Partial-Bug: #1419012
Partial-Bug: #1466180
2015-10-01 21:50:49 -05:00
TerryHowe
03ae0905f7 Get rid of example command line options
Everett mentioned cleaning up the example code and I'd like to
start this by removing the command line options.  There is a lot
of complexity there I'd sooner not maintain.  I'm pretty sure
some of it is broken.  It is also different than other CLIs.
Use OCC.

Change-Id: If759e02ede4baee5277c1a8a4bc9f2dca13f6c82
2015-08-25 10:25:10 -06:00
TerryHowe
db9b19427f Remove connection CRUD methods
While these methods are cool short cuts and work in a lot of
cases, I think they will cause problems and confustion.  The
proxy is respsonsible for hiding some API inconsistencies and
this by passes that.

Change-Id: Iafaf2b035d0c3a0f342ca5f66baaddfaf624404e
2015-08-17 14:52:16 -06:00