diff options
author | narindergupta <narinder.gupta@canonical.com> | 2017-04-26 15:58:50 +0200 |
---|---|---|
committer | narindergupta <narinder.gupta@canonical.com> | 2017-04-26 16:12:22 +0200 |
commit | 27657e6aa94666955b8db4688f17211fb16da56f (patch) | |
tree | 36e50593722214888b4d540a05e5f233f4c28070 /ci/03-maasdeploy.sh | |
parent | 58de7a6e82d702ece924a772461a52c789f1e722 (diff) |
modify the maas to use the interface name as per yaml file
Change-Id: I6a060757a39786c073c2567ca73502267d8c271b
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
Diffstat (limited to 'ci/03-maasdeploy.sh')
-rwxr-xr-x | ci/03-maasdeploy.sh | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 04066c9b..d439951d 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -559,7 +559,7 @@ if [ -e ./labconfig.json ]; then echo ">>> Configuring node $NODE_NAME [$NODE_ID][$NODE_SYS_ID]" # Recover the network interfaces list and configure each one # with sorting the list, we have hardware interface first, than the vlan interfaces - IF_LIST=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] ".ifname | sort -u) + IF_LIST=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] ".ifname ) for IF_NAME in $IF_LIST; do # get the space of the interface IF_SPACE=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] | select(.ifname==\"$IF_NAME\") ".spaces[]) @@ -579,7 +579,16 @@ if [ -e ./labconfig.json ]; then IF_VLAN = ${IF_NAME##*.}; fi # in case of interface renaming - IF_NEWNAME=$(cat labconfig.json | jq --raw-output ".lab.racks[0].nodes[$NODE_ID].nics[] | select(.ifname==\"$IF_NAME\") ".rename) + IF_NEWNAME=$IF_NAME + + if ([ $IF_NEWNAME ] && [ "$IF_NEWNAME" != "null" ]); then + # rename interface if needed + IF_MACLOWER=$( cat labconfig.json | jq ".lab.racks[0].nodes[$NODE_ID].nics[] | select(.ifname==\"$IF_NEWNAME\")".mac[0]) + IF_MAC=(${IF_MACLOWER,,}) + IF_ID=$( maas ubuntu interfaces read $NODE_SYS_ID | jq ".[] | select(.mac_address==$IF_MAC)".id) + maas $PROFILE interface update $NODE_SYS_ID $IF_ID name=$IF_NEWNAME + IF_NAME=$IF_NEWNAME + fi # In case of a VLAN interface if ([ $IF_VLAN ] && [ "$IF_VLAN" != "null" ]); then @@ -603,10 +612,6 @@ if [ -e ./labconfig.json ]; then INTERFACE=$(maas $PROFILE interfaces read $NODE_SYS_ID | jq ".[] | select(.vlan.fabric_id==$FABRICID)".id) fi maas $PROFILE interfaces create-vlan $NODE_SYS_ID vlan=$VLANID parent=$INTERFACE || true - elif ([ $IF_NEWNAME ] && [ "$IF_NEWNAME" != "null" ]); then - # rename interface if needed - maas $PROFILE interface update $NODE_SYS_ID $IF_NAME name=$IF_NEWNAME - IF_NAME=$IF_NEWNAME fi # Configure the interface if ([ $SUBNET_CIDR ] && [ "$SUBNET_CIDR" != "null" ]); then |