Merge "Add glanceclient to heat"

This commit is contained in:
Jenkins 2014-05-09 15:18:45 +00:00 committed by Gerrit Code Review
commit 9371edc716
5 changed files with 63 additions and 1 deletions

View File

@ -698,6 +698,33 @@
#insecure=false #insecure=false
[clients_glance]
#
# Options defined in heat.common.config
#
# Type of endpoint in Identity service catalog to use for
# communication with the OpenStack service. (string value)
#endpoint_type=publicURL
# Optional CA cert file to use in SSL connections. (string
# value)
#ca_file=<None>
# Optional PEM-formatted certificate chain file. (string
# value)
#cert_file=<None>
# Optional PEM-formatted file that contains the private key.
# (string value)
#key_file=<None>
# If set, then the server's certificate will not be verified.
# (boolean value)
#insecure=false
[clients_nova] [clients_nova]
# #

View File

@ -52,6 +52,12 @@ except ImportError:
ceilometerclient = None ceilometerclient = None
logger.info(_('ceilometerclient not available')) logger.info(_('ceilometerclient not available'))
try:
from glanceclient import client as glanceclient
except ImportError:
glanceclient = None
logger.info(_('glanceclient not available'))
_default_backend = "heat.engine.clients.OpenStackClients" _default_backend = "heat.engine.clients.OpenStackClients"
cloud_opts = [ cloud_opts = [
@ -76,6 +82,7 @@ class OpenStackClients(object):
self._trove = None self._trove = None
self._ceilometer = None self._ceilometer = None
self._heat = None self._heat = None
self._glance = None
@property @property
def auth_token(self): def auth_token(self):
@ -148,6 +155,31 @@ class OpenStackClients(object):
self._swift = swiftclient.Connection(**args) self._swift = swiftclient.Connection(**args)
return self._swift return self._swift
def glance(self):
if glanceclient is None:
return None
if self._glance:
return self._glance
con = self.context
endpoint_type = self._get_client_option('glance', 'endpoint_type')
endpoint = self.url_for(service_type='image',
endpoint_type=endpoint_type)
args = {
'auth_url': con.auth_url,
'service_type': 'image',
'project_id': con.tenant,
'token': self.auth_token,
'endpoint_type': endpoint_type,
'ca_file': self._get_client_option('glance', 'ca_file'),
'cert_file': self._get_client_option('glance', 'cert_file'),
'key_file': self._get_client_option('glance', 'key_file'),
'insecure': self._get_client_option('glance', 'insecure')
}
self._glance = glanceclient.Client('1', endpoint, **args)
return self._glance
def neutron(self): def neutron(self):
if neutronclient is None: if neutronclient is None:
return None return None

View File

@ -358,6 +358,9 @@ class Resource(object):
def heat(self): def heat(self):
return self.stack.clients.heat() return self.stack.clients.heat()
def glance(self):
return self.stack.clients.glance()
def _do_action(self, action, pre_func=None, resource_data=None): def _do_action(self, action, pre_func=None, resource_data=None):
''' '''
Perform a transition to a new state via a specified action Perform a transition to a new state via a specified action

View File

@ -14,6 +14,7 @@ posix_ipc
pycrypto>=2.6 pycrypto>=2.6
python-ceilometerclient>=1.0.6 python-ceilometerclient>=1.0.6
python-cinderclient>=1.0.6 python-cinderclient>=1.0.6
python-glanceclient>=0.9.0
python-heatclient>=0.2.3 python-heatclient>=0.2.3
python-keystoneclient>=0.8.0 python-keystoneclient>=0.8.0
python-neutronclient>=2.3.4,<3 python-neutronclient>=2.3.4,<3

View File

@ -7,7 +7,6 @@ mock>=1.0
mox>=0.5.3 mox>=0.5.3
oslosphinx oslosphinx
oslotest oslotest
python-glanceclient>=0.9.0
sphinx>=1.1.2,<1.2 sphinx>=1.1.2,<1.2
testrepository>=0.0.18 testrepository>=0.0.18
testscenarios>=0.4 testscenarios>=0.4