You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2015/09/14 10:26:48 UTC

[1/3] incubator-brooklyn git commit: Fix for BROOKLYN-169 - CreateUserPolicy always resets the password

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 4ea52475f -> 1adccdae1


Fix for BROOKLYN-169 - CreateUserPolicy always resets the password

- Added parameter (RESET_LOGIN_USER)
- RESET_LOGIN_USER is false by default
- RESET_LOGIN_USER controls when login password to be reset



Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/6f986cb9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/6f986cb9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/6f986cb9

Branch: refs/heads/master
Commit: 6f986cb9c3be23d1681ab2392329cd95d400030b
Parents: ac88adc
Author: Yavor Yanchev <ya...@yanchev.com>
Authored: Wed Sep 2 23:03:08 2015 +0300
Committer: Yavor Yanchev <ya...@yanchev.com>
Committed: Wed Sep 9 15:19:26 2015 +0300

----------------------------------------------------------------------
 .../apache/brooklyn/policy/jclouds/os/CreateUserPolicy.java | 9 ++++++++-
 .../policy/jclouds/os/CreateUserPolicyLiveTest.java         | 1 +
 .../brooklyn/policy/jclouds/os/CreateUserPolicyTest.java    | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6f986cb9/locations/jclouds/src/main/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicy.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicy.java b/locations/jclouds/src/main/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicy.java
index 292a28a..2ad0dde 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicy.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicy.java
@@ -87,6 +87,12 @@ public class CreateUserPolicy extends AbstractPolicy implements SensorEventListe
             "createuser.vm.user.credentials",
             "The \"<user> : <password> @ <hostname>:<port>\"");
 
+    @SetFromFlag("resetLoginUser")
+    public static final ConfigKey<Boolean> RESET_LOGIN_USER = ConfigKeys.newBooleanConfigKey(
+            "createuser.vm.user.resetLoginUser",
+            "Whether to reset the password used for user login",
+            false);
+
     public void setEntity(EntityLocal entity) {
         super.setEntity(entity);
         subscribe(entity, AbstractEntity.LOCATION_ADDED, this);
@@ -110,6 +116,7 @@ public class CreateUserPolicy extends AbstractPolicy implements SensorEventListe
     
     protected void addUser(Entity entity, SshMachineLocation machine) {
         boolean grantSudo = getRequiredConfig(GRANT_SUDO);
+        boolean resetPassword = getRequiredConfig(RESET_LOGIN_USER);
         String user = getRequiredConfig(VM_USERNAME);
         String password = Identifiers.makeRandomId(12);
         String hostname = machine.getAddress().getHostName();
@@ -125,7 +132,7 @@ public class CreateUserPolicy extends AbstractPolicy implements SensorEventListe
                 .adminUsername(user)
                 .adminPassword(password)
                 .grantSudoToAdminUser(false)
-                .resetLoginPassword(true)
+                .resetLoginPassword(resetPassword)
                 .loginPassword(password)
                 .authorizeAdminPublicKey(false)
                 .adminPublicKey("ignored")

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6f986cb9/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
index 0fe9b24..72b2083 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
@@ -73,6 +73,7 @@ public class CreateUserPolicyLiveTest extends BrooklynAppLiveTestSupport {
             app.createAndManageChild(EntitySpec.create(TestEntity.class)
                     .policy(PolicySpec.create(CreateUserPolicy.class)
                             .configure(CreateUserPolicy.GRANT_SUDO, true)
+                            .configure(CreateUserPolicy.RESET_LOGIN_USER, true)
                             .configure(CreateUserPolicy.VM_USERNAME, newUsername)));
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6f986cb9/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java
index e423528..82b6dfa 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java
@@ -107,6 +107,7 @@ public class CreateUserPolicyTest extends BrooklynAppUnitTestSupport {
         app.createAndManageChild(EntitySpec.create(TestEntity.class)
                 .policy(PolicySpec.create(CreateUserPolicy.class)
                         .configure(CreateUserPolicy.GRANT_SUDO, true)
+                        .configure(CreateUserPolicy.RESET_LOGIN_USER, false)
                         .configure(CreateUserPolicy.VM_USERNAME, newUsername)));
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         app.start(ImmutableList.of(machine));


[2/3] incubator-brooklyn git commit: Adjusting the test so it doesn't reset the password when executed locally

Posted by al...@apache.org.
Adjusting the test so it doesn't reset the password when executed
  locally

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/8e102ed2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/8e102ed2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/8e102ed2

Branch: refs/heads/master
Commit: 8e102ed2e913bb4f73cdfa73f26b244e1dbd8a96
Parents: 6f986cb
Author: Yavor Yanchev <ya...@yanchev.com>
Authored: Mon Sep 14 11:15:46 2015 +0300
Committer: Yavor Yanchev <ya...@yanchev.com>
Committed: Mon Sep 14 11:15:46 2015 +0300

----------------------------------------------------------------------
 .../apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e102ed2/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
index 72b2083..0fe9b24 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyLiveTest.java
@@ -73,7 +73,6 @@ public class CreateUserPolicyLiveTest extends BrooklynAppLiveTestSupport {
             app.createAndManageChild(EntitySpec.create(TestEntity.class)
                     .policy(PolicySpec.create(CreateUserPolicy.class)
                             .configure(CreateUserPolicy.GRANT_SUDO, true)
-                            .configure(CreateUserPolicy.RESET_LOGIN_USER, true)
                             .configure(CreateUserPolicy.VM_USERNAME, newUsername)));
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
 


[3/3] incubator-brooklyn git commit: This closes #877

Posted by al...@apache.org.
This closes #877


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/1adccdae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/1adccdae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/1adccdae

Branch: refs/heads/master
Commit: 1adccdae14b97aa4999b7a2aa8cdcb560ddfefcb
Parents: 4ea5247 8e102ed
Author: Aled Sage <al...@gmail.com>
Authored: Mon Sep 14 09:26:21 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Sep 14 09:26:21 2015 +0100

----------------------------------------------------------------------
 .../apache/brooklyn/policy/jclouds/os/CreateUserPolicy.java | 9 ++++++++-
 .../brooklyn/policy/jclouds/os/CreateUserPolicyTest.java    | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------