def execute(self, parameter_pool):
        eb_client = self._get_eb_client(parameter_pool)
        app_name = parameter_pool.get_value(ParameterName.ApplicationName, False)
        env_name = parameter_pool.get_value(ParameterName.EnvironmentName, False)

        response = eb_client.describe_environments(app_name, env_name, include_deleted=False)
        if len(response.result) > 0:
            shell_utils.git_aws_push(False)
        else:
            prompt.error(PushApplicationVersionOpMessage.EnvNotExist.format(env_name))

        ret_result = OperationResult(self, None, None, None)

        return ret_result
Example #2
0
def check_app_version(parameter_pool, eb_client = None):
    #TODO: Do we need to blast version info away if this part is strong enough?
    if not parameter_pool.has(PName.ApplicationVersionName) \
        or parameter_pool.get_source(PName.ApplicationVersionName) == PSource.Default:

        version_name = get_head_version(parameter_pool, eb_client=eb_client, quiet=True)        
        
        if version_name is not None:
            log.info(u'Found a version from local repository: {0}. Using this version.'.\
                     format(version_name))
            return version_name
        else:
            # Otherwise try push a new one
            if not parameter_pool.get_value(PName.Force) == ServiceDefault.ENABLED\
                and not TerminalBase.ask_confirmation(DevToolsMessage.PushLocalHead):
                return ServiceDefault.DEFAULT_VERSION_NAME
            else:
                if shell_utils.git_aws_push(False):
                    version_name = get_head_version(parameter_pool, 
                                                    eb_client=eb_client, 
                                                    quiet=False)
                    if version_name:
                        return version_name   
                return ServiceDefault.DEFAULT_VERSION_NAME
    else:
        # Verify existence of version
        app_name = parameter_pool.get_value(PName.ApplicationName, False)
        version_names = api_wrapper.get_all_versions(parameter_pool, app_name, eb_client)
        version_name = parameter_pool.get_value(PName.ApplicationVersionName)    
        if version_name in version_names:
            # Assume version is still valid and compatible with current solution stack
            return version_name
        else:
            # 
            return ServiceDefault.DEFAULT_VERSION_NAME
Example #3
0
def check_app_version(parameter_pool, eb_client = None):
    #TODO: Do we need to blast version info away if this part is strong enough?
    if not parameter_pool.has(PName.ApplicationVersionName) \
        or parameter_pool.get_source(PName.ApplicationVersionName) == PSource.Default:

        version_name = get_head_version(parameter_pool, eb_client=eb_client, quiet=True)        
        
        if version_name is not None:
            log.info(u'Found a version from local repository: {0}. Using this version.'.\
                     format(version_name))
            return version_name
        else:
            # Otherwise try push a new one
            if not parameter_pool.get_value(PName.Force) == ServiceDefault.ENABLED\
                and not TerminalBase.ask_confirmation(DevToolsMessage.PushLocalHead):
                return ServiceDefault.DEFAULT_VERSION_NAME
            else:
                if shell_utils.git_aws_push(push_only=True, quiet=False):
                    version_name = get_head_version(parameter_pool, 
                                                    eb_client=eb_client, 
                                                    quiet=False)
                    if version_name:
                        return version_name   
                return ServiceDefault.DEFAULT_VERSION_NAME
    else:
        # Verify existence of version
        app_name = parameter_pool.get_value(PName.ApplicationName, False)
        version_names = api_wrapper.get_all_versions(parameter_pool, app_name, eb_client)
        version_name = parameter_pool.get_value(PName.ApplicationVersionName)    
        if version_name in version_names:
            # Assume version is still valid and compatible with current solution stack
            return version_name
        else:
            # 
            return ServiceDefault.DEFAULT_VERSION_NAME
Example #4
0
    def execute(self, parameter_pool):
        eb_client = self._get_eb_client(parameter_pool)
        app_name = parameter_pool.get_value(ParameterName.ApplicationName,
                                            False)
        env_name = parameter_pool.get_value(ParameterName.EnvironmentName,
                                            False)

        response = eb_client.describe_environments(app_name,
                                                   env_name,
                                                   include_deleted=False)
        if len(response.result) > 0:
            shell_utils.git_aws_push(False)
        else:
            prompt.error(
                PushApplicationVersionOpMessage.EnvNotExist.format(env_name))

        ret_result = OperationResult(self, None, None, None)

        return ret_result