Commit Graph

116 Commits

Author SHA1 Message Date
likui 2e84353660 Remove importlib-metadata from requirements
We don't need it anymore as we don't support python < 3.8
Also it was removed from global requirements so it breaks the
requirements check.

Change-Id: I9a053e4a2fd11b3cfcf2d9de6ba6441c7d5b0dc2
2023-12-01 10:12:09 +09:00
Stephen Finucane 01b9a49c95 requirements: Sort alphabetically
Order no longer matters starting with pip 20.3.

Change-Id: I743674eaf684be9d8b6255e90edc82de0cd80734
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-06 10:47:47 +00:00
Jeremy Stanley b34de32a54 Replace appdirs usage with platformdirs
The appdirs library has been abandoned for several years now, and a
fork named platformdirs is the recommended alternative. It's almost
a drop-in replacement, except the module and convenience class name
have changed. Adjust the internal variable name we're using for the
expansion to match as well, for all those consistent hobgoblins.

Add it with a >=3 lower bound because that introduces a breaking
change of the default configuration location for macOS users.
Include a release note about that too.

Depends-On: https://review.opendev.org/886642
Change-Id: I4c2b60ca0da29da1f605b4c0b5e77f8e1071a19c
2023-10-06 13:42:49 +00:00
Artem Goncharov 6e5f34dba5 Drop munch dependency
Importing munch inside of SDK is taking around 0.3 second. Itself it is
not a big problem, but it hurts on the openstackclient front. In
addition to that munch project does not seem to be actively maintained
and had no releases since 2 years.
Dropping this dependency at once is requiring quite a big rework so
instead copy a heavily stripped version of what we really require from
it. This helps us to gain performance improvement while giving time to
rework our code to come up with a decicion on how to deal with it.

Change-Id: I6612278ae798d48b296239e3359026584efb8a70
2023-01-29 09:02:51 +01:00
Ghanshyam Mann 49029b8792 Fix l-c testing for ubuntu focal
As per victoria cycle testing runtime and community goal[1]
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

- Bump the lower constraints for required deps which added python3.8 support
in their later version.

Story: #2007865
Task: #40206

[1] https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-focal.html

Change-Id: If3ec085184fbba81f455164b803afb6f66e46fd0
2020-09-10 13:02:57 +02:00
Doug Hellmann 77e2f67d38 switch to importlib.metadata for entrypoint loading
Importing pkg_resources scans every installed distribution to find
all of the entry points. importlib.metadata can import entry points
without scanning all of the installed packages.

Change-Id: I9917b10292d191710b37838b3cf099d75139f123
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2020-07-05 19:46:27 -04:00
Monty Taylor 2ddbf57ee6 Remove use of six
We're python3 now, we don't need to use six.

Change-Id: I7c1f0bc89838432aa0ce916beb462916c8763cd1
2020-05-10 08:29:40 -05:00
Andreas Jaeger 4c5cf2deea Small cleanups after Python2 drop
Remove requirements only needed by Python prior to version 3.5.
Remove python 2.7 code from setup.py.

Remove from setup.py ancient sections.

Change-Id: Ie223b743a0f8def53874bfbbb5f9000ad26f030b
2020-03-27 23:49:45 +00:00
Monty Taylor 8e5893f0ad Revert "Switch to futurist for concurrency"
This partially reverts commit b6a22e3749.

The addition of futurist as a hard depend broke python2, and at the
same time didn't mark the release as having done so. In looking at the
issue we realized that we don't actually need the hard depend.

Change-Id: I2d874f618f5b3f66d49cd2e964c6e05655f22c0f
2020-03-26 10:50:26 -05:00
Monty Taylor b6a22e3749 Switch to futurist for concurrency
As we're being used inside of services more and those services
frequently use things like eventlet, allow people to pass in
an Executor object from futurist to override the default
ThreadPoolExecutor object.

Change-Id: I6c04defc28998d49199383a6cc6d5f5611a99e25
2020-03-05 09:06:49 -06:00
Akihiro Motoki 999e38cf08 Bump min version of decorator
decorator.decorate decorator is only implemented in decorator 4.0.0.
The current lower bound of decorator is 3.4.0 but it does not work
with openstacksdk. It is found during a OSC change [1].
This commit bump the minimum version of decorator.
It looks like that decorator 4.0.0 works but we now test with
decorator 4.4.1 (the latest version),
so I chose the latest version as the minimum version.

[1] https://review.opendev.org/#/c/674325/

Change-Id: I7479a84ef19c7f1e881b9d56c12d2798340eb53b
2020-01-09 19:54:17 +09:00
Riccardo Pittau 835ab9d133 Increase dogpile version for Py3.7 compatibility
The library dogpile.cache is not compatible with Python 3.7 until
version 0.6.5 because of new reserved word 'async'.
For more info please check:
3c4351c11f

Change-Id: I851ed4ec14cb0a97c9acc38f77cdab6f269ed40c
2019-10-28 15:16:46 +01:00
Monty Taylor 25674ccd45 Re-add functional tests on flavor content
A new keystoneauth release is out that fixes authenticated
discovery, meaning we'll pick up new server microversion,
which means we can start testing for such in our server
functional test.

Depends-On: https://review.opendev.org/690876
Change-Id: I51b7fd28f3469a5718057ece2f29f3655ef717e4
2019-10-24 17:19:40 +09:00
Eric Fried 6e7cbb9678 Bump keystoneauth1 minimum to 3.16.0
Because we should always be tracking to the latest ksa anyway, but
also...

...to allow from_conf to to take advantage of retry config options
introduced in [1] and [2].

[1] https://review.opendev.org/666287
[2] https://review.opendev.org/672930

Change-Id: I85669b12a6948ab5accd3d7df71dcbacce413e33
2019-08-13 12:09:30 -05:00
Monty Taylor 95bf14908e Add support for global_request_id
Added support for setting global_request_id on a Connection.
If done, this will cause all requests sent to send the request id
header to the OpenStack services. Since Connection can otherwise
be used multi-threaded, add a method global_request that returns
a new Connection based on the old Connection but on which
the new global_request_id has been set. Since a Connection
can be used as a context manager, this also means the global_request
method can be used in with statements.

Change-Id: I70964cdd79741703c0b9b911b3b2f27c248130f0
2019-08-13 08:12:40 -04:00
Eric Fried f7860861a1 Pin to latest os-service-types
OpenstackSDK should always be using the latest os-service-types.

This commit bumps the lower bounds to the current latest version
(1.7.0), and adds a canary test so that the CI will fail as soon as a
new os-service-types version hits upper-constraints.

Change-Id: Ie98ec9cfd58badc2b05a2a144d1d559d7ed6553b
2019-06-06 15:57:25 -05:00
Eric Fried 820790225c Handle oslo.config exceptions in from_conf
In the following cases, we used to happily allow the Connection to the
service, using default Adapter settings:

- If the conf section for a given service is missing, or present but
  without ksa adapter opts registered.
- If the conf section for a given service has bogus values.

Now for these scenarios, we disable that service with a helpful reason.

The service disabling is supported at a broader level: If someone sets
has_{service_type} to false in their config, we remove the adapter for
that service and replace it with something that throws errors when
people try to use it. They can optionally set
{service_type}_disabled_reason to make the message more informative.

Co-Authored-By: Monty Taylor <mordred@inaugust.com>

Change-Id: I3aa1f1633790e6e958bbc510ac5e5a11c0c27a9f
2019-06-06 12:25:00 -05:00
Monty Taylor 86ad9debd1 Make factory for a CloudRegion from CONF objects
This commit enables SDK consumers using oslo.config for keystoneauth1
Adapter settings by introducing a method:

openstack.config.cloud_region.from_conf

This accepts:
- An oslo.config ConfigOpts containing Adapter options in sections named
  according to project (e.g. [nova], not [compute]). Current behavior is
  to use defaults if no such section exists, which may not be what we
  want long term.
- A Session. This is currently required - if unspecified, a
  ConfigException is raised - but in the future we probably want to
  support creating one (and an auth) from the conf.
- Other kwargs to be passed to the CloudRegion constructor.

The method returns a CloudRegion that can be used to create a
Connection.

Needed-By: blueprint openstacksdk-in-nova
Co-Authored-By: Eric Fried <openstack@fried.cc>
Change-Id: I05fb4da39d2eefc91828ace02db2741b62a2cb0a
2019-06-04 08:36:23 -05:00
Monty Taylor e7a9b52998 Revert "Revert "Replace TaskManager with a keystoneauth concurrency""
This reverts commit feae8da9bf.

Change-Id: I6f85cc58a404063a262cf7338c827cde61493b43
2019-03-10 22:17:24 +00:00
Monty Taylor feae8da9bf Revert "Replace TaskManager with a keystoneauth concurrency"
We need to cut a quick release for masakari and this is a bit
much to have in a quick release.

This reverts commit c9b60f2b86.

Change-Id: I4771ee4136e54f22979e159932f36040397d4d4c
2019-03-10 22:17:11 +00:00
Artem Goncharov c9b60f2b86 Replace TaskManager with a keystoneauth concurrency
We've added concurrency and rate-limiting controls to keystoneauth. That
means we don't need to do them in openstacksdk.

Depends-On: https://review.openstack.org/#/c/640389/
Change-Id: I5d7bd12606785365d2f5b5b52ec7a2316459b68f
2019-03-02 15:24:59 +00:00
Morgan Fainberg b25e4b8be5 Unpin dogpile.cache
Unpin dogpile.cache, we can use 0.7.0 and later now.

Story: 2004605
Task: 28502
Needed-By: https://review.openstack.org/#/c/624993
Change-Id: I1cbf4897f8f55376a85a8f760b683ebb778c5bb9
2018-12-21 08:52:44 +00:00
David Shrewsbury fd61b54679 Avoid dogpile.cache 0.7.0
Latest release of dogpile.cache breaks our method of calling a bound
function in the decorators.  For more details see story or

  https://github.com/sqlalchemy/dogpile.cache/issues/140

Pin while we work on a solution.

Additionally, the cirros version was updated to 0.3.6 in devsatck with
Id2f20ebafdd78c2dadf81b8f80f22e7bd6db7755.  Update the hard-coded
versions in the functional tests (this should be modified to be more
version agnostic in a future change)

Story: 2004605
Depends-On: https://review.openstack.org/624697
Change-Id: Id2df8a05ef45041bf55a2671f7d06e7b88cc79d6
2018-12-18 02:22:35 +00: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
Monty Taylor 071e567b32
Use discovery instead of config to create proxies
Since the dawn of time we've labored under the crippling burden of
needing to explicitly request a version via configuration in order to
get a usable handle to the cloud. This is despite the hilarity of the
existence of a system for discovering available versions since basically
the beginning of the entire OpenStack project.

Today we shall be liberated from the tyranny of terrible past life
decisions on the part of our forefathers and shall usher forth the
shining freedom of actually using the discovery system.

Change-Id: I11c16d37d3ab3d77bed3a0bcbd98f1fa33b9555f
2018-10-06 07:44:29 -05:00
Josephine Seifert f2aeaead02 Implement signature generation functionality
Openstacksdk is extended with a signature generation functionality.
This adds cryptography to the requirements and lower constraints.

Change-Id: Idc15b9a12d408bd4b2e096da8402c374be56f9fa
Story: 2002128
Co-Authored-By: Markus Hentsch <markus.hentsch@secustack.com>
2018-07-18 13:18:40 +00:00
Dmitry Tantsur 46bb367ad6 Allow configuring status_code_retries and connect_retries via cloud config
Change-Id: I45cf09f9aca8e4ed515a93e4903deb3df83ac65b
2018-06-15 12:19:01 +02:00
Monty Taylor 264c802ad8
Pass default_microversion to adapter constructor
Based on discussion with the API-SIG, we determined that if someone sets
*_api_version or OS_*_API_VERSION to a value that looks like a
microversion, we should pass it to default_microversion in addition to
using it for major version discovery.

Update the docs to reflect the microversion story (and to remove shade
references)

Also, throw an error on missing support for default microversion

We've given the user the ability to set a default microversion. However,
that microversion might not be available on the cloud in question. Throw
an error in such cases.

Depends-On: https://review.openstack.org/568640
Change-Id: Iad7194dc9e933660c0d0df9130c51d505dda50cb
2018-06-09 09:15:20 -05:00
Monty Taylor 9c774d2959
Defer all endpoint discovery to keystoneauth
keystoneauth has support for service type aliases and version discovery.
Stop doing it locally and just pass data to keystoneauth.

Depends-On: https://review.openstack.org/567602
Change-Id: If60d02a8216ca0719fa628431515a0c3b37bf607
2018-05-10 12:06:42 -05:00
OpenStack Proposal Bot 2eec5ba200 Updated from global requirements
Change-Id: I77c0aebc1502afeb5bf4507c5d76cd8a6c7f535c
2018-03-04 10:27:18 +00:00
OpenStack Proposal Bot 9c68fbe9d9 Updated from global requirements
Change-Id: I21937d230b9c439c6ce0f65621e2b4a57e8804c1
2018-02-17 10:17:32 +00:00
OpenStack Proposal Bot 41222cba2f Updated from global requirements
Change-Id: Ib89bd3d3c59fb5a7c9d82af3ede39bcfceeb80d1
2017-12-05 16:53:32 +00:00
OpenStack Proposal Bot e8a1c2ee96 Updated from global requirements
Change-Id: I025d678bae840d9c4369361981993bdb841915f5
2017-12-05 03:34:21 +00:00
OpenStack Proposal Bot 2dfe498df2 Updated from global requirements
Change-Id: I3142490cf4b7660ccb59ba7f06f87d3ddd620459
2017-11-16 11:26:05 +00: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 535f2f48ff
Merge shade and os-client-config into the tree
This sucks in the git history for both projects, then moves their files
in place. It should not introduce any behavior changes to any of the
existing openstacksdk code, nor to openstack.config and openstack.cloud
- other than the name change.

TODO(shade) comments have been left indicating places where further
integration work should be done.

It should not be assumed that these are the final places for either to
live. This is just about getting them in-tree so we can work with them.

The enforcer code for reasons surpassing understanding does not work
with python setup.py build_sphinx but it does work with sphinx-build
(what?) For now turn it off. We can turn it back on once the build
sphinx job is migrated to the new PTI.

Change-Id: I9523e4e281285360c61e9e0456a8e07b7ac1243c
2017-11-15 09:03:23 -06:00
Monty Taylor a4ee1a3f09
Merge tox, tests and other support files
Change-Id: I5a4759e36089f1f4fab0c75412c94d051d8b16a7
2017-10-04 14:51:08 -05:00
OpenStack Proposal Bot 1e5dbb59ce Updated from global requirements
Change-Id: I4567ef7ac70b85d5542cd2e4ad1fd5c375c03e5a
2017-09-11 21:49:24 +00:00
OpenStack Proposal Bot 913cb48be1 Updated from global requirements
Change-Id: Id527edfd5dd2ee8ad38857bca132d8a6fb483ac6
2017-09-01 12:47:16 +00:00
OpenStack Proposal Bot 1c98ea5e2d Updated from global requirements
Change-Id: Ifff5f947c99ef3e8d41dc4982a5b864fd4bf4684
2017-07-27 20:33:19 +00:00
OpenStack Proposal Bot 2e3ad0ff7e Updated from global requirements
Change-Id: I1bec8faaed866642da53ac23f3889cc44c6eaf3b
2017-07-22 16:39:09 +00:00
OpenStack Proposal Bot 54334fd6f0 Updated from global requirements
Change-Id: I89f967e740452ac30bbab6abbb37987b7f936ffe
2017-06-10 21:48:52 +00:00
dineshbhor d24bebb538 Fix update_image unsupported media type
Currently update_image returns unsupported media type because
unexpected Content-Type (application/json) being passed
to glance service.

Provided expected Content-Type and body with patch operations(op).
Used make_patch() method from jsonpatch library to create patch
for updating image.

Closes-Bug: #1455620
Change-Id: I3d77648d55b2870e40ff689b47574e68aa72d7f6
2017-06-07 19:15:40 +05:30
OpenStack Proposal Bot 223e0d035c Updated from global requirements
Change-Id: I65bc8a31c61bca161cb0825b493cb88a50fa2b47
2017-05-03 12:23:17 +00:00
OpenStack Proposal Bot 86a5f3bc89 Updated from global requirements
Change-Id: Ie2e891d468301051030a79c0158228d3ab58d5f9
2017-05-01 13:40:57 +00:00
OpenStack Proposal Bot 2d7eaeb113 Updated from global requirements
Change-Id: I18492d7e1fe772e27af56ce2da68a9f277d2fb21
2017-04-12 04:21:56 +00:00
OpenStack Proposal Bot 71128e7212 Updated from global requirements
Change-Id: I75c7591ea4dd4007e578d76d209fd6de10587f76
2017-03-02 11:55:11 +00:00
Brian Curtin e97a755046 Adjust some proxy method names in cluster
In auditing our proxy method names heading into the 1.0 release,
where we'll need to be more careful about backwards compatibility,
some names in the cluster proxy use structures that are different than
we're using both around the other services and also within cluster
itself. We've converged on several naming formats for add/remove,
attach/detach, and several other grammar styles when naming operations
that are done on a certain resource.

This change introduces a deprecation decorator using the `deprecation`
library, which was recently added to global-requirements. This is also
the first change of several in the auditing process, just going
alphabetical order through the services.

The plan with these is that they're marked for deprecation in the
next release (0.9.14), both here in the code and in the documentation
via the deprecation library's ability to modify the docstring, which
then shows up in our built documentation. In the meantime, we should
help any users we know of—in this case we have cluster developers on
this project—in updating calling code to use the newer format before
1.0 happens.

The following deprecations were made:
* cluster_add_nodes -> add_nodes_to_cluster
* cluster_del_nodes -> remove_nodes_from_cluster
* cluster_replace_nodes -> replace_nodes_in_cluster
* cluster_scale_out -> scale_out_cluster
* cluster_scale_in -> scale_in_cluster
* cluster_attach_policy -> attach_policy_to_cluster
* cluster_detach_policy -> detach_policy_from_cluster
* cluster_update_policy -> update_cluster_policy
* cluster_operation -> perform_operation_on_cluster
* node_operation -> perform_operation_on_node

Partial-Bug: 1657498

Change-Id: I3df0494f9ec0097aee7d47e05fb42094439bc4a4
2017-02-07 12:42:10 -05:00
OpenStack Proposal Bot 12b226d28e Updated from global requirements
Change-Id: Ib91389116639398a53d74851f3828719de9b98aa
2017-01-21 15:57:01 +00:00
OpenStack Proposal Bot 8b7e0492bc Updated from global requirements
Change-Id: Iff51fa5488115fc51c42bade6008228a3b4df06f
2017-01-16 17:28:13 +00:00