Add button to trigger renumbering
authorQuentin Smith <quentin@mit.edu>
Sun, 20 May 2018 23:39:22 +0000 (19:39 -0400)
committerQuentin Smith <quentin@mit.edu>
Sun, 27 May 2018 06:45:31 +0000 (02:45 -0400)
code/main.py
code/templates/info.mako

index 6f226a6..0f77cee 100755 (executable)
@@ -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,
index 8ceb715..8b51cdf 100644 (file)
@@ -47,6 +47,16 @@ Info on ${machine.name}
 % endif
 </form>
 </%def>
+  % if renumber:
+  <div>
+  <p>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:</p>
+    % if on:
+    ${command_button("Power cycle and renumber", "renumber")
+    % else:
+    ${command_button("Renumber", "renumber")
+    % endif
+  </div>
+  % endif
   <div>
        % if on:
        ${command_button("Power off", "destroy")}