Пример #1
0
def get_servers_addrs():
    # Get server addresses through Blockade
    parser = block.setup_parser()
    opts = parser.parse_args(args=["status"])
    config = block.load_config(opts)
    b = block.get_blockade(config)
    containers = b.status()
    
    global servers
    for c in containers:
        servers.append((c.ip_address, 5000))
Пример #2
0
def get_servers_addrs():
    # Get server addresses through Blockade
    parser = block.setup_parser()
    opts = parser.parse_args(args=["status"])
    config = block.load_config(opts)
    b = block.get_blockade(config)
    containers = b.status()

    global servers
    for c in containers:
        servers.append((c.ip_address, 5000))
Пример #3
0
def get_servers_addrs():
    # Get server addresses through Blockade
    parser = block.setup_parser()
    opts = parser.parse_args(args=["status"])
    config = block.load_config(opts)
    b = block.get_blockade(config)
    containers = b.status()

    global servers
    global num_servers
    for c in containers:
        servers += c.ip_address
        servers += ":2181,"
        num_servers += 1
    servers.strip(",")
Пример #4
0
 def test_noconfig(self):
     """load default config when no file is present"""
     config = cli.load_config()
     self.assertEqual(0, len(config.containers))
Пример #5
0
 def test_custom_notfound(self):
     """load config from nonexistent custom path"""
     with self.assertRaisesRegexp(BlockadeError, "^Failed to load config"):
         cli.load_config("./custom-file.yaml")
Пример #6
0
 def test_custom(self):
     """load config from custom path"""
     self._writeConfig("custom-file.yaml")
     config = cli.load_config("./custom-file.yaml")
     self.assertIn("zzz", config.containers)
Пример #7
0
 def test_yaml(self):
     """load config from blockade.yaml"""
     self._writeConfig("blockade.yaml")
     config = cli.load_config()
     self.assertIn("zzz", config.containers)
Пример #8
0
 def test_noconfig(self):
     """load default config when no file is present"""
     config = cli.load_config()
     self.assertEqual(0, len(config.containers))
Пример #9
0
 def test_custom_notfound(self):
     """load config from nonexistent custom path"""
     with self.assertRaisesRegexp(BlockadeError, "^Failed to load config"):
         cli.load_config("./custom-file.yaml")
Пример #10
0
 def test_custom(self):
     """load config from custom path"""
     self._writeConfig("custom-file.yaml")
     config = cli.load_config("./custom-file.yaml")
     self.assertIn("zzz", config.containers)
Пример #11
0
 def test_yaml(self):
     """load config from blockade.yaml"""
     self._writeConfig("blockade.yaml")
     config = cli.load_config()
     self.assertIn("zzz", config.containers)