Use standard FnGetAtt method for Swift container
Change-Id: I07b260d11f1c41f6e406f99df77cfad1c65a8a4b
This commit is contained in:
parent
1a2747c5e3
commit
3d89c8b55b
@ -14,7 +14,6 @@
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from swiftclient import exceptions as swift_exceptions
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import attributes
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
@ -152,7 +151,7 @@ class SwiftContainer(resource.Resource):
|
||||
def FnGetRefId(self):
|
||||
return unicode(self.resource_id)
|
||||
|
||||
def FnGetAtt(self, key):
|
||||
def _resolve_attribute(self, key):
|
||||
parsed = list(urlparse.urlparse(self.swift().url))
|
||||
if key == self.DOMAIN_NAME:
|
||||
return parsed[1].split(':')[0]
|
||||
@ -175,9 +174,6 @@ class SwiftContainer(resource.Resource):
|
||||
return headers['x-container-bytes-used']
|
||||
elif key == self.HEAD_CONTAINER:
|
||||
return headers
|
||||
else:
|
||||
raise exception.InvalidTemplateAttribute(resource=self.name,
|
||||
key=key)
|
||||
|
||||
|
||||
def resource_mapping():
|
||||
|
@ -15,6 +15,7 @@
|
||||
import mox
|
||||
import swiftclient.client as sc
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine.resources import swift
|
||||
from heat.engine import scheduler
|
||||
@ -148,7 +149,7 @@ class swiftTest(HeatTestCase):
|
||||
self.assertEqual('17680980', rsrc.FnGetAtt('BytesUsed'))
|
||||
self.assertEqual(headers, rsrc.FnGetAtt('HeadContainer'))
|
||||
|
||||
self.assertRaises(swift.exception.InvalidTemplateAttribute,
|
||||
self.assertRaises(exception.InvalidTemplateAttribute,
|
||||
rsrc.FnGetAtt, 'Foo')
|
||||
|
||||
scheduler.TaskRunner(rsrc.delete)()
|
||||
|
Loading…
Reference in New Issue
Block a user