~kirkland/maas/1287224

Viewing all changes in revision 2652.

  • Committer: Dustin Kirkland
  • Date: 2014-08-05 18:35:26 UTC
  • Revision ID: dustin.kirkland@gmail.com-20140805183526-5plse38fgu65eq2i
Enable MAAS to produce friendly, pronounceable hostnames, LP: #1287224

Ship two culled word lists -- 1,315 adjectives, and 977 nouns.  This gives
us a possible 1,284,755 combinations of adjective-noun, which is more than
enough to cover any Class B, /12 network (255.240.0.0) and its 1,048,576
unique IP addresses.

You might notice that this model is quite similar to Ubuntu's friendly
release naming scheme, such as "Warty Warthog".

These word lists are shipped and installed in /etc/maas/adjectives.txt
and /etc/maas/nouns.txt, such that they are easily customized, edited,
or overwritten by any MAAS administrator.

The modified code updates the generate_hostname() hostname function
to try and generate an 'adjective-noun' hostname, but if any exception
occurs (such as a wordlist read exception), it will fall back to the
legacy 5-random-non-ambiguous-character hostname.

A test is included to ensure that all randomly generated hostnames
fit the model of "word hyphen word".  However, note that it's probably
not able to open and read the word lists, since they're installed on disk.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: