maas installs need to configure cloud-init with 'manage_etc_hosts: localhost'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Scott Moser |
Bug Description
In the QA lab, we were running into an issue where a charm would use 'unit-get private-address' or 'unit-get public-address'.
Either one would result in 'hostname -f' being called from juju/unit/
hostname -f was failing because the hostname provided to the system by maas in the metadata service was something like 'node-d4bed9a84
In EC2, the hostname is set to the shortname of the 'local-hostname' that is provided to the node via metadata service.
'hostname -f' then resolves on normal DNS lookup. (Also note in EC2UnitAddress of address.py, it explicitly uses
private-address as http://
The right thing to do, then is to:
a.) make maas contain definitive information for 'public-address' and 'private-address'
b.) make the MAASUnitAddress reference the information from 'a' in one way or another
However, that is complicated due to the possibility/
One work around, that happens to work in our QA lab is to configure cloud-init with:
manage_etc_hosts: localhost
What this does is tells cloud-init to basically write the content of 'local-hostname' from the Metadata Service into /etc/hosts in a line like:
127.0.1.1 node-d4bed9a846
Doing this, means that:
$ hostname --fqdn
node-
Thus, the 'MAASUnitAddress' will end up (indirectly) passing back the 'local-hostname' to the unit-get request.
Additionally, this is actually OK, because while 'node-d4bed9a8461f' is not resolvable via 'resolver' (which would be required for hostname --fqdn to work), 'node-d4bed9a84
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
and that address is resolvable via mdns4.
So, the result is that:
* indirectly, we're passing the 'local-hostname' as provided by MAAS through to 'unit-get private-address', which is consistent with what happens on EC2
* also indirectly, MAAS ends up being the definitive source.
* in a more realistic environment (that did not rely on avahi for name resolution), 'hostname --fqdn' would/could still return the 'node-xxxxx.local' which would be resolveable by DNS.
So, in short, its not *terrible* for us to have MAAS feed cloud-init the following snippet of cloud-config:
manage_etc_hosts: localhost
Related branches
- Julian Edwards (community): Approve
-
Diff: 9 lines (+2/-0)1 file modifiedcontrib/snippets/maas_preseed (+2/-0)
Changed in maas: | |
status: | New → Triaged |
importance: | Undecided → High |
assignee: | nobody → Scott Moser (smoser) |
Changed in maas: | |
status: | Triaged → Fix Committed |
Changed in maas: | |
status: | Fix Committed → Fix Released |