Whirr
  1. Whirr
  2. WHIRR-634

Update private IP host file entry when required by AUTO_HOSTNAME_SUFFIX

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.7.1
    • Fix Version/s: 0.8.2, 0.9.0
    • Component/s: core
    • Labels:
      None

      Description

      Currently, configure_hostnames.sh ensures that the public IP host file entry is written if required by the AUTO_HOSTNAME_SUFFIX variable. It does not however touch the internal IP host file entry, which is likely to retain an entry for the initial (and generally unresolvable) hostname. It is suggested that configure_hostname.sh also update the private IP host file entry, with a 'private.' prefix to ensure there is no ambiguity in reverse lookups, since the order of the host file entries cannot be relied on (eg the order varies host to host, IP to IP on Rackspace Cloud). This keeps the public/private host file entries in sync and allows them to be used interchangably depending on the visibility requirements of the node.

      Eg, on Rackspace cloud, if provisioning a node with a whirr.cluster-name 'cdh-cluster' on Rackspace Cloud UK, the pre configure_hostnames.sh on a particular node looks as so:

      -bash-4.1$ cat /etc/hosts
      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
      10.177.7.48 cdh-cluster-74f
      31.222.177.80 cdh-cluster-74f

      after current trunk configure_hostnames.sh:

      -bash-4.1$ cat /etc/hosts
      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
      10.177.7.48 cdh-cluster-74f
      31.222.177.80 31-222-177-80.static.cloud-ips.co.uk

      and after the suggested updates in this JIRA it would look like:

      -bash-4.1$ cat /etc/hosts
      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
      10.177.7.48 private.31-222-177-80.static.cloud-ips.co.uk
      31.222.177.80 31-222-177-80.static.cloud-ips.co.uk

      1. WHIRR-634.patch
        1 kB
        Andrew Bayer
      2. WHIRR-634.patch
        0.9 kB
        Graham Gear

        Activity

        Hide
        Andrew Bayer added a comment -

        Pushed to branch-0.8

        Show
        Andrew Bayer added a comment - Pushed to branch-0.8
        Hide
        Andrew Bayer added a comment -

        Committed.

        Show
        Andrew Bayer added a comment - Committed.
        Hide
        Andrew Bayer added a comment -

        Ok, I'm +1 now. Finally. Will commit shortly.

        Show
        Andrew Bayer added a comment - Ok, I'm +1 now. Finally. Will commit shortly.
        Hide
        Andrew Bayer added a comment -

        You set them with properties in the recipe - whirr.auto-hostname-suffix and whirr.auto-hostname-prefix.

        Show
        Andrew Bayer added a comment - You set them with properties in the recipe - whirr.auto-hostname-suffix and whirr.auto-hostname-prefix.
        Hide
        Paul Baclace added a comment - - edited

        On HPCloud, it is possible to have only:

        127.0.0.1 localhost

        in /etc/hosts for ubuntu 12.04 "precise" (generic ipv6 entries are also present).

        That means configure_hostnames.sh should append the entry if the ipaddr is not present at all.

        I tried this on HPCloud, but configure_hostnames.sh does not run. How do I get it to be applied? The use of AUTO_HOSTNAME_SUFFIX and AUTO_HOSTNAME_PREFIX are involved, but I don't know how these get set and I don't know how to validate correct use of suffix,prefix with dig.

        Show
        Paul Baclace added a comment - - edited On HPCloud, it is possible to have only: 127.0.0.1 localhost in /etc/hosts for ubuntu 12.04 "precise" (generic ipv6 entries are also present). That means configure_hostnames.sh should append the entry if the ipaddr is not present at all. I tried this on HPCloud, but configure_hostnames.sh does not run. How do I get it to be applied? The use of AUTO_HOSTNAME_SUFFIX and AUTO_HOSTNAME_PREFIX are involved, but I don't know how these get set and I don't know how to validate correct use of suffix,prefix with dig.
        Hide
        Andrew Bayer added a comment -

        Slightly tweaked patch - it's possible to have only one IP on the instance, so we should make sure PRIVATE_IP isn't empty.

        Show
        Andrew Bayer added a comment - Slightly tweaked patch - it's possible to have only one IP on the instance, so we should make sure PRIVATE_IP isn't empty.
        Hide
        Andrew Bayer added a comment -

        Deferring to this for 0.8.1 - I'm just not 100% sure of this one yet. =)

        Show
        Andrew Bayer added a comment - Deferring to this for 0.8.1 - I'm just not 100% sure of this one yet. =)
        Hide
        Andrei Savu added a comment -

        +1

        Show
        Andrei Savu added a comment - +1
        Hide
        Graham Gear added a comment -

        Suggested implementation.

        Show
        Graham Gear added a comment - Suggested implementation.

          People

          • Assignee:
            Graham Gear
            Reporter:
            Graham Gear
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development