From 12e56e415bc26112324be2f9da706e462c51e4b5 Mon Sep 17 00:00:00 2001 From: Quentin Smith Date: Sun, 20 May 2018 19:39:22 -0400 Subject: [PATCH] Add button to trigger renumbering --- code/main.py | 6 ++++++ code/templates/info.mako | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/code/main.py b/code/main.py index 6f226a6..0f77cee 100755 --- a/code/main.py +++ b/code/main.py @@ -668,6 +668,11 @@ def infoDict(username, state, machine): display_fields = (display_fields[:disk_point] + disk_fields + display_fields[disk_point+1:]) + renumber = False + for n in machine.nics: + if n.other_action in ('renumber', 'renumber_dhcp'): + renumber = True + main_status['memory'] += ' MiB' for field, disp in display_fields: if field in ('uptime', 'cputime') and locals()[field] is not None: @@ -690,6 +695,7 @@ def infoDict(username, state, machine): defaults.disk = "%0.2f" % (machine.disks[0].size/1024.) d = dict(user=username, on=status is not None, + renumber=renumber, machine=machine, defaults=defaults, has_vnc=has_vnc, diff --git a/code/templates/info.mako b/code/templates/info.mako index 8ceb715..8b51cdf 100644 --- a/code/templates/info.mako +++ b/code/templates/info.mako @@ -47,6 +47,16 @@ Info on ${machine.name} % endif + % if renumber: +
+

This machine's IP address is slated for removal. Your machine's new IP address, netmask, and gateway are shown above. Please configure your machine for DHCP or update the machine's configuration and then press this button:

+ % if on: + ${command_button("Power cycle and renumber", "renumber") + % else: + ${command_button("Renumber", "renumber") + % endif +
+ % endif
% if on: ${command_button("Power off", "destroy")} -- 1.7.9.5