From e503fb47c260c76d9356e8c2a875a51314354be0 Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Wed, 1 Feb 2017 15:08:20 +0000 Subject: [PATCH] Allow setting pm_port when importing nodes from a .csv file This patch is adding support for setting a custom pm_port when importing the nodes from a .csv file, this is useful for things like VirtualBMC which shares the same IPMI address but different ports for controlling the nodes. Change-Id: I4bbeee7e10bf3b1c82f754d91cc85018a6015098 --- tripleoclient/tests/v1/baremetal/test_baremetal.py | 3 ++- tripleoclient/utils.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tripleoclient/tests/v1/baremetal/test_baremetal.py b/tripleoclient/tests/v1/baremetal/test_baremetal.py index e78cc60a1..12c0ea8be 100644 --- a/tripleoclient/tests/v1/baremetal/test_baremetal.py +++ b/tripleoclient/tests/v1/baremetal/test_baremetal.py @@ -293,7 +293,7 @@ class TestImportBaremetal(fakes.TestBaremetal): self.csv_file.write("""\ pxe_ssh,192.168.122.1,stack,"KEY1",00:0b:d0:69:7e:59 -pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58""") +pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58,6230""") self.nodes_list = [{ "pm_user": "stack", @@ -308,6 +308,7 @@ pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58""") "pm_addr": "192.168.122.2", "pm_password": "KEY2", "pm_type": "pxe_ssh", + "pm_port": "6230", "mac": [ "00:0b:d0:69:7e:58" ] diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py index 183222df7..f0c12a3a1 100644 --- a/tripleoclient/utils.py +++ b/tripleoclient/utils.py @@ -670,6 +670,12 @@ def _csv_to_nodes_dict(nodes_csv): row[4] ] } + + try: + node['pm_port'] = row[5] + except IndexError: + pass + data.append(node) return data