Add support for running tests against standalone Heat

This replicates what is in heatclient shell.
We need support for the OS_NO_CLIENT_AUTH.

Change-Id: I40990555f072d3e10db704c0f63f19db9c8ed8bf
This commit is contained in:
Angus Salkeld 2014-11-21 08:51:41 +10:00
parent 66e3fc8056
commit 357d71d02d

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import os
import cinderclient.client import cinderclient.client
import heatclient.client import heatclient.client
import keystoneclient.exceptions import keystoneclient.exceptions
@ -41,15 +43,20 @@ class ClientManager(object):
self.volume_client = self._get_volume_client() self.volume_client = self._get_volume_client()
def _get_orchestration_client(self): def _get_orchestration_client(self):
keystone = self._get_identity_client()
region = self.conf.region region = self.conf.region
token = keystone.auth_token endpoint = os.environ.get('HEAT_URL')
if os.environ.get('OS_NO_CLIENT_AUTH') == 'True':
token = None
else:
keystone = self._get_identity_client()
token = keystone.auth_token
try: try:
endpoint = keystone.service_catalog.url_for( if endpoint is None:
attr='region', endpoint = keystone.service_catalog.url_for(
filter_value=region, attr='region',
service_type='orchestration', filter_value=region,
endpoint_type='publicURL') service_type='orchestration',
endpoint_type='publicURL')
except keystoneclient.exceptions.EndpointNotFound: except keystoneclient.exceptions.EndpointNotFound:
return None return None
else: else: