Skip to content

Commit

Permalink
Sort context dictionary items
Browse files Browse the repository at this point in the history
Helps to find the item being looked for. Editor based search does not
work as well because we get lots of hits before this dict so its easier
to find the dict then find with my eyes.
  • Loading branch information
mmlb committed Mar 5, 2024
1 parent 641d439 commit dc0d8d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packetnetworking/distros/distro_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ def build_tasks(self):
def context(self):
return {
"hostname": self.metadata.hostname,
"interfaces": self.network.interfaces,
"iface0": self.network.interfaces[0],
"interfaces": self.network.interfaces,
"ip4priv": self.ipv4priv.first,
"ip4pub": self.ipv4pub.first,
"ip6pub": self.ipv6pub.first,
"net": self.network,
"osinfo": self.metadata.operating_system,
"resolvers": self.network.resolvers,
"private_subnets": self.network.private_subnets,
"resolvers": self.network.resolvers,
}

@property
Expand Down
2 changes: 1 addition & 1 deletion packetnetworking/distros/test_distro_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def test_distro_builder_context_as_expected(fake_distro_builder_with_metadata):
context = fake_distro.context()
wanted_context = {
"hostname": fake_distro.metadata.hostname,
"interfaces": fake_distro.network.interfaces,
"iface0": fake_distro.network.interfaces[0],
"interfaces": fake_distro.network.interfaces,
"ip4priv": fake_distro.ipv4priv.first,
"ip4pub": fake_distro.ipv4pub.first,
"ip6pub": fake_distro.ipv6pub.first,
Expand Down

0 comments on commit dc0d8d3

Please sign in to comment.