1. Enable DHCP
2. Fails with the error below
3. Service tracking sometimes shows it as OFF and sometimes as error. It should always show it as error.
2016-09-15 11:04:30 [-] Unhandled failure dispatching AMP command. This is probably a bug. Please ensure that this error is handled within application code or declared in the signature of the b'ConfigureDHCPv4' command. [unleashed:pid=28703:cmd=ConfigureDHCPv4:ask=d]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1184, in gotResult
_inlineCallbacks(r, g, deferred)
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1174, in _inlineCallbacks
deferred.errback()
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 434, in errback
self._startRunCallbacks(fail)
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 501, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/usr/lib/python3/dist-packages/twisted/protocols/amp.py", line 1149, in checkKnownErrors
key = error.trap(*command.allErrors)
File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 342, in trap
self.raiseException()
File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 368, in raiseException
raise self.value.with_traceback(self.tb)
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/lib/python3/dist-packages/provisioningserver/rpc/dhcp.py", line 307, in configure
yield deferToThread(_write_config, server, new_state)
File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 246, in inContext
result = inContext.theWork()
File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 262, in <lambda>
inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 200, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/provisioningserver/rpc/dhcp.py", line 154, in _write_config
dhcpd_config, interfaces_config = state.get_config(server)
File "/usr/lib/python3/dist-packages/provisioningserver/rpc/dhcp.py", line 147, in get_config
self.global_dhcp_snippets, key=itemgetter("name")))
File "/usr/lib/python3/dist-packages/provisioningserver/dhcp/config.py", line 169, in get_config
shared_networks, hosts, omapi_key)
File "/usr/lib/python3/dist-packages/provisioningserver/dhcp/config.py", line 204, in get_config_v4
ntp_servers_ipv4, ntp_servers_ipv6 = get_addresses(*ntp_servers)
File "/usr/lib/python3/dist-packages/provisioningserver/dhcp/config.py", line 138, in get_addresses
for ipver, addr in gen_addresses(hostname):
File "/usr/lib/python3/dist-packages/provisioningserver/dhcp/config.py", line 121, in gen_addresses
hostname, 0, 0, socket.SOCK_DGRAM, socket.IPPROTO_UDP):
File "/usr/lib/python3.5/socket.py", line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
After discussion with Gavin on IRC, DHCP doesn't support hostnames as DHCP options, as such MAAS resolves NTP hostnames before.
MAAS should have a mechanism where if it cannot resolve, it should not:
1. fail to configure DHCP
2. proceed configuration, but maybe without adding it.
Also, when saving the NTP server, MAAS should check whether it can be resolved and allow the user to use it.