enlist tries to enlist invalid hostname if dns not setup properly

Bug #1305282 reported by Scott Moser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Committed
Undecided
Andres Rodriguez

Bug Description

looking at console output of an enlisting server i see:

=== Wed, 09 Apr 2014 19:44:59 +0000: successfully enlisted to 'http://192.168.9.2/MAAS/api/1.0/nodes/' with hostname ';; connection timed out; no servers could be reached'
{"hostname": ["Name contains disallowed characters: u';; connection timed out; no servers could be reached'."]}=============================================
2014-04-09 19:45:09,935 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/i-maas-enlistment/sem/config_ssh_authkey_fingerprints - wb: [420] 20 bytes
2014-04-09 19:45:09,936 - helpers.py[DEBUG]: Running config-ssh-authkey-fingerprints using lock (<FileLock using file '/var/lib/cloud/instances/i-maas-enlistment/sem/config_ssh_au
thkey_fingerprints'>)

this seems to be a result of the following code in contrib/preseeds_v2/enlist_userdata:

   host=""
   ip=$(ifconfig eth0 | awk '$1 == "inet" { sub("addr:","",$2); print $2; }') &&
     [ -n "${ip}" ] && host=$(dig +short -x $ip) && host=${host%.}

in this failure case, dig exited failure (probably '9') but wrote to stdout:
 ;; connection timed out; no servers could be reached

so we need to fix the above to just do
 [ -n "${ip}" ] && host=$(dig +short -x $ip) && host=${host%.} || host=""

Related branches

Revision history for this message
Scott Moser (smoser) wrote :

maas server responds somewhat non-ideally with:

ERROR 2014-04-09 21:00:56,156 maasserver ################################ Exception: {'hostname': [u"Name contains disallowed characters: u';; connection timed out; no servers could be reached'."]} ################################
ERROR 2014-04-09 21:00:56,156 maasserver Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/vary.py", line 19, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 167, in __call__
    result = self.error_handler(e, request, meth, em_format)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 165, in __call__
    result = meth(request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api_support.py", line 189, in dispatch
    return function(self, request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api.py", line 576, in new
    return create_node(request)
  File "/usr/lib/python2.7/dist-packages/maasserver/api.py", line 547, in create_node
    raise ValidationError(form.errors)
ValidationError: {'hostname': [u"Name contains disallowed characters: u';; connection timed out; no servers could be reached'."]}

Changed in maas:
assignee: nobody → Andres Rodriguez (andreserl)
Revision history for this message
Gavin Panella (allenap) wrote :

Is there any way we can write unit tests for these?

Revision history for this message
Gavin Panella (allenap) wrote :

> maas server responds somewhat non-ideally with:
> ...
> ValidationError: {'hostname': [u"Name contains disallowed characters:
> u';; connection timed out; no servers could be reached'."]}

That seems okay to me... what would be better? Perhaps omit the
traceback?

Revision history for this message
Julian Edwards (julian-edwards) wrote :

This bug is a dupe but I can't find the original one, someone help me out here!

Changed in maas:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.