Commit Graph

9 Commits

Author SHA1 Message Date
ZhijunWei fb33d01882 Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: I72a882f2c33ea8c5b79625b3bb3e951204e0bba7
2019-01-06 19:06:14 +08:00
Monty Taylor e11dc0f670
Fix service_type normalization
The previous version of the function would fail poorly when service_type
is None. Put in an if to fix it.

Change-Id: Ibbeee913afc463705fe781c2ef0918deb1303617
Story: 2003314
2018-08-06 10:52:53 -05:00
Monty Taylor 2441006a71
Add flag for returning unofficial types
In consuming code in openstacksdk and keystoneauth, the pattern:

  if stm.is_official(service_type):
      return stm.get_service_type(service_type)
  return service_type

Gets used in several places. Let's provide a way to say that with a
flag:

  return std.get_service_type(service_type, permissive=True)

which says "get me the official service_type for this, but if it's not
something I know about, give me the thing the user asked for.

Change-Id: Ib8fb14a88ecc690da67967b7e906deb7d923f869
2018-07-26 08:36:03 -04:00
Monty Taylor a064fe49ed
Allow passing in service types with _ in them
-'s vs. _'s is a thing people can get wrong from time to time. If
someone says "I want block_storage" - we know what they mean - or at
least we can.

Change-Id: I97c65c25ae8e787f4bfedab54db619d98a16f037
2018-07-24 10:47:21 -05:00
Monty Taylor 8e1b7471b6
Consume new mapping fields from service-type-authority
The service type authority is publishing three new pre-computed
mappings. Add getters to expose them and use them where appropriate.
Also, add a method that will return all of the service data for a
project with more than one service to complement the one that only
returns the primary data.

Depends-On: Ib761cf9de875e7b80404797d4aa8d294ca56347a
Change-Id: I78d2dfa03a5a0c392a85a7a77612098b4b01f70e
2017-08-17 08:39:18 -05:00
Monty Taylor 3e8e86bdb5 Support secondary services
The data now allows marking a service as secondary to support
placement/compute in nova. Support that in by_project.

Adds placement to the built-in data so that we can see the testing of
it. We should not approve this patch until approving the Add placement
service patch.

Change-Id: I01ad2934bdcb9346f4af88520f572d9b4f852b5d
2017-08-14 14:12:40 +00:00
Monty Taylor fdcb50f595
Add ability to warn on use of non-official types
Consumers of os-service-types may want to warn their users about using
non-official types while still making use of the alias data to allow
things to work. Since os-service-types is at the bottom of the stack for
that, it can be useful to just configure ServiceTypes to emit the
warnings itself - that way people can be assured that all the codepaths
are hit.

Change-Id: Ia4ea392671c8196a5083ac1ab27cc1e4fb289946
2017-07-25 14:28:23 -04:00
Monty Taylor 6522198058
Throw an exception on conflicting arguments
If session and only_remote conflict, we should throw an error. Otherwise
saying "session=None, only_remote=True" silently does not fetch remotely
and returns builtins.

While we're in there, clean up review feedback.

Change-Id: I70db70a541a3401bb57b2003a90333adb3508b51
2017-07-24 05:46:43 +08:00
Monty Taylor 48a94e00a7
Implement fetching and accessor methods
The ServiceTypes class is the main entry point for python programmers.
It should allow them to answer the questions they have about the data
without necessarily walking the structure. It can also return the raw
structure if people want to get at it.

We need to know the project codename for services for doing API doc
publication validation and also for being able to send legacy
microversion headers. The information is in the data, use it.

In order to construct and send microversion headers for projects with
aliases, we need to know ALL of the aliases plus the official name,
because we don't know which one of the values will be the correct name
the service is looking for for a given version. The microversion spec,
however, requires that consumers be able to handle a header that
contains a list of services and to ignore the ones it isn't looking for.

By providing a a list of all the possible values we make it easy to
construct a header for a service given a service_type that should work
for all known identifiers of the service and that is future compatible
with the service-type and microversion specifyier aligning.

Co-Authored-By: Doug Hellmann <doug@doughellmann.com>
Change-Id: I57641c9e3c27688b6d7709b1bb07292740d26659
2017-07-19 13:18:14 +09:00