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

« back to all changes in this revision

Viewing changes to heat/engine/resources/software_config/cloud_config.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2014-03-06 17:18:51 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20140306171851-2h4id4c4bsh9xl31
Tags: 2014.1~b3-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/patches/adjust-dependencies.patch: Dropped no longer needed.
* debian/control: Add python-troveclient.
* debian/rules: fail to build if testsuite fails.
* debian/patches/use-oslo.sphinx-namespace.patch: Use oslo.sphinx namespace.

[ Adam Gandelman ]
* debian/heat-engine.install: Install /etc/heat/environment.d/*.
  (LP: #1285875).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#
 
3
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
4
#    not use this file except in compliance with the License. You may obtain
 
5
#    a copy of the License at
 
6
#
 
7
#         http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
#    Unless required by applicable law or agreed to in writing, software
 
10
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
11
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
12
#    License for the specific language governing permissions and limitations
 
13
#    under the License.
 
14
 
 
15
from heat.common.template_format import yaml
 
16
from heat.common.template_format import yaml_dumper
 
17
from heat.engine import properties
 
18
from heat.engine.resources.software_config import software_config
 
19
 
 
20
 
 
21
class CloudConfig(software_config.SoftwareConfig):
 
22
    PROPERTIES = (
 
23
        CLOUD_CONFIG
 
24
    ) = (
 
25
        'cloud_config'
 
26
    )
 
27
 
 
28
    properties_schema = {
 
29
        CLOUD_CONFIG: properties.Schema(
 
30
            properties.Schema.MAP,
 
31
            _('Map representing the cloud-config data structure which will '
 
32
              'be formatted as YAML.')
 
33
        )
 
34
    }
 
35
 
 
36
    def handle_create(self):
 
37
        props = {self.NAME: self.physical_resource_name()}
 
38
        cloud_config = yaml.dump(self.properties.get(
 
39
            self.CLOUD_CONFIG), Dumper=yaml_dumper)
 
40
        props[self.CONFIG] = '#cloud-config\n%s' % cloud_config
 
41
        sc = self.heat().software_configs.create(**props)
 
42
        self.resource_id_set(sc.id)
 
43
 
 
44
 
 
45
def resource_mapping():
 
46
    return {
 
47
        'OS::Heat::CloudConfig': CloudConfig,
 
48
    }