当前位置: 首页>>代码示例>>Python>>正文


Python FileLoader.get_file_from_url方法代码示例

本文整理汇总了Python中cfn_sphere.file_loader.FileLoader.get_file_from_url方法的典型用法代码示例。如果您正苦于以下问题:Python FileLoader.get_file_from_url方法的具体用法?Python FileLoader.get_file_from_url怎么用?Python FileLoader.get_file_from_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cfn_sphere.file_loader.FileLoader的用法示例。


在下文中一共展示了FileLoader.get_file_from_url方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_or_update_stacks

# 需要导入模块: from cfn_sphere.file_loader import FileLoader [as 别名]
# 或者: from cfn_sphere.file_loader.FileLoader import get_file_from_url [as 别名]
    def create_or_update_stacks(self):
        existing_stacks = self.cfn.get_stack_names()
        desired_stacks = self.config.stacks
        stack_processing_order = DependencyResolver().get_stack_order(desired_stacks)

        if len(stack_processing_order) > 1:
            self.logger.info(
                "Will process stacks in the following order: {0}".format(", ".join(stack_processing_order)))

        for stack_name in stack_processing_order:
            stack_config = self.config.stacks.get(stack_name)

            raw_template = FileLoader.get_file_from_url(stack_config.template_url, stack_config.working_dir)
            template = CloudFormationTemplateTransformer.transform_template(raw_template)

            combined_tags = dict(self.config.tags)
            combined_tags.update(stack_config.tags)

            parameters = self.parameter_resolver.resolve_parameter_values(stack_config.parameters, stack_name)
            stack = CloudFormationStack(template=template, parameters=parameters, tags=combined_tags,
                                        name=stack_name, region=self.config.region, timeout=stack_config.timeout)

            if stack_name in existing_stacks:

                self.cfn.validate_stack_is_ready_for_action(stack)
                self.cfn.update_stack(stack)
            else:
                self.cfn.create_stack(stack)

            CustomResourceHandler.process_post_resources(stack)
开发者ID:programmieramt,项目名称:cfn-sphere,代码行数:32,代码来源:__init__.py

示例2: upload_cfn_to_s3

# 需要导入模块: from cfn_sphere.file_loader import FileLoader [as 别名]
# 或者: from cfn_sphere.file_loader.FileLoader import get_file_from_url [as 别名]
def upload_cfn_to_s3(project, logger):
    """
    This task is separate since they only work with Python2 >2.6 by
    the time being. Python3 support is underway.

    This means, when using Python<2.7, this task is not visible
    (see __init__.py).
    """
    from cfn_sphere.file_loader import FileLoader
    from cfn_sphere.template.transformer import CloudFormationTemplateTransformer

    for path, filename in project.get_property('template_files'):
        template = FileLoader.get_file_from_url(filename, path)
        transformed = CloudFormationTemplateTransformer.transform_template(
                template)
        output = transformed.get_template_json()

        bucket_name = project.get_property('bucket_name')
        key_prefix = project.get_property('template_key_prefix')
        filename = filename.replace('.yml', '.json')
        filename = filename.replace('.yaml', '.json')
        version_path = '{0}v{1}/{2}'.format(
                key_prefix, project.version, filename)
        # latest_path = '{0}latest/{1}'.format(key_prefix, filename)

        acl = project.get_property('template_file_access_control')
        check_acl_parameter_validity('template_file_access_control', acl)
        upload_helper(logger, bucket_name, version_path, output, acl)
开发者ID:codesplicer,项目名称:pybuilder_aws_plugin,代码行数:30,代码来源:cfn_tasks.py

示例3: render_template

# 需要导入模块: from cfn_sphere.file_loader import FileLoader [as 别名]
# 或者: from cfn_sphere.file_loader.FileLoader import get_file_from_url [as 别名]
def render_template(filename):
    check_update_available()

    loader = FileLoader()
    template = loader.get_file_from_url(filename, None)
    template = CloudFormationTemplateTransformer.transform_template(template)
    click.echo(template.get_template_json())
开发者ID:programmieramt,项目名称:cfn-sphere,代码行数:9,代码来源:cli.py

示例4: render_template

# 需要导入模块: from cfn_sphere.file_loader import FileLoader [as 别名]
# 或者: from cfn_sphere.file_loader.FileLoader import get_file_from_url [as 别名]
def render_template(template_file, confirm):
    if not confirm:
        check_update_available()

    loader = FileLoader()
    template = loader.get_file_from_url(template_file, None)
    template = CloudFormationTemplateTransformer.transform_template(template)
    click.echo(template.get_pretty_template_json())
开发者ID:wormzer,项目名称:cfn-sphere,代码行数:10,代码来源:cli.py

示例5: validate_template

# 需要导入模块: from cfn_sphere.file_loader import FileLoader [as 别名]
# 或者: from cfn_sphere.file_loader.FileLoader import get_file_from_url [as 别名]
def validate_template(template_file, confirm):
    if not confirm:
        check_update_available()

    try:
        loader = FileLoader()
        template = loader.get_file_from_url(template_file, None)
        template = CloudFormationTemplateTransformer.transform_template(template)
        CloudFormation().validate_template(template)
        click.echo("Template is valid")
    except CfnSphereException as e:
        LOGGER.error(e)
        sys.exit(1)
    except Exception as e:
        LOGGER.error("Failed with unexpected error")
        LOGGER.exception(e)
        LOGGER.info("Please report at https://github.com/cfn-sphere/cfn-sphere/issues!")
        sys.exit(1)
开发者ID:wormzer,项目名称:cfn-sphere,代码行数:20,代码来源:cli.py


注:本文中的cfn_sphere.file_loader.FileLoader.get_file_from_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。