Merge "Simplify get_node_ips_by_role.py to be get_controller_ips.py" into 7.0
This commit is contained in:
commit
7d31c21f27
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2015 Metaswitch Networks
|
||||
# Copyright 2015-2016 Metaswitch Networks
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
|
@ -10,7 +10,7 @@ set -x
|
|||
echo "Hi, I'm a compute node!"
|
||||
|
||||
this_node_address=$(python get_node_ip.py `hostname`)
|
||||
controller_node_addresses=$(python get_node_ips_by_role.py controller)
|
||||
controller_node_addresses=$(python get_controller_ips.py)
|
||||
|
||||
# Get APT key for binaries.projectcalico.org.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2015 Metaswitch Networks
|
||||
# Copyright 2015-2016 Metaswitch Networks
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
|
@ -10,7 +10,7 @@ set -x
|
|||
echo "Hi, I'm a controller node!"
|
||||
|
||||
this_node_address=$(python get_node_ip.py `hostname`)
|
||||
controller_node_addresses=$(python get_node_ips_by_role.py controller)
|
||||
controller_node_addresses=$(python get_controller_ips.py)
|
||||
|
||||
# Get APT key for binaries.projectcalico.org.
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ echo "Hi, I'm a route_reflector node!"
|
|||
|
||||
# Calculate IP addresses of route reflector peers.
|
||||
this_node_address=$(python get_node_ip.py `hostname`)
|
||||
controller_node_addresses=$(python get_node_ips_by_role.py controller)
|
||||
controller_node_addresses=$(python get_controller_ips.py)
|
||||
route_reflector_peers=("${controller_node_addresses[@]/$this_node_address}")
|
||||
|
||||
# Get compute host names from etcd.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright 2015 Metaswitch Networks
|
||||
# Copyright 2015-2016 Metaswitch Networks
|
||||
|
||||
import argparse
|
||||
import yaml
|
||||
|
||||
from pluginutils import NODES_CONFIG
|
||||
|
@ -11,22 +10,13 @@ def main(node_roles):
|
|||
with open(NODES_CONFIG, "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
node_ips = [node["internal_address"] for node in config["nodes"]
|
||||
node_ips = [node["internal_address"] for node in config["nodes"]
|
||||
if node["role"] in node_roles]
|
||||
|
||||
return node_ips
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("node_role", choices=["compute", "controller"])
|
||||
args = parser.parse_args()
|
||||
|
||||
args.node_role = [args.node_role]
|
||||
if args.node_role == ["controller"]:
|
||||
args.node_role.append("primary-controller")
|
||||
|
||||
node_ips = main(args.node_role)
|
||||
node_ips = main(["controller", "primary-controller"])
|
||||
if node_ips:
|
||||
print " ".join(node_ips)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2015 Metaswitch Networks
|
||||
# Copyright 2015-2016 Metaswitch Networks
|
||||
|
||||
this_node_address=$(python get_node_ip.py `hostname`)
|
||||
controller_node_addresses=$(python get_node_ips_by_role.py controller)
|
||||
controller_node_addresses=$(python get_controller_ips.py)
|
||||
|
||||
for node_address in ${controller_node_addresses[@]}
|
||||
do
|
||||
|
|
Loading…
Reference in New Issue