Commit 991d0aeb authored by Simon Leinen's avatar Simon Leinen

No longer specify service_type="compute"

Apparently it's not necessary.

Also, import warnings and use warn() to issue warnings.
parent d0b34ed3
......@@ -29,7 +29,7 @@
import os
import re
import sys
import warnings
from warnings import warn
from keystoneclient.v2_0 import client as keystone_client
from keystoneclient.auth.identity import v2
from keystoneclient import session
......@@ -83,7 +83,6 @@ class UsageAnalyzer:
for region in self.get_regions():
try:
ne[region] = nova_client.Client(session=self.auth_session,
service_type='compute',
region_name=region)
##
......@@ -94,11 +93,12 @@ class UsageAnalyzer:
##
ne[region].flavors.list()
except BadRequest as c:
print "WARN:", c
warn("Error creating nova client using session:\n "
+ str(c)
+ "\nRetrying using traditional credentials")
ne[region] = nova_client.Client(
self.username, self.password,
self.tenant_name, self.auth_url,
service_type="compute",
region_name=region)
self._nova_endpoints = ne
return ne
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment