diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-10-31 15:09:55 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-10-31 15:09:55 +0000 |
| commit | 1594785f00e73bbb767db7f53a1c2171d9eef210 (patch) | |
| tree | aeb6d4755e9d1f2518cc23bca9356689acaa2e15 | |
| parent | efc291257fb8655ab57e77c57de23f15968af998 (diff) | |
| parent | cfb6df121774b6e39dc93391369b72e5c88dca25 (diff) | |
| download | nova-1594785f00e73bbb767db7f53a1c2171d9eef210.tar.gz nova-1594785f00e73bbb767db7f53a1c2171d9eef210.tar.xz nova-1594785f00e73bbb767db7f53a1c2171d9eef210.zip | |
Merge "Clean up quantumv2.get_client"
| -rw-r--r-- | nova/network/quantumv2/__init__.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/nova/network/quantumv2/__init__.py b/nova/network/quantumv2/__init__.py index af114a80c..9070a1f3e 100644 --- a/nova/network/quantumv2/__init__.py +++ b/nova/network/quantumv2/__init__.py @@ -1,3 +1,5 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# # Copyright 2012 OpenStack LLC. # All Rights Reserved # @@ -12,8 +14,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -# -# vim: tabstop=4 shiftwidth=4 softtabstop=4 from nova import exception from nova import flags @@ -44,15 +44,14 @@ def _get_auth_token(): def get_client(context): token = context.auth_token - if not token: - if FLAGS.quantum_auth_strategy: - token = _get_auth_token() + if not token and FLAGS.quantum_auth_strategy: + token = _get_auth_token() + params = { + 'endpoint_url': FLAGS.quantum_url, + 'timeout': FLAGS.quantum_url_timeout, + } if token: - my_client = clientv20.Client( - endpoint_url=FLAGS.quantum_url, - token=token, timeout=FLAGS.quantum_url_timeout) + params['token'] = token else: - my_client = clientv20.Client( - endpoint_url=FLAGS.quantum_url, - auth_strategy=None, timeout=FLAGS.quantum_url_timeout) - return my_client + params['auth_strategy'] = None + return clientv20.Client(**params) |
