コード例 #1
0
 def build_resource_definition(self, res_name, res_defn):
     props = copy.deepcopy(res_defn)
     servers = props.pop(self.SERVERS)
     props[SoftwareDeployment.SERVER] = servers.get(res_name)
     return rsrc_defn.ResourceDefinition(res_name,
                                         'OS::Heat::SoftwareDeployment',
                                         props, None)
コード例 #2
0
        def rsrc_defn_item(name, snippet):
            data = self.parse(stack, snippet)

            depends = data.get(RES_DEPENDS_ON)
            if isinstance(depends, six.string_types):
                depends = [depends]

            deletion_policy = function.resolve(data.get(RES_DELETION_POLICY))
            if deletion_policy is not None:
                if deletion_policy not in six.iterkeys(self.deletion_policies):
                    msg = _('Invalid deletion policy "%s"') % deletion_policy
                    raise exception.StackValidationFailed(message=msg)
                else:
                    deletion_policy = self.deletion_policies[deletion_policy]

            kwargs = {
                'resource_type': data.get(RES_TYPE),
                'properties': data.get(RES_PROPERTIES),
                'metadata': data.get(RES_METADATA),
                'depends': depends,
                'deletion_policy': deletion_policy,
                'update_policy': data.get(RES_UPDATE_POLICY),
                'description': data.get(RES_DESCRIPTION) or ''
            }

            defn = rsrc_defn.ResourceDefinition(name, **kwargs)
            return name, defn
コード例 #3
0
ファイル: lbutils.py プロジェクト: Hybrid-Cloud/conveyor
def reload_loadbalancers(group, load_balancers, exclude=None):
    """Notify the LoadBalancer to reload its config.

    This must be done after activation (instance in ACTIVE state), otherwise
    the instances' IP addresses may not be available.
    """
    exclude = exclude or []
    id_list = grouputils.get_member_refids(group, exclude=exclude)
    for name, lb in six.iteritems(load_balancers):
        props = copy.copy(lb.properties.data)
        if 'Instances' in lb.properties_schema:
            props['Instances'] = id_list
        elif 'members' in lb.properties_schema:
            props['members'] = id_list
        else:
            raise exception.Error(
                _("Unsupported resource '%s' in LoadBalancerNames") % name)

        lb_defn = rsrc_defn.ResourceDefinition(
            lb.name,
            lb.type(),
            properties=props,
            metadata=lb.t.metadata(),
            deletion_policy=lb.t.deletion_policy())

        scheduler.TaskRunner(lb.update, lb_defn)()
コード例 #4
0
    def _get_instance_definition(self):
        conf_refid = self.properties[self.LAUNCH_CONFIGURATION_NAME]
        conf = self.stack.resource_by_refid(conf_refid)

        props = function.resolve(conf.properties.data)
        props['Tags'] = self._tags()
        vpc_zone_ids = self.properties.get(AutoScalingGroup.VPCZONE_IDENTIFIER)
        if vpc_zone_ids:
            props['SubnetId'] = vpc_zone_ids[0]

        azs = self.properties.get(self.AVAILABILITY_ZONES)
        if azs:
            props['AvailabilityZone'] = azs[0]

        return rsrc_defn.ResourceDefinition(None, SCALED_RESOURCE_TYPE, props,
                                            conf.t.metadata())
コード例 #5
0
 def _make_launch_config_resource(self, name, props):
     lc_res_type = 'AWS::AutoScaling::LaunchConfiguration'
     lc_res_def = rsrc_defn.ResourceDefinition(name, lc_res_type, props)
     lc_res = resource.Resource(name, lc_res_def, self.stack)
     return lc_res
コード例 #6
0
 def _get_resource_definition(self):
     conf, props = self._get_conf_properties()
     return rsrc_defn.ResourceDefinition(None, SCALED_RESOURCE_TYPE, props,
                                         conf.t.metadata())