300 Commits

Author SHA1 Message Date
Doug Hellmann
f765a16c6c remove python 2.6 os-client-config classifier
OpenStack projects are no longer being tested under Python 2.6, so
remove the classifier implying that this project supports 2.6.

Change-Id: Ic24f93d5f7e7ffb1eaf91617c09cc897163e88df
2015-12-24 01:22:07 +00:00
Monty Taylor
939862e55e Fix glance endpoints with endpoint_override
Now that we properly pass endpoint_override all the time, we broke
glance. The reason for this is that we calculate the glance url via
glance url stripping in all cases, so the case where we did not have
a configured endpoint override was passing the wrong information to the
constructor, causing double version addition.

Change-Id: I5699b0581d0cb68fed68800c29c8a847e2606ec9
1.13.0
2015-12-21 11:59:52 -06:00
Monty Taylor
0a25cb5c50 Allow passing in explicit version for legacy_client
Nova (and indeed other clients with microversions, need a user to be
able to request an explicit version.

Change-Id: I5f67b7fc007b7d6123f621c5943345f88db1f84b
2015-12-21 09:37:30 -06:00
Monty Taylor
16166c03c2 Pass endpoint override to constructors
Also, the variable name from keystoneauth is "*-endpoint-override" ...
so we need to respond to that. Respond to the old -endpoint for compat
reasons. Then let's actually pass in the value.

Change-Id: I6f413b02e0d2b167a4ee30494b2c91c67124b219
2015-12-21 09:37:30 -06:00
Jenkins
dbdf8e4248 Merge "Support backwards compat for _ args" 2015-12-21 15:35:29 +00:00
Jenkins
94915f149c Merge "Add backwards compat mapping for auth-token" 2015-12-21 14:02:55 +00:00
Monty Taylor
3a34378f71 Support backwards compat for _ args
Instead of putting tons of hidden options to allow for variations of
argparse options with _ in them, just manipulate the argv when it's
passed in to translate to - instead. (why the heck does argparse not
already do this?)

Change-Id: I5f0bd9d9a333781ad13d531b3667fff5fdac9eac
2015-12-18 09:37:12 -08:00
Monty Taylor
22d740b700 Add backwards compat mapping for auth-token
novaclient accepted an auth-token argument, which also triggered a token
not password based workflow. That's fine - let's map that to token, and
if we find it, change auth_type's default from password to token.

Change-Id: Ie9acece5cb3c68560ae975bfb0fb2393381b6fba
2015-12-18 09:46:45 -05:00
Shuquan Huang
88b7e643b9 Replace assertEqual(None, *) with assertIsNone in tests
Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Change-Id: Ia1af9f64f4f0a66c1429d81313b2c27a7c67cdd7
Closes-bug: #1280522
2015-12-17 13:58:10 +08:00
David Shrewsbury
837ca71228 Allow arbitrary client-specific options
There are occasionally some client-specific things that would be handy
to be able to configure about behaviors. For instance, the only config
file that ansible's openstack inventory has is clouds.yaml. Rather than
teaching os-client-config about such things, allow a pass-through config
section. Apply key normalization to _'s like other configs, and merge
the clouds and secure files so that the sections behave like other OCC
config sections.

Change-Id: If307e95006abf6e1efbbd77cfc99e5fdfed6c80a
2015-12-14 16:14:47 -05:00
Monty Taylor
f4237a809c Add ceilometer constructor to known constructors
In porting ospurge to use get_legacy_client, it became clear that
the ceilometer client constructor was missing. Add it.

Change-Id: I1102105b78574378c4f11064e21245b08513247b
2015-12-09 15:53:59 -05:00
Jenkins
f3fff576d8 Merge "Update vexxhost to Identity v3" 2015-12-07 21:34:48 +00:00
Monty Taylor
d0c70cc962 Add support for generalized per-region settings
Internap creates a public and a private network for each customer for
each region on region activation. This means there is a per-region
external network that the user may want to specify. Also, conoha has
per-region auth-urls. Per-region config is still
overridden by argparse or kwargs values.

Change-Id: Ie2f3d2ca3ccbe7e3dd674983136b42c323544997
2015-12-07 15:35:04 -05:00
Jenkins
eab0f48340 Merge "Fix a README typo - hepler is not actually a thing" 2015-12-07 20:17:54 +00:00
Jenkins
4de73f0550 Merge "Make client constructor optional" 2015-12-07 20:09:35 +00:00
Monty Taylor
1221ea7fca Fix a README typo - hepler is not actually a thing
Change-Id: Ie8c267e75171b88bd3a1a3a684e85869e75843d7
2015-12-07 17:38:23 +00:00
Monty Taylor
8eced67abe Make client constructor optional
Turns out we know the mapping of service name to constsructor, so we can
try the import for the user without actually importing. Keep the
argument though, because this method should be usable by just about any
random openstack client lib. Also, because backwards compat.

Change-Id: I7e9672e3bf61b8b7b92d55903f4596382f18b515
2015-12-07 17:38:15 +00:00
Monty Taylor
b90f53bbf4 Updated README to clarify legacy client usage
Also, update it to use code-block - which makes things look much nicer.

Change-Id: I930ab63a5d159cf4cea27b4e2c4d6fd933de04fc
2015-12-06 21:49:29 -05:00
Monty Taylor
5beaeef2c3 Add simple helper function for client construction
Often times you don't want to take advantage of all the flexibility, you
simple want the basic works-like-it-should thing. Add a warpper around
get_legacy_client to do tht one thing.

Change-Id: I086dc4a8e762d4e8e56e01cabe2386577f2ceec8
2015-12-07 02:42:47 +00:00
Monty Taylor
ed2f34b06a Add method for registering argparse options
keystoneauth knows about a bunch of argparse options that users
from a command line will want. We do a good job of processing them
once they've been collected, but an os-client-config user doesn't
have a great way to make sure that they register all of the options,
especially when once considers that you really want to peek at the
args to see which auth plugin has been selected so that the right
arguments can be registered and displayed.

Depends-On: Ifea90b981044009c3642b268dd639a703df1ef05
Change-Id: Ic196f65f89b3ccf92ebec39564f5eaefe8a4ae4b
2015-12-06 21:39:49 -05:00
Monty Taylor
6aecb87e7f Update vexxhost to Identity v3
There is a discovery URL for vexxhost for keystone v3. Also, there is a
new vexxhost domain for it. Also, vexxhost has DNS running designate v1.
And make the region list a list of one region, because there is a second
region coming soon.

Change-Id: Ie72c19976646f41c713124659e69725df59e1580
2015-12-06 10:44:25 -05:00
Jenkins
3ceee61181 Merge "Make sure that cloud always has a name" 2015-12-05 02:10:14 +00:00
Jenkins
caede51461 Merge "Add support for secure.yaml file for auth info" 2015-12-05 02:09:05 +00:00
Monty Taylor
eea460d591 Make sure that cloud always has a name
If we don't ask for a cloud, and we fall through to the envvars cloud or
the defaults cloud, the cloud that is returned winds up not being named
- even though we know what cloud it is. Set the name of the cloud we're
working with.

This is important for the next patch, where we need to peek at the
config to get some default values, but in a fallthrough case we do not
know which cloud to request.

Change-Id: Ie56e490d4384f2d680450bc956e4b7b5b8099f0e
2015-12-03 07:36:01 -08:00
Jamie Lennox
026a17c9eb Remove optional keystoneauth1 imports
keystoneauth1 is now a hard dependency of os-client-config so there is
no way that this should not be importable.

Change-Id: I20901623e8b29f50d7ab1ed956472a4b1eda51bf
2015-12-02 11:05:29 +08:00
James E. Blair
cc92c92870 Add BHS1 to OVH
Change-Id: I0ef175edccbbc3e24803d02ab6809cfe1a68e0e8
1.12.0
2015-11-25 09:37:45 -08:00
Monty Taylor
0ea32e7dc0 Handle cinder v2
It turns out that cinder v2 has a service_type of volumev2 because
nobody thought of the children. But that's ok - we actually care about
user experience around here. SO - take the sane approach and return
service_type = volumev2 if service_type == volume and volume_api_version
== 2. This way user code can all safely say "please give me the endpoint
for the volume service" and can use the api_version parameter to specify
which version they want.

We should all possess righteous indignation about this patch.

Change-Id: I15fc5ddd92345d78b6928f11a8d77cecd0427f7d
2015-11-24 18:28:26 -05:00
Monty Taylor
b17bbcdef9 Add support for secure.yaml file for auth info
Almost nothing in clouds.yaml is secret, but the file has to be treated
as if it were because of the passwords or other secrets contained in it.
This makes it difficult to put clouds.yaml into a public or broadly
accessible config repository. Add support for having a second optional
file, secure.yaml, which can contain any value you can put in
clouds.yaml and which will be overlayed on top of clouds.yaml values.

Most people probably do not need this, but for folks with complex cloud
configs with teams of people working on them, this reduces the amount of
things that have to be managed by the privileged system.

Change-Id: I631d826588b0a0b1f36244caa7982dd42d9eb498
2015-11-22 14:56:09 -05:00
Monty Taylor
9c59002116 Fix lack of parenthesis around boolean logic
The legacy envvar prefix support broke a workaround for use of OS_
envvars in test cases. This is only currently a problem for shade functional
tests, but it IS a bug.

Change-Id: Ia0cbb4e2ea7ce6eeeea36533e057bd53a830d44c
1.11.1
2015-11-20 12:10:16 -05:00
Monty Taylor
10e96bcb7b Only pass timeout to swift if we have a value
swiftclient does not have the built-in None detection that keystoneauth
has, so we have to do it ourselves.

Change-Id: I3fcf60dd2f3350045b824899ac48b02809452a4b
1.11.0
2015-11-19 18:58:12 -05:00
Jenkins
88180f9771 Merge "Add support for legacy envvar prefixes" 2015-11-19 22:59:39 +00:00
Monty Taylor
0aefe152af Fix name of the object-store api key
There is only one value for this, and it's not consumed in the process
of making a swift client, so the chances that anyone set it
to something else are pretty much nil. However, for completeness we
should make it the right name, as "object-store" is the service key
name for swift, not "object".

Change-Id: I395c1c44a2f50996b61dff22e07149b8dd13eda9
2015-11-14 12:14:10 -05:00
Monty Taylor
3e76af913a Refactor per-service key making
The key for swift is object-store, but the key in the config dict
would be object_store_api_version, so the key concatenation would
not work. In fixing that, refactor out the creation of the keys so
that the concatenation and transformation needed always happens.

Change-Id: Ic095912bfc84f13ef8b11f312303a517289e0441
2015-11-14 12:10:09 -05:00
Monty Taylor
f5e1b859c8 Add support for legacy envvar prefixes
In trying to move the legacy clients to do their config via
os-client-config, many of them had prefixes like NOVA_ or GLANCE_
in their shells. It's pretty easy to support optionally passing those
in so that the transition to OCC is less of a change and we can
treat the deprecation cycle of those features as a different topic.

Change-Id: Ic819c0790989fa034db03d83535ee7b70aaacc3a
2015-11-13 12:49:09 -05:00
Jenkins
38f959b1b5 Merge "Add method to get a mounted session from config" 2015-11-12 13:40:15 +00:00
Jenkins
dfe21d75b8 Merge "Use requestsexceptions for urllib squelching" 2015-11-12 13:35:48 +00:00
Jenkins
99f162b114 Merge "Remove unneeded workaround for ksc" 2015-11-12 13:35:21 +00:00
David Shrewsbury
506d6e8ffe Fix JSON schema
We incorrectly refered to things with _api_ in the name.

Change-Id: I9130ae0f72484957d0a8943eceabcd6a6bc21c91
2015-11-10 17:16:02 -05:00
Jenkins
59f719c931 Merge "Workaround a dispute between osc and neutronclient" 1.10.2 2015-11-09 15:06:51 +00:00
Jenkins
44b10db500 Merge "Workaround for int value with verbose_level" 2015-11-09 14:46:11 +00:00
Monty Taylor
397da54db1 Workaround a dispute between osc and neutronclient
python-openstackclient wants network_api_version to be 2. neutronclient
wants it to be 2.0. There is a patch to OSC to make it understand both,
but in the mean time, let's unbreak people.

Change-Id: I4d8f187d1302c5bcfa246e017e6c6d8af9c3f733
2015-11-09 09:43:09 -05:00
Monty Taylor
c90de1f691 Workaround for int value with verbose_level
python-openstackclient uses an int value for verbose level which the
stringification patch broke. As a quick fix, special case verbose_level,
as fixing it properly might take more than 5 minutes.

Change-Id: Ie12a40d3d3e400b3ec2103d7a58c4902fb10fc2d
Closes-Bug: #1513919
2015-11-09 09:07:06 -05:00
Monty Taylor
ce7d716ffc Remove unneeded workaround for ksc
It turns out keystoneclient can take string input and does the
same transform we're doing here, it's just not documented. Remove the
workaround on our side as it's unneccesary.

Change-Id: Ie46945f7d96e3d65004cd19823b3be989e1d18a7
2015-11-08 18:48:24 -05:00
Monty Taylor
59ad0ed00b Add default API version for magnum service
shade is adding magnum support, so we should probably grow a default
value for the container_api_version.

Change-Id: I2551f2921f10ba109ccb52301cc8ad23c5f81c46
2015-11-08 18:23:34 -05:00
Monty Taylor
13b6fbabeb Work around a bug in keystoneclient constructor
keystoneclient bug #1513839 means that even when you proerly pass
a Session (like we do) to the discovery constructor (what you'd be
calling if you were passing "pass_version_arg = True") ksc fails
because you didn't send a URL.

We _HAVE_ an appropriate URL that we can pull from the Session. So
until ksc learns how to pull the URL from the Session itself, do it
for them.

Change-Id: I38eb4cfa750fab5196b86989c2cd498d41bf37ac
1.10.1
2015-11-06 09:04:12 -05:00
Monty Taylor
5b993208b9 Return cache settings as numbers not strings
While we're at it, let's also put in some tests to ensure that we're
processing data types properly.

Change-Id: I0442d234e8422a58738612b2da114f61cc9afc5c
2015-11-06 06:40:28 -05:00
Monty Taylor
2339243e66 Add method to get a mounted session from config
Getting a session is great, but sometimes you need a thing called
an "adapter" which takes 5 parameters which are all already contained in
the config that you used to get the session.

Change-Id: Id4e418cd04ae81540d9898f7b2e959b974f355d2
2015-11-05 17:08:50 -05:00
Jenkins
1b91e007fd Merge "Don't assume pass_version_arg=False for network" 1.10.0 2015-11-05 16:49:34 +00:00
David Shrewsbury
b8874ffc98 Convert floats to string
We do it for int values, so floats should be covered, too.

Change-Id: I1b98f7887ad421596b3bfdf2f6ad871a7d7f6bb2
2015-11-05 10:26:10 -05:00
Monty Taylor
d373969b98 Don't assume pass_version_arg=False for network
Excitingly, one of the places where we hard-code a workaround for
a differently behaving client is not needed. The Client in neutron
that takes a version arg is in neutronclient.neutron.client. Also,
pass the version arg as positional when we pass it, as some of the
clients (neutron) require it, and all accept it.

Change-Id: Ifcbaab782173b95a678af0b2792a1194b198b687
2015-11-05 05:24:35 -05:00