From 17f13f7bf4cea80e8e1380fbc8295318de5be383 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 13 Aug 2013 17:14:42 -0500 Subject: Create a new base REST API interface * restapi module provides basic REST API support * uses dicts rather than Resource classes * JSON serialization/deserialization * log requests in 'curl' format * basic API boilerplate for create/delete/list/set/show verbs * ignore H302 due to urllib import Change-Id: I3cb91e44e631ee19e9f5dea19b6bac5d599d19ce --- openstackclient/shell.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openstackclient/shell.py') diff --git a/openstackclient/shell.py b/openstackclient/shell.py index b66611b1..91b02a2b 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -29,6 +29,7 @@ from openstackclient.common import clientmanager from openstackclient.common import commandmanager from openstackclient.common import exceptions as exc from openstackclient.common import openstackkeyring +from openstackclient.common import restapi from openstackclient.common import utils @@ -368,6 +369,9 @@ class OpenStackShell(app.App): if self.options.deferred_help: self.DeferredHelpAction(self.parser, self.parser, None, None) + # Set up common client session + self.restapi = restapi.RESTApi() + # If the user is not asking for help, make sure they # have given us auth. cmd_name = None @@ -376,6 +380,7 @@ class OpenStackShell(app.App): cmd_factory, cmd_name, sub_argv = cmd_info if self.interactive_mode or cmd_name != 'help': self.authenticate_user() + self.restapi.set_auth(self.client_manager.identity.auth_token) def prepare_to_run_command(self, cmd): """Set up auth and API versions""" -- cgit v1.2.1