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

« back to all changes in this revision

Viewing changes to heat/api/cfn/v1/signal.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:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
#
 
4
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
5
#    not use this file except in compliance with the License. You may obtain
 
6
#    a copy of the License at
 
7
#
 
8
#         http://www.apache.org/licenses/LICENSE-2.0
 
9
#
 
10
#    Unless required by applicable law or agreed to in writing, software
 
11
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
12
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
13
#    License for the specific language governing permissions and limitations
 
14
#    under the License.
 
15
 
 
16
from heat.common import wsgi
 
17
from heat.rpc import client as rpc_client
 
18
from heat.common import identifier
 
19
from heat.api.aws import exception
 
20
import heat.openstack.common.rpc.common as rpc_common
 
21
 
 
22
 
 
23
class SignalController(object):
 
24
    def __init__(self, options):
 
25
        self.options = options
 
26
        self.engine = rpc_client.EngineClient()
 
27
 
 
28
    def update_waitcondition(self, req, body, arn):
 
29
        con = req.context
 
30
        identity = identifier.ResourceIdentifier.from_arn(arn)
 
31
        try:
 
32
            md = self.engine.metadata_update(
 
33
                con,
 
34
                stack_identity=dict(identity.stack()),
 
35
                resource_name=identity.resource_name,
 
36
                metadata=body)
 
37
        except rpc_common.RemoteError as ex:
 
38
            return exception.map_remote_error(ex)
 
39
 
 
40
        return {'resource': identity.resource_name, 'metadata': md}
 
41
 
 
42
    def signal(self, req, body, arn):
 
43
        con = req.context
 
44
        identity = identifier.ResourceIdentifier.from_arn(arn)
 
45
        try:
 
46
            md = self.engine.resource_signal(
 
47
                con,
 
48
                stack_identity=dict(identity.stack()),
 
49
                resource_name=identity.resource_name,
 
50
                details=body)
 
51
        except rpc_common.RemoteError as ex:
 
52
            return exception.map_remote_error(ex)
 
53
 
 
54
 
 
55
def create_resource(options):
 
56
    """
 
57
    Signal resource factory method.
 
58
    """
 
59
    deserializer = wsgi.JSONRequestDeserializer()
 
60
    return wsgi.Resource(SignalController(options), deserializer)