You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2016/10/21 09:09:59 UTC

[3/4] brooklyn-library git commit: BindDns entity sets user running service per operating system

BindDns entity sets user running service per operating system

Use "named" on RHEL and "bind" on Ubuntu


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/24cb3810
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/24cb3810
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/24cb3810

Branch: refs/heads/master
Commit: 24cb3810a86f9c872042827f340ca1e02f72d29c
Parents: fe1de31
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Thu Oct 20 14:25:17 2016 +0100
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Thu Oct 20 14:25:17 2016 +0100

----------------------------------------------------------------------
 .../brooklyn/entity/network/bind/BindDnsServerSshDriver.java | 2 +-
 .../apache/brooklyn/entity/network/bind/BindOsSupport.java   | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/24cb3810/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
----------------------------------------------------------------------
diff --git a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
index ad0aaff..150cfb9 100644
--- a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
+++ b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSshDriver.java
@@ -76,7 +76,7 @@ public class BindDnsServerSshDriver extends AbstractSoftwareProcessSshDriver imp
 
         List<String> commands = Lists.newArrayList(
                 BashCommands.sudo("mkdir -p " + getDataDirectory() + " " + getDynamicDirectory() + " " + getOsSupport().getConfigDirectory()),
-                BashCommands.sudo("chown -R bind:bind " + getDataDirectory() + " " + getDynamicDirectory()),
+                BashCommands.sudo("chown -R " + getOsSupport().getUser() + ":" + getOsSupport().getUser() + " " + getDataDirectory() + " " + getDynamicDirectory()),
                 // TODO determine name of ethernet interface if not eth0?
                 IptablesCommands.insertIptablesRule(Chain.INPUT, "eth0", Protocol.UDP, dnsPort, Policy.ACCEPT),
                 IptablesCommands.insertIptablesRule(Chain.INPUT, "eth0", Protocol.TCP, dnsPort, Policy.ACCEPT),

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/24cb3810/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindOsSupport.java
----------------------------------------------------------------------
diff --git a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindOsSupport.java b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindOsSupport.java
index 18ecf51..ad681c7 100644
--- a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindOsSupport.java
+++ b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindOsSupport.java
@@ -30,6 +30,7 @@ public class BindOsSupport {
     // Likewise would make these package-private and have no getters if Freemarker was ok with it.
     private final String packageName;
     private final String serviceName;
+    private final String user;
     private final String rootConfigFile;
     private final String configDirectory;
     private final String workingDirectory;
@@ -39,6 +40,7 @@ public class BindOsSupport {
     private BindOsSupport(
             String packageName,
             String serviceName,
+            String user,
             String rootConfigFile,
             String configDirectory,
             String workingDirectory,
@@ -46,6 +48,7 @@ public class BindOsSupport {
             String keysFile) {
         this.packageName = packageName;
         this.serviceName = serviceName;
+        this.user = user;
         this.rootConfigFile = rootConfigFile;
         this.configDirectory = configDirectory;
         this.workingDirectory = workingDirectory;
@@ -60,6 +63,7 @@ public class BindOsSupport {
         return new BindOsSupport(
                 "bind",
                 "named",
+                "named",
                 "/etc/named.conf",
                 "/var/named",
                 "/var/named",
@@ -74,6 +78,7 @@ public class BindOsSupport {
         return new BindOsSupport(
                 "bind9",
                 "bind9",
+                "bind",
                 "/etc/bind/named.conf",
                 "/etc/bind",
                 "/var/cache/bind",
@@ -110,4 +115,7 @@ public class BindOsSupport {
         return keysFile;
     }
 
+    public String getUser() {
+        return user;
+    }
 }