Author: asavu
Date: Mon Feb 20 22:34:29 2012
New Revision: 1291493

URL: http://svn.apache.org/viewvc?rev=1291493&view=rev
Log:
WHIRR-463. Fail fast when running as root (asavu)

Modified:
    whirr/branches/branch-0.7/   (props changed)
    whirr/branches/branch-0.7/CHANGES.txt
    
whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/ClusterSpec.java
    
whirr/branches/branch-0.7/core/src/test/java/org/apache/whirr/ClusterSpecTest.java

Propchange: whirr/branches/branch-0.7/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Feb 20 22:34:29 2012
@@ -4,3 +4,4 @@
 .settings
 target
 whirr.log*
+.idea

Modified: whirr/branches/branch-0.7/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/whirr/branches/branch-0.7/CHANGES.txt?rev=1291493&r1=1291492&r2=1291493&view=diff
==============================================================================
--- whirr/branches/branch-0.7/CHANGES.txt (original)
+++ whirr/branches/branch-0.7/CHANGES.txt Mon Feb 20 22:34:29 2012
@@ -11,6 +11,8 @@ Release 0.7.1
 
     WHIRR-498. Update the list of known limitations (asavu)
 
+    WHIRR-463. Fail fast when running as root (asavu)
+    
   BUG FIXES
 
     WHIRR-502. configure_cdh_hadoop.sh: syntax error trying to 

Modified: 
whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/ClusterSpec.java
URL: 
http://svn.apache.org/viewvc/whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/ClusterSpec.java?rev=1291493&r1=1291492&r2=1291493&view=diff
==============================================================================
--- 
whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/ClusterSpec.java 
(original)
+++ 
whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/ClusterSpec.java 
Mon Feb 20 22:34:29 2012
@@ -820,6 +820,7 @@ public class ClusterSpec {
   }
 
   public void setClusterUser(String user) {
+    checkArgument(user == null || !user.equals("root"), "cluster-user != root 
or do not run as root");
     this.clusterUser = user;
   }
 

Modified: 
whirr/branches/branch-0.7/core/src/test/java/org/apache/whirr/ClusterSpecTest.java
URL: 
http://svn.apache.org/viewvc/whirr/branches/branch-0.7/core/src/test/java/org/apache/whirr/ClusterSpecTest.java?rev=1291493&r1=1291492&r2=1291493&view=diff
==============================================================================
--- 
whirr/branches/branch-0.7/core/src/test/java/org/apache/whirr/ClusterSpecTest.java
 (original)
+++ 
whirr/branches/branch-0.7/core/src/test/java/org/apache/whirr/ClusterSpecTest.java
 Mon Feb 20 22:34:29 2012
@@ -356,4 +356,11 @@ public class ClusterSpecTest {
     
assertThat(firewallRules.get("serviceA").equals(Lists.<String>newArrayList("9000","9001")),
 is(true));
   }
 
+  @Test(expected = IllegalArgumentException.class)
+  public void testFailIfRunningAsRootOrClusterUserIsRoot() throws 
ConfigurationException {
+    PropertiesConfiguration conf = new 
PropertiesConfiguration("whirr-core-test.properties");
+    conf.setProperty("whirr.cluster-user", "root");
+
+    ClusterSpec.withNoDefaults(conf);
+  }
 }


Reply via email to