Simplify get_node_ips_by_role.py to be get_controller_ips.py

Given that it is now not used for compute node IPs.

Change-Id: I91824838ef1e128655f8509fdb2c1d2576c8c670
This commit is contained in:
Neil Jerram 2016-03-08 14:32:28 +00:00
parent 7bfd81a34d
commit abccf5c767
5 changed files with 10 additions and 20 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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)

View File

@ -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