Merge "replace v2.0 auth_url with v3"
This commit is contained in:
commit
d2e9882838
|
@ -21,6 +21,7 @@ from __future__ import print_function
|
|||
|
||||
import argparse
|
||||
import logging
|
||||
import string
|
||||
import sys
|
||||
|
||||
import monascaclient
|
||||
|
@ -310,6 +311,9 @@ class MonascaShell(object):
|
|||
" either --os-auth-url or via"
|
||||
" env[OS_AUTH_URL]")
|
||||
|
||||
if args.os_auth_url and 'v2.0' in args.os_auth_url:
|
||||
args.os_auth_url = string.replace(args.os_auth_url, 'v2.0', 'v3')
|
||||
|
||||
kwargs = {
|
||||
'username': args.os_username,
|
||||
'password': args.os_password,
|
||||
|
@ -324,7 +328,6 @@ class MonascaShell(object):
|
|||
'domain_name': args.os_domain_name,
|
||||
'insecure': args.insecure,
|
||||
'region_name': args.os_region_name
|
||||
|
||||
}
|
||||
|
||||
endpoint = args.monasca_api_url
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import string
|
||||
|
||||
from monascaclient.common import http
|
||||
from monascaclient.v2_0 import alarm_definitions
|
||||
|
@ -33,12 +34,16 @@ class Client(object):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize a new http client for the monasca API."""
|
||||
if 'auth_url' in kwargs and 'v2.0' in kwargs['auth_url']:
|
||||
kwargs['auth_url'] = string.replace(
|
||||
kwargs['auth_url'], 'v2.0', 'v3')
|
||||
self.http_client = http.HTTPClient(*args, **kwargs)
|
||||
self.metrics = metrics.MetricsManager(self.http_client)
|
||||
self.notifications = notifications.NotificationsManager(
|
||||
self.http_client)
|
||||
self.alarms = alarms.AlarmsManager(self.http_client)
|
||||
self.alarm_definitions = alarm_definitions.AlarmDefinitionsManager(self.http_client)
|
||||
self.alarm_definitions = alarm_definitions.AlarmDefinitionsManager(
|
||||
self.http_client)
|
||||
|
||||
def replace_token(self, token):
|
||||
self.http_client.replace_token(token)
|
||||
|
|
Loading…
Reference in New Issue