~ubuntu-branches/ubuntu/trusty/heat/trusty-security

« back to all changes in this revision

Viewing changes to heat/engine/resources/quantum/quantum.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Yolanda Robla, Chuck Short
  • Date: 2013-07-22 16:22:29 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130722162229-zzvfu40id94ii0hc
Tags: 2013.2~b2-0ubuntu1
[ Yolanda Robla ]
* debian/tests: added autopkg tests

[ Chuck Short ]
* New upstream release
* debian/control:
  - Add python-pbr to build-depends.
  - Add python-d2to to build-depends.
  - Dropped python-argparse.
  - Add python-six to build-depends.
  - Dropped python-sendfile.
  - Dropped python-nose.
  - Added testrepository.
  - Added python-testtools.
* debian/rules: Run testrepository instead of nosetets.
* debian/patches/removes-lxml-version-limitation-from-pip-requires.patch: Dropped
  no longer needed.
* debian/patches/fix-package-version-detection-when-building-doc.patch: Dropped
  no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#    License for the specific language governing permissions and limitations
14
14
#    under the License.
15
15
 
 
16
from quantumclient.common.exceptions import QuantumClientException
 
17
 
16
18
from heat.common import exception
17
19
from heat.engine import resource
18
20
 
23
25
 
24
26
class QuantumResource(resource.Resource):
25
27
 
26
 
    def __init__(self, name, json_snippet, stack):
27
 
        super(QuantumResource, self).__init__(name, json_snippet, stack)
28
 
 
29
28
    def validate(self):
30
29
        '''
31
30
        Validate any of the provided params
84
83
 
85
84
        raise exception.InvalidTemplateAttribute(resource=name, key=key)
86
85
 
87
 
    def handle_update(self, json_snippet):
88
 
        return self.UPDATE_REPLACE
 
86
    @staticmethod
 
87
    def is_built(attributes):
 
88
        if attributes['status'] == 'BUILD':
 
89
            return False
 
90
        if attributes['status'] in ('ACTIVE', 'DOWN'):
 
91
            return True
 
92
        else:
 
93
            raise exception.Error('%s resource[%s] status[%s]' %
 
94
                                  ('quantum reported unexpected',
 
95
                                   attributes['name'], attributes['status']))
 
96
 
 
97
    def _resolve_attribute(self, name):
 
98
        try:
 
99
            attributes = self._show_resource()
 
100
        except QuantumClientException as ex:
 
101
            logger.warn("failed to fetch resource attributes: %s" % str(ex))
 
102
            return None
 
103
        return self.handle_get_attributes(self.name, name, attributes)
 
104
 
 
105
    def _confirm_delete(self):
 
106
        while True:
 
107
            try:
 
108
                yield
 
109
                self._show_resource()
 
110
            except QuantumClientException as ex:
 
111
                if ex.status_code != 404:
 
112
                    raise ex
 
113
                return
89
114
 
90
115
    def FnGetRefId(self):
91
116
        return unicode(self.resource_id)