Use transient hostname for deployed servers
authorSteve Baker <sbaker@redhat.com>
Wed, 30 Nov 2016 20:20:02 +0000 (20:20 +0000)
committerSteve Baker <sbaker@redhat.com>
Thu, 1 Dec 2016 01:11:57 +0000 (01:11 +0000)
The name output returned by this template is expected to be the short
name rather than a FQDN.  Generally 'hostnamectl --static' returns a
FQDN and --transient will be the short name.

This change switches to using --transient and also simplifies the
script by dropping the unused outputs.

Change-Id: I19eaf9f66668f7e68765bad4018c0c60314f3f8f

deployed-server/deployed-server.yaml

index da5698e..22797c2 100644 (file)
@@ -69,21 +69,10 @@ resources:
           #!/bin/bash
           set -eux
           mkdir -p $heat_outputs_path
-          host=$(hostnamectl --static)
-          echo -n "$host "  > $heat_outputs_path.hosts_entry
-          host_ip=$(python -c "import socket; print socket.gethostbyname(\"$host\")")
-          echo -n "$host_ip " >> $heat_outputs_path.hosts_entry
-          echo >> $heat_outputs_path.hosts_entry
-          cat $heat_outputs_path.hosts_entry
-          echo -n $host_ip > $heat_outputs_path.ip_address
-          cat $heat_outputs_path.ip_address
+          host=$(hostnamectl --transient)
           echo -n $host > $heat_outputs_path.hostname
           cat $heat_outputs_path.hostname
       outputs:
-        - name: hosts_entry
-          description: hosts_entry
-        - name: ip_address
-          description: ip_address
         - name: hostname
           description: hostname
 
@@ -108,8 +97,4 @@ outputs:
       ctlplane:
         - {get_attr: [ControlPlanePort, ip_address]}
   name:
-   value: {get_attr: [HostsEntryDeployment, hostname]}
-  hosts_entry:
-   value: {get_attr: [HostsEntryDeployment, hosts_entry]}
-  ip_address:
-    value: {get_attr: [HostsEntryDeployment, ip_address]}
+    value: {get_attr: [HostsEntryDeployment, hostname]}