~ubuntu-branches/ubuntu/saucy/heat/saucy-updates

« back to all changes in this revision

Viewing changes to heat/api/openstack/v1/stacks.py

  • Committer: Package Import Robot
  • Author(s): James Page, Chuck Short, James Page
  • Date: 2013-08-08 15:23:59 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130808152359-9jgqjp23kssvc3x9
Tags: 2013.2~b2.a186.g2b4b248-0ubuntu1
[ Chuck Short ]
* debian/patches/rename-quantumclient.patch: Dropped no longer needed. 
* debian/control: Add python-oslo.sphinx

[ James Page ]
* New upstream snapshot.
* d/watch: Updated to track releases on launchpad.
* d/control: Drop BD in pep8, no longer required.
* d/control,rules: Drop use of openstack-pkg-tools, revert use of xz
  compression for debs.
* d/control,*.config,*.templates,po: Drop use of debconf/dbconfig-common
  to configure heat.
* d/*.upstart: Add upstart configurations for Ubuntu.
* d/p/default-kombu.patch: Switch default messaging from qpid to
  kombu.
* d/p/default-sqlite.patch: Use sqlite as default database option.
* d/control: Add python-ceilometerclient to BD's.
* d/rules: Fail package build for unit test failures.
* d/*.install: Directly install configuration files to /etc/heat.
* d/control: Update VCS locations to ubuntu-server-dev branches.
* d/heat-common.{install,manpages}: Include new binaries and associated
  manpages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from heat.rpc import client as rpc_client
29
29
from heat.common import urlfetch
30
30
 
31
 
import heat.openstack.common.rpc.common as rpc_common
32
31
from heat.openstack.common import log as logging
33
 
from heat.openstack.common.gettextutils import _
34
32
 
35
33
logger = logging.getLogger(__name__)
36
34
 
190
188
        Lists summary information for all stacks
191
189
        """
192
190
 
193
 
        try:
194
 
            stacks = self.engine.list_stacks(req.context)
195
 
        except rpc_common.RemoteError as ex:
196
 
            return util.remote_error(ex)
 
191
        stacks = self.engine.list_stacks(req.context)
197
192
 
198
193
        summary_keys = (engine_api.STACK_ID,
199
194
                        engine_api.STACK_NAME,
211
206
        """
212
207
        Lists detailed information for all stacks
213
208
        """
214
 
        try:
215
 
            stacks = self.engine.list_stacks(req.context)
216
 
        except rpc_common.RemoteError as ex:
217
 
            return util.remote_error(ex)
 
209
        stacks = self.engine.list_stacks(req.context)
218
210
 
219
211
        return {'stacks': [format_stack(req, s) for s in stacks]}
220
212
 
226
218
 
227
219
        data = InstantiationData(body)
228
220
 
229
 
        try:
230
 
            result = self.engine.create_stack(req.context,
231
 
                                              data.stack_name(),
232
 
                                              data.template(),
233
 
                                              data.environment(),
234
 
                                              data.files(),
235
 
                                              data.args())
236
 
        except rpc_common.RemoteError as ex:
237
 
            return util.remote_error(ex)
 
221
        result = self.engine.create_stack(req.context,
 
222
                                          data.stack_name(),
 
223
                                          data.template(),
 
224
                                          data.environment(),
 
225
                                          data.files(),
 
226
                                          data.args())
238
227
 
239
228
        return {'stack': format_stack(req, {engine_api.STACK_ID: result})}
240
229
 
246
235
        try:
247
236
            identity = dict(identifier.HeatIdentifier.from_arn(stack_name))
248
237
        except ValueError:
249
 
            try:
250
 
                identity = self.engine.identify_stack(req.context,
251
 
                                                      stack_name)
252
 
            except rpc_common.RemoteError as ex:
253
 
                return util.remote_error(ex)
 
238
            identity = self.engine.identify_stack(req.context,
 
239
                                                  stack_name)
254
240
 
255
241
        location = util.make_url(req, identity)
256
242
        if path:
264
250
        Gets detailed information for a stack
265
251
        """
266
252
 
267
 
        try:
268
 
            stack_list = self.engine.show_stack(req.context,
269
 
                                                identity)
270
 
        except rpc_common.RemoteError as ex:
271
 
            return util.remote_error(ex)
 
253
        stack_list = self.engine.show_stack(req.context,
 
254
                                            identity)
272
255
 
273
256
        if not stack_list:
274
257
            raise exc.HTTPInternalServerError()
283
266
        Get the template body for an existing stack
284
267
        """
285
268
 
286
 
        try:
287
 
            templ = self.engine.get_template(req.context,
288
 
                                             identity)
289
 
        except rpc_common.RemoteError as ex:
290
 
            return util.remote_error(ex)
 
269
        templ = self.engine.get_template(req.context,
 
270
                                         identity)
291
271
 
292
272
        if templ is None:
293
273
            raise exc.HTTPNotFound()
302
282
        """
303
283
        data = InstantiationData(body)
304
284
 
305
 
        try:
306
 
            res = self.engine.update_stack(req.context,
307
 
                                           identity,
308
 
                                           data.template(),
309
 
                                           data.environment(),
310
 
                                           data.files(),
311
 
                                           data.args())
312
 
        except rpc_common.RemoteError as ex:
313
 
            return util.remote_error(ex)
 
285
        res = self.engine.update_stack(req.context,
 
286
                                       identity,
 
287
                                       data.template(),
 
288
                                       data.environment(),
 
289
                                       data.files(),
 
290
                                       data.args())
314
291
 
315
292
        raise exc.HTTPAccepted()
316
293
 
320
297
        Delete the specified stack
321
298
        """
322
299
 
323
 
        try:
324
 
            res = self.engine.delete_stack(req.context,
325
 
                                           identity,
326
 
                                           cast=False)
327
 
 
328
 
        except rpc_common.RemoteError as ex:
329
 
            return util.remote_error(ex)
 
300
        res = self.engine.delete_stack(req.context,
 
301
                                       identity,
 
302
                                       cast=False)
330
303
 
331
304
        if res is not None:
332
305
            raise exc.HTTPBadRequest(res['Error'])
342
315
 
343
316
        data = InstantiationData(body)
344
317
 
345
 
        try:
346
 
            result = self.engine.validate_template(req.context,
347
 
                                                   data.template())
348
 
        except rpc_common.RemoteError as ex:
349
 
            return util.remote_error(ex)
 
318
        result = self.engine.validate_template(req.context,
 
319
                                               data.template())
350
320
 
351
321
        if 'Error' in result:
352
322
            raise exc.HTTPBadRequest(result['Error'])
358
328
        """
359
329
        Returns a list of valid resource types that may be used in a template.
360
330
        """
361
 
 
362
 
        try:
363
 
            types = self.engine.list_resource_types(req.context)
364
 
        except rpc_common.RemoteError as ex:
365
 
            raise exc.HTTPInternalServerError(str(ex))
366
 
 
367
 
        return {'resource_types': types}
 
331
        return {'resource_types': self.engine.list_resource_types(req.context)}
 
332
 
 
333
    @util.tenant_local
 
334
    def generate_template(self, req, type_name):
 
335
        """
 
336
        Generates a template based on the specified type.
 
337
        """
 
338
        return self.engine.generate_template(req.context, type_name)
368
339
 
369
340
 
370
341
class StackSerializer(wsgi.JSONResponseSerializer):