Пример #1
0
    def ask_rds_creation(cls, parameter_pool):

        stack = parameter_pool.get_value(PName.SolutionStack, False)
        snippet_url = parameter_pool.get_value(PName.RdsSnippetUrl, False)
        if not rds_utils.is_rds_snippet_compatible(parameter_pool, stack,
                                                   snippet_url):
            parameter_pool.put(
                Parameter(PName.RdsEnabled, False, PSource.Terminal), True)

            return  # solution stack not compatible with snippet

        if parameter_pool.has(PName.RdsEnabled):
            ori_rds_creation = parameter_pool.get_value(
                PName.RdsEnabled, False)
            msg = AskMsg[PName.RdsEnabled].format(TerminalMessage.CurrentValue.\
                                                  format(misc.bool_to_yesno(ori_rds_creation)))
            raw_answer = cls.line_input(msg, True)
            if raw_answer is None:
                rds_creation = ori_rds_creation
            else:
                rds_creation = misc.string_to_boolean(raw_answer)
        else:
            raw_answer = cls.line_input(AskMsg[PName.RdsEnabled].format(''))
            rds_creation = misc.string_to_boolean(raw_answer)

        parameter_pool.put(
            Parameter(PName.RdsEnabled, rds_creation, PSource.Terminal), True)

        if rds_creation:
            cls.ask_snapshot_name(parameter_pool)
            cls.ask_master_password(parameter_pool)
            cls.ask_delete_to_snapshot(parameter_pool)
Пример #2
0
    def ask_rds_creation(cls, parameter_pool):
        
        stack = parameter_pool.get_value(PName.SolutionStack)
        snippet_url = parameter_pool.get_value(PName.RdsSnippetUrl)
        if not rds_utils.is_rds_snippet_compatible(parameter_pool, stack, snippet_url):
            parameter_pool.put(Parameter(PName.RdsEnabled, 
                                         False, 
                                         PSource.Terminal), 
                               True)        
            
            return  # solution stack not compatible with snippet
        
        if parameter_pool.has(PName.RdsEnabled):
            ori_rds_creation = parameter_pool.get_value(PName.RdsEnabled)
            msg = AskMsg[PName.RdsEnabled].format(TerminalMessage.CurrentValue.\
                                                  format(misc.bool_to_yesno(ori_rds_creation)))
            raw_answer = cls.line_input(msg, True)
            if raw_answer is None:
                rds_creation = ori_rds_creation
            else:
                rds_creation = misc.string_to_boolean(raw_answer)
        else:
            raw_answer = cls.line_input(AskMsg[PName.RdsEnabled].format(''))
            rds_creation = misc.string_to_boolean(raw_answer)

        parameter_pool.put(Parameter(PName.RdsEnabled, rds_creation, PSource.Terminal), 
                           True)        
        
        if rds_creation:
            cls.ask_snapshot_name(parameter_pool)
            cls.ask_master_password(parameter_pool)
            cls.ask_delete_to_snapshot(parameter_pool)
Пример #3
0
    def ask_delete_to_snapshot(cls, parameter_pool):
        if parameter_pool.has(PName.RdsDeletionPolicy):
            original_value = parameter_pool.get_value(PName.RdsDeletionPolicy)
            display_value = RdsDefault.del_policy_to_bool(original_value)
            display_value = misc.bool_to_yesno(display_value)
        else:
            display_value = None
                    
        value = cls.ask_parameter(parameter_pool, PName.RdsDeletionPolicy, display_value)

        if value is None:
            return
        elif not isinstance(value, bool):
            value = RdsDefault.bool_to_del_policy(misc.string_to_boolean(value))
            
        parameter_pool.put(Parameter(PName.RdsDeletionPolicy, 
                                     value, 
                                     PSource.Terminal), 
                           True)        
Пример #4
0
    def ask_delete_to_snapshot(cls, parameter_pool):
        if parameter_pool.has(PName.RdsDeletionPolicy):
            original_value = parameter_pool.get_value(PName.RdsDeletionPolicy, False)
            display_value = RdsDefault.del_policy_to_bool(original_value)
            display_value = misc.bool_to_yesno(display_value)
        else:
            display_value = None
                    
        value = cls.ask_parameter(parameter_pool, PName.RdsDeletionPolicy, display_value)

        if value is None:
            return
        elif not isinstance(value, bool):
            value = RdsDefault.bool_to_del_policy(misc.string_to_boolean(value))
            
        parameter_pool.put(Parameter(PName.RdsDeletionPolicy, 
                                     value, 
                                     PSource.Terminal), 
                           True)