def get_resource(self,
                  blueprint_id,
                  deployment_id,
                  resource_path,
                  template_variables=None):
     resource = manager.get_resource(blueprint_id=blueprint_id,
                                     deployment_id=deployment_id,
                                     resource_path=resource_path)
     return self._render_resource_if_needed(
         resource=resource,
         template_variables=template_variables)
Ejemplo n.º 2
0
 def get_resource(self,
                  blueprint_id,
                  deployment_id,
                  resource_path,
                  template_variables=None):
     resource = manager.get_resource(blueprint_id=blueprint_id,
                                     deployment_id=deployment_id,
                                     tenant_name=self.ctx.tenant_name,
                                     resource_path=resource_path)
     return self._render_resource_if_needed(
         resource=resource, template_variables=template_variables)
Ejemplo n.º 3
0
    for trigger_type_name in triggers_to_remove:
        del policy_triggers[trigger_type_name]


def _process_source(source):
    split = source.split('://')
    schema = split[0]
    the_rest = ''.join(split[1:])

    try:
        if schema in ['http', 'https']:
            return requests.get(source).text
        elif schema == 'file' and the_rest:
            with open(the_rest) as f:
                return f.read()
    except IOError, e:
        raise NonRecoverableError('Failed processing source: {} ({})'.format(
            source, e.message))

    try:
        # try downloading blueprint resource
        return ctx.get_resource(source)
    except HttpException:
        pass
    try:
        # try downloading cloudify resource
        return get_resource(source)
    except HttpException:
        pass
    raise NonRecoverableError('Failed processing source: {}'.format(source))
Ejemplo n.º 4
0
        del policy_triggers[trigger_type_name]


def _process_source(source):
    split = source.split('://')
    schema = split[0]
    the_rest = ''.join(split[1:])

    try:
        if schema in ['http', 'https']:
            return requests.get(source).text
        elif schema == 'file' and the_rest:
            with open(the_rest) as f:
                return f.read()
    except IOError, e:
        raise NonRecoverableError('Failed processing source: {} ({})'
                                  .format(source, e.message))

    try:
        # try downloading blueprint resource
        return ctx.get_resource(source)
    except HttpException:
        pass
    try:
        # try downloading cloudify resource
        return get_resource(source)
    except HttpException:
        pass
    raise NonRecoverableError('Failed processing source: {}'
                              .format(source))