Skip to content

Commit

Permalink
[pdu controller] Allow to define pdu_host info in conngraph (#3639)
Browse files Browse the repository at this point in the history
Don't return fail until checking the pdu_host in both inventory and conngraph.

Signed-off-by: Shengkai Wang <[email protected]>

Co-authored-by: Shengkai Wang <[email protected]>
  • Loading branch information
kevinskwang and kevinskwang authored Jun 8, 2021
1 parent 8a32db8 commit 4309468
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/common/plugins/pdu_controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ def pdu_controller(duthosts, enum_rand_one_per_hwsku_hostname, conn_graph_facts,
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
inv_mgr = duthost.host.options["inventory_manager"]
pdu_host_list = inv_mgr.get_host(duthost.hostname).get_vars().get("pdu_host")
if not pdu_host_list:
logging.info("No 'pdu_host' is defined in inventory file for '%s'. Unable to create pdu_controller" %
duthost.hostname)
yield None
return
pdu_hosts = {}
for ph in pdu_host_list.split(','):
var_list = inv_mgr.get_host(ph).get_vars()
pdu_hosts[ph] = var_list
if pdu_host_list:
for ph in pdu_host_list.split(','):
var_list = inv_mgr.get_host(ph).get_vars()
pdu_hosts[ph] = var_list
else:
logging.debug("No 'pdu_host' is defined in inventory file for '%s'." %
duthost.hostname)

controller = pdu_manager_factory(duthost.hostname, pdu_hosts, conn_graph_facts, pdu)

Expand Down

0 comments on commit 4309468

Please sign in to comment.