← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/bug-1046674 into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-1046674 into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)
Related bugs:
  Bug #1046674 in MAAS: "Omshell.create uses unquoted IP address for host name"
  https://bugs.launchpad.net/maas/+bug/1046674

For more details, see:
https://code.launchpad.net/~jtv/maas/bug-1046674/+merge/123018

Pre-imped with Julian.  Debugging omshell is a shared pain.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/bug-1046674/+merge/123018
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/maas/bug-1046674 into lp:maas.
=== modified file 'src/provisioningserver/omshell.py'
--- src/provisioningserver/omshell.py	2012-08-22 20:37:49 +0000
+++ src/provisioningserver/omshell.py	2012-09-06 07:00:25 +0000
@@ -111,6 +111,8 @@
         return proc.returncode, stdout
 
     def create(self, ip_address, mac_address):
+        # The "name" is not a host name; it's an identifier used within
+        # the DHCP server.  We just happen to use the IP address.
         stdin = dedent("""\
             server {self.server_address}
             key omapi_key {self.shared_key}
@@ -118,7 +120,8 @@
             new host
             set ip-address = {ip_address}
             set hardware-address = {mac_address}
-            set name = {ip_address}
+            set hardware-type = 1
+            set name = "{ip_address}"
             create
             """)
         stdin = stdin.format(
@@ -134,12 +137,14 @@
             raise CalledProcessError(returncode, "omshell", output)
 
     def remove(self, ip_address):
+        # The "name" is not a host name; it's an identifier used within
+        # the DHCP server.  We just happen to use the IP address.
         stdin = dedent("""\
             server {self.server_address}
             key omapi_key {self.shared_key}
             connect
             new host
-            set name = {ip_address}
+            set name = "{ip_address}"
             open
             remove
             """)

=== modified file 'src/provisioningserver/tests/test_omshell.py'
--- src/provisioningserver/tests/test_omshell.py	2012-08-31 15:43:12 +0000
+++ src/provisioningserver/tests/test_omshell.py	2012-09-06 07:00:25 +0000
@@ -64,7 +64,8 @@
             new host
             set ip-address = {ip}
             set hardware-address = {mac}
-            set name = {ip}
+            set hardware-type = 1
+            set name = "{ip}"
             create
             """).format(
                 server=server_address,
@@ -116,7 +117,7 @@
             key omapi_key {key}
             connect
             new host
-            set name = {ip}
+            set name = "{ip}"
             open
             remove
             """).format(