Commit Graph

407 Commits

Author SHA1 Message Date
Takashi Kajinami 1971cbdc72 Remove ceilometerclient
... because ceilometerclient was retired a long ago.

Change-Id: I6f3694640727d5d60bb50c34b2d2038eb978fda4
2023-02-20 12:08:56 +09:00
Dr. Jens Harbott 624cb97222 Fix zuul jobs
Some clients dropped support for py37, run the tips job with py38
instead.

Drop lower-constraints jobs and use the latest version of the
openstack-python3-jobs template.

Fix pep8 errors that have crept in.

Disable shade jobs until they can get fixed.

Change-Id: I99871f28cd8a66adf5610104ca142c2871e99b0d
2022-05-24 15:34:10 +02:00
Sean McGinnis bc96c23a9c
Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Ieb1746b1ad7571cb87f5b1e7a6876ce72e6b76c3
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-03-13 13:50:53 -05:00
Sean McGinnis 1ea2095c1f Fix pep8 issue in o_c_c/__init__
Change-Id: I18b35b67a2b81726e0b98b42658d9e78f856b0a3
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-01-09 11:10:19 -06:00
Mohammed Naser d338afa6a4 Shift Limestone Networks profile to openstacksdk
All of the other profiles have been moved but it looks like this
one was missed.

Depends-On: https://review.openstack.org/574746
Change-Id: I9efbc92ebb903378f492bf9b16d2e5beffbfea19
2018-06-12 10:36:30 -04:00
Monty Taylor 46ac30df8e Remove app_name config tests
These are testing that an underlying method is being called with a set
of parameters but the method isn't implemented in this library.

Change-Id: I29d354f7584d783104220a797ef9cf97bcc490a2
2018-05-25 18:28:07 +00:00
Alexander D 590b1723b5
fix saltstack breakage introduced in v1.31.0
SaltStack's openstack cloud provider in current production release calls
os_client_config.vendors.get_profile after importing just
os_client_config:
https://github.com/saltstack/salt/blob/v2018.3.0/salt/cloud/clouds/openstack.py#L319
After 5c2eae8f82 vendors module is no
longer imported into os_client_config which results in
AttributeError: 'module' object has no attribute 'vendors'
Importing this manually in __init__.py fixes it, however I wasn't able
to write a working test case — testtools loader loads all submodules
recursively and test runs without throwing exception.
I hope someone more knowledgeable review this change and confirm it
doesn't break this use case anymore.
Thanks in advance.

Change-Id: I5a3cb6096a090c29e257079da7c3d07d5a9b3428
Signed-off-by: Alexander D <maniac@pzskc383.dp.ua>
2018-05-18 02:17:21 +03:00
Monty Taylor c0bffa60f3
Remove service-type override tests
The upcoming changes to openstascksdk for supporting discovery properly
make these irrelevant ... and actually incorrect. Remove them so we can
land the discovery support. Also, update test_getters to account for
the volume to block-storage shift.

Change-Id: I485fe36e0f3a1ae97e8254a784c37b7fa641844d
2018-05-10 12:04:14 -05:00
Monty Taylor 20c50d5fd6
Fix F405 additional strictness
Change-Id: If4bf5d3e8b23fba75b487a28863b2ec14c5048c2
2018-05-10 11:54:33 -05:00
Monty Taylor e650339107
Add cache methods back to OpenSackConfig
These don't exist in sdk anymore. Add them back here for compat.

Change-Id: Iddba4809e1e6a949807426d46aa7701c2cd2b007
2018-05-04 08:58:44 -05:00
Monty Taylor 5c2eae8f82
Replace guts with openstack.config
The code has been moved into openstacksdk. Make os-client-config a
thin wrapper around that code.

The legacy client code needs to stay, as it was removed in openstacksdk.

We also have to plumb os_client_config.defaults and
os_client_config.cloud_region.CloudRegion in so that users get the
os-client-config versions from the openstacksdk methods that return the
relevant objects.

Support for per-service region_name has been dropped. This was never
used anywhere and was added for compatibility with openstacksdk Profile
objects. Since Profile objects are no more, we can remove it. It never
made any sense.

Change-Id: I7180e20aa675c0ccbe3718493a6eff2be7e1b8b6
2018-04-27 08:42:17 -05:00
Nick Jones cf5f446f27
Remove DataCentred from list of vendors
DataCentred's cloud service was shut down late 2017, and so this vendor
should be removed from the list.

Change-Id: Id10cbed6eaa02cafaf5d220032014b2a3f58ad82
Signed-off-by: Nick Jones <nick@stackhpc.com>
2018-04-12 14:11:54 +01:00
Zuul 6270321ec3 Merge "Add Limestone Networks vendor info" 2018-04-02 02:31:53 +00:00
Zuul 2e691c9aab Merge "Use 'none' auth plugin" 2018-03-31 14:53:37 +00:00
Logan V 9c9337234f Add Limestone Networks vendor info
Adds the Limestone Networks provider info for the Dallas and
Salt Lake regions.

Change-Id: Id457ea68938aea955162dc42a112568b2e55b850
2018-03-29 04:03:52 +00:00
Mohammed Naser 4216b2fb84 Add image_format for VEXXHOST profile
Change-Id: I7d15abb4ee1cbe84f7d7b976bd665635018ed3dc
2018-03-19 16:42:24 -04:00
Pavlo Shchelokovskyy ca52061c40 Use 'none' auth plugin
since keystoneauth 3.0.0 there is a proper 'none' auth plugin to
use for standalone services deployed w/o Keystone support.

Use this plugin instead of 'admin_token' for auth_type specified as
variants of 'None'.

Change-Id: I425f03574858dd582118d5544381af703134da72
2018-03-14 10:35:20 +02:00
Christian Berendt 593ed45db9 Add betacloud to the vendors
Change-Id: I599156ee4e2ff52e4db5669fce6cacd22447c3b0
2017-12-11 22:31:01 +01:00
Zuul 480bfc2722 Merge "Do not apply format expansions to passwords" 2017-12-09 23:02:35 +00:00
Dean Troyer f0ce20703d
Make the get_service_type() overrides tolernat of no defaults
The service type overrides in get_service_type() fail if the
API version keys are not present in the config dict, which happens
when CloudConfig is created without reading defaults.

Change-Id: I8d035cfd1afc1cad01ceac7cd643568e94897e27
2017-12-08 09:29:27 -06:00
John Dennis c7243f1747 Do not apply format expansions to passwords
get_one_cloud() and get_one_cloud_osc() iterate over config
values and try to expand any variables in those values by
calling value.format(), however some config values
(e.g. password) should never have format() applied to them, not
only might that change the password but it will also cause the
format() function to raise an exception if it can not parse the
format string. Examples would be single brace (e.g. 'foo{')
which raises an ValueError because it's looking for a matching
end brace or a brace pair with a key value that cannot be found
(e.g. 'foo{bar}') which raises a KeyError.

It is not reasonsable to try to escape any braces because:

1) Escaping all braces breaks valid use of the format string syntax.

2) Trying to determine exactly which braces should be escaped and
which should be preserved is a daunting task and likely would not be
robust.

3) Some strings might look like valid format syntax but still should
be escaped (e.g. "foo{bar}", if this appeared in a password we
wouldn't escape it and there would be a key error on the 'bar' key.

4) In general passwords should never be modified, you never want to
apply formatting to them.

The right approach is to maintain a list of config values which are
excluded from having formatting applied to them. At the moment that
list just includes 'password' but perhaps down the road other
exceptions might crop up. This patch follows this approach,
the list of excluded values can easily be updated if others are
discovered.

Change-Id: I187bdec582d4c2cc6c7fda47a1538194137c616b
Closes-Bug: 1635696
Signed-off-by: John Dennis <jdennis@redhat.com>
2017-12-05 15:00:30 -06:00
Monty Taylor 162a7a59fd Added nat_source flag for networks.
In some more complex clouds there can not only be more than one valid network
on a server that NAT can attach to, there can also be more than one valid
network from which to get a NAT address. Allow flagging a network so that it
can be found.

Change-Id: I3d8dd6d734a1013d2d4a43e11c3538c3a345820b
2017-10-21 19:04:30 +00:00
Zuul da432d4a51 Merge "Update make_rest_client to work with version discovery" 2017-10-21 15:19:51 +00:00
Zuul eab9a3ed7b Merge "Treat clouds.yaml with one cloud like envvars" 2017-10-18 19:10:59 +00:00
Zuul 2ed3b34a78 Merge "Protect against p_opt not having prompt attribute" 2017-10-18 18:48:20 +00:00
Monty Taylor 3e66722b29
Update make_rest_client to work with version discovery
Using make_rest_client on clouds that put unversioned endpoints in the
catalog results in incorrectly set up adapters.

Add the plumbing to get_session_client to pass version args to
keystoneauth. Then use that from make_rest_client.

Change-Id: I69ad746f672ef0b12680e9db3c7b0c691c9f87e4
2017-10-18 15:49:23 +02:00
Monty Taylor ed09236683
Protect against p_opt not having prompt attribute
In ansible/ansible#28746 it was reported that there are times
when a p_opt is getting here that does not have a prompt
attribute. Protecting against that is fairly easy to do.

Change-Id: Ia02528f4a107893e480135bc214aa156b8684507
Closes-Bug: #1717906
2017-09-21 09:07:31 -05:00
Monty Taylor 45fd7b4a94
Treat clouds.yaml with one cloud like envvars
If there is only one cloud and that cloud is envvars, things work as
expected. If there is only one cloud in clouds.yaml and no envvars
cloud, we throw an error, even though it should be obvious which cloud
was intended.

Change-Id: Ia49d0fb2cc7dca36476d0e5ae3fe2b2aa1209e59
2017-09-19 14:40:53 -05:00
Monty Taylor eafc8bed56
Fix requires_floating_ip
This isn't a required piece of the config, so it might be unset. Use get
instead of [].

Change-Id: I1bbbcb4ac63a4f6d4399c0fa8881c21264a03e4b
2017-09-16 13:13:25 -05:00
Sean Handley 164501c715 DataCentred supports Keystone V3 and Glance V2.
Change-Id: Ia8c656e2c6b97c877f5028fef8a94a2c41909bc5
2017-08-11 14:12:50 +01:00
Joshua Harlow d597ee271e Update globals safely
The right way to update these globals is to use a lock
and ensure that nobody else is updating them at the same
time. Also update a temporary dictionary before setting
the global one so that nobody sees partial updates to the
global one.

This should help fix the thread-safety of shade (and other
tooling built ontop of this library).

Change-Id: Ie0e0369d98ba6a01edcbf447378a786eec3f13f9
2017-08-07 15:46:59 -07:00
Andreas Jaeger eed1cbb8cd Remove OSIC
OSIC has been decommissioned, remove the now useless vendor data.

Change-Id: I57c6043018e96c0069c7db777b9f585cb7d535e7
Related-Change: I2d1b0710e875bd1ebc305fb5b184b68bf18f2ef7
2017-08-05 18:52:47 +02:00
Doug Hellmann 412f0fdd85 turn on warning-is-error in documentation build
Change-Id: I18cdecec84f8dd5f11741ac1ffc35630f7eb64b8
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-22 15:17:54 -04:00
Jenkins fe39a9f020 Merge "Revert "Revert "Use interface not endpoint_type for keystoneclient""" 2017-05-25 23:10:41 +00:00
Jenkins 2f377fc9f7 Merge "Don't pop from os.environ" 2017-05-25 22:55:30 +00:00
Jenkins 0020d9c192 Merge "Keep a singleton to support multiple get_config calls" 2017-05-25 22:55:25 +00:00
Jenkins 357244a2d1 Merge "Add ironicclient to constructors list" 2017-05-25 22:55:19 +00:00
Jenkins 9332c5acfd Merge "Add helper method to fetch service catalog" 2017-05-25 22:55:10 +00:00
Matthew Booth 990cfa3ce2
Don't pop from os.environ
It's rude to other users and subsequent callers.

Change-Id: I7789f381c99311bfd1c1e0a9869cbacbc96b17d6
2017-05-25 08:31:42 -05:00
Monty Taylor 8235e0ce6c
Keep a singleton to support multiple get_config calls
We are destructive to os.environ in the OpenStackConfig constructor- so
it really should only ever be called once. Make sure get_config does
this.

Change-Id: I279bdf68408a807ec18fba634df3769c9b8fc4dc
Closes-Bug: #1691294
2017-05-16 18:13:48 -05:00
Monty Taylor a483534123
Revert "Revert "Use interface not endpoint_type for keystoneclient""
Unrevert the endpoint_type/interface patch. But this time around, put in
a check for API version 2.0 and only apply the interface arg if it's for
v3.

This reverts commit 4493871824.

Change-Id: Ib347ec686d4d01788ee943c4c4f809aad06d9ccf
2017-05-13 08:56:41 -05:00
Jordan Pittier 4493871824 Revert "Use interface not endpoint_type for keystoneclient"
This reverts commit 38e5eba621.

This patch introduced a bug when using Keystone v2. With this patch, the
following works:

python -c "import os_client_config; print(os_client_config.make_client('identity', auth_url='http://localhost/identity_admin', username='admin', project_name='admin', password='testtest', identity_api_version='3').roles.list())"

But changing identity_api_version from 3 to 2.0 raises an exception.

Without this patch, both 3 and 2.0 works.

Change-Id: I8d2ad71ff51a08af1166d36805b740ea272939ed
2017-05-13 08:35:02 +00:00
Monty Taylor 7a3acde3ed
Add ironicclient to constructors list
Change-Id: I29db3c830759a80d8ea9f0d93a213b4bae4c8b59
2017-05-12 12:05:50 -05:00
Monty Taylor 347fe82c92
Add helper method to fetch service catalog
Grabbing the catalog is weird. OCC should help.

Change-Id: I6e7176568311c1f0e644a8e8876f56c3e153d6e8
2017-05-08 07:20:53 -04:00
Monty Taylor 17debbb099
Fix interactions with keystoneauth from newton
keystoneauth in newton did not have app_name or app_version
as Session parameters. Although it isn't a super common combination,
user agent strings aren't a reason to break something. Add a
simple workaround.

Change-Id: Ib5774389fefdbc190a4b78dd6784c8006afbb270
2017-04-28 15:06:27 -05:00
Jenkins f6804f6b0d Merge "Make _fix_argv() somewhat compatible with Argparse action='append'" 2017-04-25 22:58:22 +00:00
Jenkins d300678f40 Merge "Add designateclient to constructors list" 2017-04-25 15:07:20 +00:00
Jordan Pittier ff2c06c305 Make _fix_argv() somewhat compatible with Argparse action='append'
Python Argparse supports the 'append' action [1] which is super handy to allow
a user to repeat several times the same argument, each time with different
values.

This doesn't work with occ that tries to "fix argv" but raises this error:

os_client_config.exceptions.OpenStackConfigException: The following options
were given: '--foo,--foo' which contain duplicates except that one has _
and one has -. There is no sane way for us to know what you're doing.
Remove the duplicate option and try again

This patch tweak the _fix_argv() function so that it doesn't explode
if the duplicate option has no '_' not '-' in its name.

Change-Id: I4f06b6aff8d3ab1df45637399bc3a9b4b61764a9
Related-bug: #1685630
2017-04-23 17:47:49 +02:00
Monty Taylor 64b28d42ed
Add ability to pass in user_agent
keystoneauth supports adding a user_agent info to the Session and
Adapter via app_name. Allow users to add app_name/app_name and versions as
desired. Also, add os-client-config into additional_user_agent.

As an example, once this is landed and plumbed through shade,
nodepool will set app_name='nodepool' and we'll have:

  User-Agent: nodepool/0.4.0 os-client-config/1.26.1 shade/1.19.1
              keystoneauth1/2.18.0 python-requests/2.13.0 CPython/2.7.12

Change-Id: I1eb4dbd2587dcbe297b5c060c3c34b68ef51ef5e
2017-04-18 03:51:04 -05:00
Monty Taylor 451ec8daad
Remove out of date comment
Change-Id: I8a26f5952456a96429ff1413b90aef3091a8b5bf
2017-03-28 10:59:32 -05:00