Repository: brooklyn-server
Updated Branches:
  refs/heads/master 84fb623d1 -> 257926534


Fix setting the hostname on non-centos machines

Failure in the command will abort machine obtain, so make sure the command 
reports successfull result on non-centos machines.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/65eea3c6
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/65eea3c6
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/65eea3c6

Branch: refs/heads/master
Commit: 65eea3c6068dbadae8ce97a58ce8cf8e06fb30d6
Parents: 4b11f50
Author: Svetoslav Neykov <[email protected]>
Authored: Tue Jul 5 21:07:15 2016 +0300
Committer: Svetoslav Neykov <[email protected]>
Committed: Wed Jul 6 12:52:14 2016 +0300

----------------------------------------------------------------------
 .../apache/brooklyn/location/jclouds/JcloudsLocation.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/65eea3c6/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
 
b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 51e9d6a..cd9053e 100644
--- 
a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ 
b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -924,10 +924,10 @@ public class JcloudsLocation extends 
AbstractCloudMachineProvisioningLocation im
                         executeCommandThrowingOnError(
                                 (SshMachineLocation)machineLocation,
                                 "Generate hostname " + node.getName(),
-                                Arrays.asList("sudo hostname " + 
node.getName(),
-                                        "sudo sed -i 
\"s/HOSTNAME=.*/HOSTNAME=" + node.getName() + "/g\" /etc/sysconfig/network",
-                                        "sudo bash -c \"echo 127.0.0.1   
`hostname` >> /etc/hosts\"")
-                        );
+                                ImmutableList.of(BashCommands.chainGroup(
+                                        String.format("echo '127.0.0.1 %s' | ( 
%s )", node.getName(), BashCommands.sudo("tee -a /etc/hosts")),
+                                        "{ " + BashCommands.sudo("sed -i 
\"s/HOSTNAME=.*/HOSTNAME=" + node.getName() + "/g\" /etc/sysconfig/network") + 
" || true ; }",
+                                        BashCommands.sudo("hostname " + 
node.getName()))));
                     }
                 }
 

Reply via email to