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


Python OSConf.initial_conf方法代码示例

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


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

示例1: test_method

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import initial_conf [as 别名]
    def test_method(self):
        ret_list = []
        for i in range(3):
            common.env_setup()
            step = testcase.TestCaseStep(
                    "Try %s: Create more apps than app_limit_per_user setting upon %s concurrent creation" %(i + 1, self.app_limit_per_user + 2),
                    self.concrrent_creation_step,
                    function_parameters=[1, self.app_limit_per_user + 2],
                    expect_description="No more apps beyond limit should be created")

            (ret_dict, output) = step.run()
            # print ret_dict
            if ret_dict.values().count(0) == self.app_limit_per_user:
                ret_list.append(0)
                # Init OSConf to clean these apps in next iterval
                OSConf.initial_conf()
            else:
                ret_list.append(1)
                # Init OSConf to clean these apps in next script
                OSConf.initial_conf()
                break


        #print ret_list
        if ret_list.count(1) > 0:
            print "Upon %s concurrent creation, more apps than app_limit_per_user is created - [FAIL]" %(self.app_limit_per_user + 2)
            return self.failed("%s failed" % self.__class__.__name__)
        else:
            return self.passed("%s passed" % self.__class__.__name__)
开发者ID:xiama,项目名称:automations,代码行数:31,代码来源:app_limit_per_user-concurrent_creation.py

示例2: clean_up

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import initial_conf [as 别名]
def clean_up(user_email=None, user_passwd=None):
    """Remove all applications and cleans up cache"""
    if user_email is None:
        (user_email, user_passwd) = get_default_rhlogin()
    try:
        app_dict = user_info(user_email, user_passwd)
        retcode = 0
        for app_name in app_dict.keys():
            ret = destroy_app2(app_name, user_email, user_passwd)
            if ret != 0:
                retcode = ret
                # Hot fix for Bug 958619
                # delete the app a second time
                # ret = destroy_app2(app_name, user_email, user_passwd)
                # if ret != 0:
                #    retcode = ret
    except:
        #this is the case, when cache file is missing
        pass

    try:
        rest = openshift.Openshift(host=get_instance_ip(), 
                                   user=user_email, 
                                   passwd=user_passwd)
        (status, l2) = rest.app_list()

        if (status == 'OK'):
            for app in l2:
                app_name = app['name']
                try:
                    (stat, resp) = rest.app_delete(app_name)
                except Exception as e:
                    log.error("Unable to destroy %s: %s"%(app_name, str(e)))
                try:
                    if os.path.exists(app_name):
                        shutil.rmtree(app_name)
                except:
                    pass
        else:
            log.warning("Unable to get the list of apps to clean up: status = %s"%status)
    except openshift.OpenShiftNullDomainException:
        pass
    except Exception as e:
        import traceback
        traceback.print_exc(file=sys.stderr)
        log.error("Problem when destroying applications: %s"%str(e))

    try:
        OSConf.initial_conf()
    except Exception as e:
        log.warn("Error during initialising cache: %s"% e)

    return retcode
开发者ID:xiama,项目名称:automations,代码行数:55,代码来源:misc.py

示例3: create_domain

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import initial_conf [as 别名]
def create_domain(domain_name, user_email=None, user_passwd=None, options=""):
    if user_email is None:
        (user_email, user_passwd) = get_default_rhlogin()
    print domain_name
    cmd = 'rhc domain create %s -l %s -p "%s" %s %s'% (domain_name,
                                                       user_email, 
                                                       user_passwd, 
                                                       options,
                                                       RHTEST_RHC_CLIENT_OPTIONS)
    ret = command_get_status(cmd)
    if ret == 0:
        OSConf.initial_conf()
    return ret
开发者ID:xiama,项目名称:automations,代码行数:15,代码来源:client.py

示例4: test_method

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import initial_conf [as 别名]
    def test_method(self):
        if self.config.options.run_mode == 'DEV' or self.config.options.run_mode == 'OnPremise':
            step = testcase.TestCaseStep("Set max gear to %d" % (self.app_limit_per_user),
                    common.set_max_gears,
                    function_parameters = [self.user_email, self.app_limit_per_user],
                    expect_return = 0,
                    expect_description = "Max gear should be set successfully")
            (ret, output) = step.run()
            if ret != 0:
                self.info(output)
                self.info("Failed to set max gears for user")

        ret_list = []
        for i in range(2):
            common.env_setup() #clean_up
            step = testcase.TestCaseStep(
                    "Try %s: Create more apps than app_limit_per_user "%(i + 1) +
                    "setting upon %s concurrent creation" %(self.app_limit_per_user + 2),
                    self.concrrent_creation_step,
                    function_parameters=[1, self.app_limit_per_user + 2],
                    expect_description="No more apps beyond limit should be created")

            (ret_dict, output) = step.run()
            # print ret_dict
            if ret_dict.values().count(0) == self.app_limit_per_user:
                ret_list.append(0)
                # Init OSConf to clean these apps in next iterval
                OSConf.initial_conf()
            else:
                ret_list.append(1)
                # Init OSConf to clean these apps in next script
                OSConf.initial_conf()
                break


        #print ret_list
        if ret_list.count(1) > 0:
            print "Upon %s concurrent creation, more apps than app_limit_per_user is created - [FAIL]" %(self.app_limit_per_user + 2)
            return self.failed("%s failed" % self.__class__.__name__)
        else:
            return self.passed("%s passed" % self.__class__.__name__)
开发者ID:xiama,项目名称:automations,代码行数:43,代码来源:app_limit_per_user_concurrent_creation.py


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