Esempio n. 1
0
def GenerateConfig(context):
    """Main entry point for Deployment Manager logic"""

    module = "project"

    cc = config_merger.ConfigContext(context.properties, module)

    naming = naming_helper.NamingHelper(cc)

    return {
        'resources': [
            #{
            #    'name': naming.getProjectName('example-tool'),
            #    'type': 'project.py',
            #    'properties': cc.configs['project_module']
            #}
        ],
        'outputs': [{
            'name':
            'outp_3',
            'value':
            json.dumps(
                naming.configs,
                sort_keys=True,
                indent=4,
                separators=(',', ': '))
        }]
    }
def GenerateConfig(context):
    """Main entry point for Deployment Manager logic"""

    module = "frontend"
    cc = config_merger.ConfigContext(context, module)

    return {
        'resources': [
            #{
            #'name': 'simple_frontend',
            #'type': 'simple_frontend.py',
            #'properties': context.properties
            #}
        ],
        'outputs': [{
            'name': 'env_name',
            'value': context.properties["envName"]
        }, {
            'name': 'context',
            'value': cc.configs['CONTEXT']
        }, {
            'name': 'HQ_Address',
            'value': cc.configs['HQ_Address']
        }, {
            'name': 'ServiceName',
            'value': cc.configs['ServiceName']
        }, {
            'name': 'versionNR',
            'value': cc.configs['versionNR']
        }, {
            'name': 'outp_3',
            'value': str(cc.configs)
        }]
    }
Esempio n. 3
0
def GenerateConfig(context):
    """Generate configuration."""

    module = "frontend"
    cc = config_merger.ConfigContext(context.properties, module)

    name_prefix = cc.configs["Org_Name"] + cc.configs[
        "ProjectAbrevation"] + context.properties["envName"] + module
    i_name_prefix = cc.configs["Org_Name"] + "-" + cc.configs[
        "ProjectAbrevation"] + "-" + context.properties["envName"] + module

    instance = {
        'zone':
        cc.configs['zone'],
        'machineType':
        ZonalComputeUrl(context.env['project'], cc.configs['zone'],
                        'machineTypes',
                        cc.configs['Instance']['InstanceType']),
        'disks': [{
            'deviceName': 'boot',
            'type': 'PERSISTENT',
            'autoDelete': True,
            'boot': True,
            'initializeParams': {
                'diskName':
                name_prefix.lower() + '-disk',
                'sourceImage':
                GlobalComputeUrl(cc.configs['Instance']['OSFamily'],
                                 'images/family',
                                 cc.configs['Instance']['OSVersion'])
            },
        }],
        'networkInterfaces': [{
            'accessConfigs': [{
                'name': 'external-nat',
                'type': 'ONE_TO_ONE_NAT'
            }],
            'network':
            GlobalComputeUrl(context.env['project'], 'networks', 'default')
        }]
    }

    # Resources to return.
    resources = {
        'resources': [{
            'name': i_name_prefix.lower() + '-i',
            'type': 'compute.v1.instance',
            'properties': instance
        }]
    }

    return resources
def GenerateConfig(context):
    """Main entry point for Deployment Manager logic"""

    module = "frontend"
    cc = config_merger.ConfigContext(context.properties, module)

    return {
        'resources': [
            #{
            #'name': 'simple_frontend',
            #'type': 'simple_frontend.py',
            #'properties': context.properties
            #}
        ],
        'outputs': [
            #{
            #    'name': 'env_name',
            #     'value': context.properties["envName"]
            #},{
            #    'name': 'context',
            #    'value': cc.configs['CONTEXT']
            #},{
            #    'name': 'HQ_Address',
            #    'value': cc.configs['HQ_Address']
            #},{
            #    'name': 'ServiceName',
            #    'value': cc.configs['ServiceName']
            #},{
            #    'name': 'versionNR',
            #    'value': cc.configs['versionNR']
            #},
            {
                'name':
                'outp_3',
                'value':
                json.dumps(
                    cc.configs,
                    sort_keys=True,
                    indent=4,
                    separators=(',', ': '))
            }
        ]
    }
def generate_config(context):

    # Using helper functions to load external configurations.
    # The deployment YAML only contains the minimal context of the deployment.
    # (Module name, environment)
    # This way the wrapper template injects information to the target template
    # without overloading the starting YAML.

    local_properties = config_merger.ConfigContext(
        context.properties['environment'], context.properties['module'])

    # Passing values forward to template

    return {
        'resources': [{
            'type': "target-template.py",
            'name': context.env['name'],
            'properties': local_properties
        }]
    }
def GenerateConfig(context):
    """Main entry point for Deployment Manager logic"""

    module = "project"
    cc = config_merger.ConfigContext(context.properties, module)

    return {
        'resources': [
            #   {
            #  'name': 'sample-named-h-project1',
            #   'type': 'project.py',
            #  'properties': cc.configs['project_module']
            #}
        ],
        'outputs': [{
            'name':
            'outp_3',
            'value':
            json.dumps(cc.configs,
                       sort_keys=True,
                       indent=4,
                       separators=(',', ': '))
        }]
    }