test-driver.py: always export single machine as 'machine'
This commit is contained in:
parent
a8f693ed48
commit
9e71014ede
|
@ -1184,6 +1184,10 @@ class Driver:
|
||||||
Machine=Machine, # for typing
|
Machine=Machine, # for typing
|
||||||
)
|
)
|
||||||
machine_symbols = {m.name: m for m in self.machines}
|
machine_symbols = {m.name: m for m in self.machines}
|
||||||
|
# If there's exactly one machine, make it available under the name
|
||||||
|
# "machine", even if it's not called that.
|
||||||
|
if len(self.machines) == 1:
|
||||||
|
(machine_symbols["machine"],) = self.machines
|
||||||
vlan_symbols = {
|
vlan_symbols = {
|
||||||
f"vlan{v.nr}": self.vlans[idx] for idx, v in enumerate(self.vlans)
|
f"vlan{v.nr}": self.vlans[idx] for idx, v in enumerate(self.vlans)
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,9 @@ rec {
|
||||||
vlans = map (m: m.config.virtualisation.vlans) (lib.attrValues nodes);
|
vlans = map (m: m.config.virtualisation.vlans) (lib.attrValues nodes);
|
||||||
vms = map (m: m.config.system.build.vm) (lib.attrValues nodes);
|
vms = map (m: m.config.system.build.vm) (lib.attrValues nodes);
|
||||||
|
|
||||||
nodeHostNames = map (c: c.config.system.name) (lib.attrValues nodes);
|
nodeHostNames = let
|
||||||
|
nodesList = map (c: c.config.system.name) (lib.attrValues nodes);
|
||||||
|
in nodesList ++ lib.optional (lib.length nodesList == 1) "machine";
|
||||||
|
|
||||||
# TODO: This is an implementation error and needs fixing
|
# TODO: This is an implementation error and needs fixing
|
||||||
# the testing famework cannot legitimately restrict hostnames further
|
# the testing famework cannot legitimately restrict hostnames further
|
||||||
|
|
Loading…
Reference in a new issue