def execute_deployment_test(
        self,
        args: dict,
        configuration_path: str,
        environment_type: str) -> bool:
        
        from orchestration.common.factory import ObjectFactory
        from orchestration.common.parameter_initializer import ParameterInitializer

        factory = ObjectFactory(is_live_mode=self.is_live)

        parameter_initializer = \
                factory.get_parameter_initializer()
        parameter_initializer.initialize(
            args, 
            configuration_path,
            is_live_mode=self.is_live)
        
        from orchestration.resource_deployment import ResourceDeployment
        resourceDeployment = ResourceDeployment(
            parameter_initializer._data_store, 
            parameter_initializer._resource_management_integration_service,
            parameter_initializer._policy_integration_service,  
            parameter_initializer._aad_cli_integration_service,
            parameter_initializer._keyvault_cli_integration_service,
            parameter_initializer._module_version_retrieval,
            parameter_initializer._vdc_storage_account_name,
            parameter_initializer._vdc_storage_account_subscription_id,
            parameter_initializer._vdc_storage_account_resource_group,
            parameter_initializer._validate_deployment,
            parameter_initializer._deploy_all_modules,
            parameter_initializer._deployment_configuration_path,
            parameter_initializer._module_deployment_order,
            parameter_initializer._resource_group,
            parameter_initializer._single_module,
            parameter_initializer._deploy_module_dependencies,
            parameter_initializer._upload_scripts,
            parameter_initializer._create_vdc_storage,
            parameter_initializer._shared_services_deployment_name,
            parameter_initializer._deployment_name,
            parameter_initializer._location,
            parameter_initializer._tenant_id,
            parameter_initializer._subscription_id,
            parameter_initializer._shared_services_subscription_id,
            parameter_initializer._service_principals,
            parameter_initializer._organization_name,
            parameter_initializer._encryption_keys_for,
            parameter_initializer._module_dependencies,
            parameter_initializer._environment_type,
            parameter_initializer._json_parameters,
            parameter_initializer._import_module,
            parameter_initializer._custom_scripts_path,
            parameter_initializer._environment_keys,
            from_integration_test=True)
        
        # Invoke deployment
        successful: list = resourceDeployment.create()

        return len(successful) > 0
Esempio n. 2
0
def create_deployment(parsed_args):
    
    # Gather the provided argument within an array.
    args = vars(parsed_args)
    
    # Capture the parameters provided for debugging.
    _logger.debug('The parameters extracted were: {}'.format(args))
    
    configuration_path = args['configuration-path']
    
    # Setting deployment-type -> shared-services | workload | on-premises
    environment = args['environment-type']
    
    _logger.info('Provisioning the following environment: {}'.format(environment))
    _logger.info('Deployment path is: {}'.format(configuration_path))
    
    #-----------------------------------------------------------------------------
    # Call the function indicated by the invocation command.
    #-----------------------------------------------------------------------------
    try:
        all_configuration_paths = list()

        all_configuration_paths = \
            configuration_path.split(',')

        _logger\
            .info('Configuration path(s): {}'\
                .format(all_configuration_paths))
        
        is_live_mode = True

        from orchestration.common.factory import ObjectFactory
        from orchestration.common.parameter_initializer import ParameterInitializer

        factory = ObjectFactory(is_live_mode=is_live_mode)

        for path in all_configuration_paths:
            
            parameter_initializer = \
                factory.get_parameter_initializer()
            parameter_initializer.initialize(
                args, 
                path,
                is_live_mode=is_live_mode)
            
            from orchestration.resource_deployment import ResourceDeployment
            resourceDeployment = ResourceDeployment(
                parameter_initializer._data_store, 
                parameter_initializer._resource_management_integration_service,
                parameter_initializer._policy_integration_service,  
                parameter_initializer._aad_cli_integration_service,
                parameter_initializer._keyvault_cli_integration_service,
                parameter_initializer._module_version_retrieval,
                parameter_initializer._vdc_storage_account_name,
                parameter_initializer._vdc_storage_account_subscription_id,
                parameter_initializer._vdc_storage_account_resource_group,
                parameter_initializer._validate_deployment,
                parameter_initializer._deploy_all_modules,
                parameter_initializer._deployment_configuration_path,
                parameter_initializer._module_deployment_order,
                parameter_initializer._resource_group,
                parameter_initializer._single_module,
                parameter_initializer._deploy_module_dependencies,
                parameter_initializer._upload_scripts,
                parameter_initializer._create_vdc_storage,
                parameter_initializer._shared_services_deployment_name,
                parameter_initializer._deployment_name,
                parameter_initializer._location,
                parameter_initializer._tenant_id,
                parameter_initializer._subscription_id,
                parameter_initializer._shared_services_subscription_id,
                parameter_initializer._service_principals,
                parameter_initializer._organization_name,
                parameter_initializer._encryption_keys_for,
                parameter_initializer._module_dependencies,
                parameter_initializer._environment_type,
                parameter_initializer._json_parameters,
                parameter_initializer._import_module,
                parameter_initializer._custom_scripts_path,
                parameter_initializer._environment_keys)

            # Invoke deployment
            resourceDeployment.create()    
    except Exception as ex:
        _logger.error('There was an unhandled error while provisioning the resources.')
        _logger.error(ex)
        exit()