• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python config.Options类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vsc.manage.config.Options的典型用法代码示例。如果您正苦于以下问题:Python Options类的具体用法?Python Options怎么用?Python Options使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: testNoDefaultRuncmdOption

 def testNoDefaultRuncmdOption(self):
     opts = Options()  # default options object
     opts.cluster = 'cubone'
     opts.quattor_nodes = True
     manager = Manager(opts)
     print "showcommands", manager.nodes.showCommands()
     self.assertFalse(bool(manager.nodes.showCommands()))
开发者ID:JensTimmerman,项目名称:vsc-manage,代码行数:7,代码来源:managertests.py


示例2: testdoitOutput

    def testdoitOutput(self):
        """Test the consistency of the output of manager.doit"""
        opts = Options()  # default options object
        opts.cluster = TEST_CLUSTER
        opts.quattor_nodes = True
        opts.ledon = True
        manager = Manager(opts)
        manager.nodes = CompositeNode(timeout=1)
        # create a fake node
        testnode = TestNode('node111', 'localhost', None)
        # overwrite it's testcommand to be sure it times out
        testnode.ledoncommand = Command('sleep 3', timeout=1)
        manager.nodes.add(testnode)

        # make sure this works for multiple nodes
        testnode2 = TestNode('node112', 'localhost', None)
        # overwrite it's testcommand to be sure it times out
        testnode2.ledoncommand = Command('sleep 3', timeout=1)
        manager.nodes.add(testnode2)
        # parse actions again so they get applied on the new node
        manager.parseActions()
        out = manager.doit()
        # make sure this output is of a format we can handle
        errors = []
        for i in out:
            if len(i) > 1 and len(i[1]) > 0:
                for j in i[1]:  # second element is an array of [outputs of commands,errors]
                    self.assertEquals(j[1][0], None)
                    if j[1][1]:
                        self.assertEquals(j[1][1], 'command timed out')
                        errors.append(i[0])

        # actuall node should be in output, not just the name, because this is also used for printstatussee
        self.assertTrue(testnode in errors)
        self.assertTrue(testnode2 in errors)
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:35,代码来源:managertests.py


示例3: testManagerCreatorNodesFromChassis

 def testManagerCreatorNodesFromChassis(self):
     """
     test the manager constructor with the chassis option
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.chassis = "61"
     Manager(opts)
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:8,代码来源:managertests.py


示例4: testManagerSetOffline

 def testManagerSetOffline(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.node = TEST_NODE
     opts.setoffline = True
     Manager(opts).doit()
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:9,代码来源:managertests.py


示例5: testManagerSetOfflineOption

 def testManagerSetOfflineOption(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.worker = True
     opts.setoffline = True
     Manager(opts)
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:9,代码来源:managertests.py


示例6: testManagerTestrun

 def testManagerTestrun(self):
     """
     test the setonline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.worker = True
     opts.testrun = True
     Manager(opts).doit()
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:9,代码来源:managertests.py


示例7: testAckService

 def testAckService(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.node = 'node2201-node2208'
     opts.ack_service = "Swapping"
     Manager(opts)
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:9,代码来源:managertests.py


示例8: testManagerPowercutOptions

 def testManagerPowercutOptions(self):
     """
     test the powercut option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.worker = True
     opts.powercut = True
     Manager(opts)
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:9,代码来源:managertests.py


示例9: testAckService

 def testAckService(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = 'cubone'
     opts.node = 'node610-617'
     opts.ack_service = "Swapping"
     Manager(opts)
开发者ID:JensTimmerman,项目名称:vsc-manage,代码行数:9,代码来源:managertests.py


示例10: testManagerSetOffline

 def testManagerSetOffline(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = 'cubone'
     opts.node = 'node610'
     opts.setoffline = True
     Manager(opts).doit()
开发者ID:JensTimmerman,项目名称:vsc-manage,代码行数:9,代码来源:managertests.py


示例11: testAck

 def testAck(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = 'cubone'
     opts.node = 'node610-617'
     opts.setoffline = True
     opts.ack = True
     Manager(opts)
开发者ID:JensTimmerman,项目名称:vsc-manage,代码行数:10,代码来源:managertests.py


示例12: testAck

 def testAck(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.node = 'node2201-node2208'
     opts.setoffline = True
     opts.ack = True
     Manager(opts)
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:10,代码来源:managertests.py


示例13: testManagerSetOnline

 def testManagerSetOnline(self):
     """
     test the setonline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = 'cubone'
     opts.node = 'node610'
     opts.setonline = True
     #TODO: fails, since no worker nodes can be found
     Manager(opts).doit()
开发者ID:pombredanne,项目名称:vsc-manage,代码行数:10,代码来源:managertests.py


示例14: testManagerCreatorNodesFromID

    def testManagerCreatorNodesFromID(self):
        """
        test the manager constructor with a nodename option
        """
        opts = Options()
        opts.cluster = 'cubone'
        opts.node = 'nosuchnodeid3234#%'
        opts.setonline = True

        try:
            Manager(opts)
            self.fail("manager didn't fail with unknown node selected")
        except NodeException:
            pass
        else:
            self.fail("manager didn't fail with a NodeException when an unknown node was selected")
        opts.node = '32x,node120'
        try:
            Manager(opts)
            self.fail("manager didn't fail with unknown node selected")
        except NodeException:
            pass
        else:
            self.fail("manager didn't fail with a NodeException when an unknown node was selected")

        opts.node = 'node323,node120Xde#'
        try:
            Manager(opts)
            self.fail("manager didn't fail with unknown node selected")
        except NodeException:
            pass
        else:
            self.fail("manager didn't fail with a NodeException when an unknown node was selected")
        opts.node = 'node323,node120'
        try:
            Manager(opts)
            self.fail("manager didn't fail with unknown node selected")
        except NodeException:
            pass
        else:
            self.fail("manager didn't fail with a NodeException when an unknown node was selected")
        opts.node = 'node613,610,magikarp'
        Manager(opts)
        opts.node = 'node613-node615'
        Manager(opts)
        opts.node = 'node610,node613-node615,magikarp'
        Manager(opts)
开发者ID:JensTimmerman,项目名称:vsc-manage,代码行数:47,代码来源:managertests.py


示例15: testDowntime

 def testDowntime(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.node = 'node2201-node2208'
     opts.setoffline = True
     opts.downtime = "2 m"
     Manager(opts)  # should fail
     opts.downtime = "2h"
     Manager(opts)
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:12,代码来源:managertests.py


示例16: testDowntime

 def testDowntime(self):
     """
     test the setoffline option parameter
     """
     opts = Options()  # default options object
     opts.cluster = 'cubone'
     opts.node = 'node610-617'
     opts.setoffline = True
     opts.downtime = "2 m"
     Manager(opts)  # should fail
     opts.downtime = "2h"
     Manager(opts)
开发者ID:JensTimmerman,项目名称:vsc-manage,代码行数:12,代码来源:managertests.py


示例17: testManagerLEDs

 def testManagerLEDs(self):
     """
     test the Ledon, ledoff and ledstatus option parameter
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.node = TEST_NODE
     opts.ledon = True
     Manager(opts).doit()
     # TODO: get led status and test if it's on
     opts.ledon = False
     opts.ledoff = True
     Manager(opts).doit()
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:13,代码来源:managertests.py


示例18: testManagerhasSpecials

    def testManagerhasSpecials(self):
        """
        test on inclusion of special nodes
        """
        opts = Options()
        opts.cluster = TEST_CLUSTER

        manager = Manager(opts)
        self.assertFalse(manager.hasSpecials())
        opts.worker = True
        manager = Manager(opts)
        self.assertFalse(manager.hasSpecials())
        opts.all_nodes = True
        manager = Manager(opts)
        self.assertTrue(manager.hasSpecials())  # should have special nodes with force (the master)

        opts = Options()
        opts.cluster = TEST_CLUSTER
        opts.master = "master1"
        self.assertTrue(Manager(opts).hasSpecials())  # should create a manager
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:20,代码来源:managertests.py


示例19: testSchedulerOptions

 def testSchedulerOptions(self):
     """
     test the cheduler options
     """
     opts = Options()  # default options object
     opts.cluster = TEST_CLUSTER
     opts.pause = True
     Manager(opts)
     opts.resume = True
     Manager(opts)
     opts.pause = False
     opts.resume = True
     Manager(opts)
     Manager(opts).doit()
     opts.restart = True
     try:
         if Manager(opts).doit():
             self.fail("Scheduler restart ran without the --force option")
     except Exception, ex:
         self.fail("Scheduler restart failed with ex %s" % ex)
         print traceback.format_exc()
开发者ID:wpoely86,项目名称:vsc-manage,代码行数:21,代码来源:managertests.py


示例20: testManagerhasSpecials

    def testManagerhasSpecials(self):
        """
        test on inclusion of special nodes
        """
        opts = Options()
        opts.cluster = 'cubone'

        manager = Manager(opts)
        self.assertFalse(manager.hasSpecials())
        opts.worker = True
        #self.assertRaises(Exception, Manager, opts)
        manager = Manager(opts)
        self.assertFalse(manager.hasSpecials())
        opts.all_nodes = True
        manager = Manager(opts)
        self.assertTrue(manager.hasSpecials())  # should have special nodes with force (the master)

        opts = Options()
        opts.cluster = 'cubone'
        opts.master = "master7"
        self.assertTrue(Manager(opts).hasSpecials())  # should create a manager
开发者ID:JensTimmerman,项目名称:vsc-manage,代码行数:21,代码来源:managertests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cache.FileCache类代码示例发布时间:2022-05-26
下一篇:
Python config.get_config函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap