You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/08/31 20:52:34 UTC

[1/6] brooklyn-server git commit: Try alternative Java versions

Repository: brooklyn-server
Updated Branches:
  refs/heads/master 88192c1f1 -> b68f6f840


Try alternative Java versions

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

Branch: refs/heads/master
Commit: 5127ac60c936d9e4814b392b512bb3762a511ba5
Parents: 88192c1
Author: Duncan Godwin <dr...@googlemail.com>
Authored: Wed Aug 31 18:09:53 2016 +0100
Committer: GitHub <no...@github.com>
Committed: Wed Aug 31 18:09:53 2016 +0100

----------------------------------------------------------------------
 .../java/JavaSoftwareProcessSshDriver.java      | 43 ++++++++++++++------
 1 file changed, 30 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5127ac60/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java b/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
index fe335cd..276db80 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
@@ -278,16 +278,7 @@ public abstract class JavaSoftwareProcessSshDriver extends AbstractSoftwareProce
      * otherwise false.
      */
     protected boolean checkForAndInstallJava(String requiredVersion) {
-        int requiredJavaMinor;
-        if (requiredVersion.contains(".")) {
-            List<String> requiredVersionParts = Splitter.on(".").splitToList(requiredVersion);
-            requiredJavaMinor = Integer.valueOf(requiredVersionParts.get(1));
-        } else if (requiredVersion.length() == 1) {
-            requiredJavaMinor = Integer.valueOf(requiredVersion);
-        } else {
-            log.error("java version required {} is not supported", requiredVersion);
-            throw new IllegalArgumentException("Required java version " + requiredVersion + " not supported");
-        }
+        int requiredJavaMinor = getJavaMinorVersion(requiredVersion);
         Optional<String> installedJavaVersion = getInstalledJavaVersion();
         if (installedJavaVersion.isPresent()) {
             List<String> installedVersionParts = Splitter.on(".").splitToList(installedJavaVersion.get());
@@ -301,7 +292,26 @@ public abstract class JavaSoftwareProcessSshDriver extends AbstractSoftwareProce
         return tryJavaInstall(requiredVersion, BashCommands.installJava(requiredJavaMinor)) == 0;
     }
 
-    protected int tryJavaInstall(String version, String command) {
+    /**
+     * Converts a string java version to an int, so 1.7 becomes 7
+     * @param requiredVersion
+     * @return version
+     */
+    private int getJavaMinorVersion(String requiredVersion){
+        int requiredJavaMinor;
+        if (requiredVersion.contains(".")) {
+            List<String> requiredVersionParts = Splitter.on(".").splitToList(requiredVersion);
+            requiredJavaMinor = Integer.valueOf(requiredVersionParts.get(1));
+        } else if (requiredVersion.length() == 1) {
+            requiredJavaMinor = Integer.valueOf(requiredVersion);
+        } else {
+            log.error("java version required {} is not supported", requiredVersion);
+            throw new IllegalArgumentException("Required java version " + requiredVersion + " not supported");
+        }
+        return requiredJavaMinor;
+    }
+
+    private int tryJavaInstall(String version, String command) {
         getLocation().acquireMutex("installing", "installing Java at " + getLocation());
         try {
             log.debug("Installing Java {} at {}@{}", new Object[]{version, getEntity(), getLocation()});
@@ -378,10 +388,17 @@ public abstract class JavaSoftwareProcessSshDriver extends AbstractSoftwareProce
     public boolean installJava() {
         if (entity instanceof UsesJava) {
             String version = entity.getConfig(UsesJava.JAVA_VERSION_REQUIRED);
-            return checkForAndInstallJava(version);
+            if (checkForAndInstallJava(version)) return true;
+            String incrementedVersion = String.valueOf(getJavaMinorVersion(version)+1);
+
+            log.warn("Java {} install failed, trying Java {}", version, incrementedVersion);
+            return checkForAndInstallJava(incrementedVersion);
         }
         // by default it installs jdk7
-        return checkForAndInstallJava("1.7");
+        if (checkForAndInstallJava("1.7")) return true;
+        // alternatively try jdk8
+        log.warn("Java 1.7 install failed, trying Java 1.8");
+        return (checkForAndInstallJava("1.8"));
     }
 
     public void installJmxSupport() {


[5/6] brooklyn-server git commit: This closes #315

Posted by he...@apache.org.
This closes #315


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

Branch: refs/heads/master
Commit: aef606d3c79bfb1880446507c35701e62e8b0d4e
Parents: 6d2ef54 5127ac6
Author: Alex Heneveld <al...@Alexs-MacBook-Pro.local>
Authored: Wed Aug 31 21:51:54 2016 +0100
Committer: Alex Heneveld <al...@Alexs-MacBook-Pro.local>
Committed: Wed Aug 31 21:51:54 2016 +0100

----------------------------------------------------------------------
 .../java/JavaSoftwareProcessSshDriver.java      | 43 ++++++++++++++------
 1 file changed, 30 insertions(+), 13 deletions(-)
----------------------------------------------------------------------



[4/6] brooklyn-server git commit: This closes #316

Posted by he...@apache.org.
This closes #316


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

Branch: refs/heads/master
Commit: 6d2ef541573867f66069d3f9598238d540bfd45f
Parents: 88192c1 b3de104
Author: Alex Heneveld <al...@Alexs-MacBook-Pro.local>
Authored: Wed Aug 31 21:50:59 2016 +0100
Committer: Alex Heneveld <al...@Alexs-MacBook-Pro.local>
Committed: Wed Aug 31 21:50:59 2016 +0100

----------------------------------------------------------------------
 .../brooklyn/core/location/cloud/CloudLocationConfig.java   | 2 +-
 .../apache/brooklyn/location/jclouds/JcloudsLocation.java   | 9 +++++----
 .../jclouds/JcloudsHardwareProfilesStubbedLiveTest.java     | 5 +++++
 3 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[3/6] brooklyn-server git commit: Fix winrm4j in Karaf

Posted by he...@apache.org.
Fix winrm4j in Karaf

winrm4j version update has fixed for OSGi. Also adding an extension bundle to httpcomponents-asyncclient so that it's able to see org.apache.http.ssl package (that's fixed in later revision releases of the jar).


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

Branch: refs/heads/master
Commit: 470dda2ced543bf68f4ae931c5c7090a08d799f3
Parents: 88192c1
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Wed Aug 31 19:33:20 2016 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Wed Aug 31 23:11:23 2016 +0300

----------------------------------------------------------------------
 karaf/features/src/main/feature/feature.xml |  2 +
 karaf/httpcomponent-extension/pom.xml       | 55 ++++++++++++++++++++++++
 karaf/pom.xml                               |  1 +
 pom.xml                                     |  2 +-
 4 files changed, 59 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/470dda2c/karaf/features/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml
index a361d5a..d2078d3 100644
--- a/karaf/features/src/main/feature/feature.xml
+++ b/karaf/features/src/main/feature/feature.xml
@@ -220,8 +220,10 @@
         <feature>brooklyn-core</feature>
         <bundle dependency="true">mvn:io.cloudsoft.windows/winrm4j/${winrm4j.version}</bundle>
         <bundle dependency="true">mvn:io.cloudsoft.windows/winrm4j-client/${winrm4j.version}</bundle>
+        <bundle>mvn:org.apache.brooklyn/brooklyn-karaf-httpcomponents-extension/${project.version}</bundle>
         <feature>cxf-jaxws</feature>
         <feature>cxf-http-async</feature>
+        <feature>cxf-ws-addr</feature>
     </feature>
 
     <feature name="brooklyn-policy"  version="${project.version}" description="Brooklyn Policies">

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/470dda2c/karaf/httpcomponent-extension/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/httpcomponent-extension/pom.xml b/karaf/httpcomponent-extension/pom.xml
new file mode 100644
index 0000000..d4f5f85
--- /dev/null
+++ b/karaf/httpcomponent-extension/pom.xml
@@ -0,0 +1,55 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+<!--
+
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+
+	    http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+
+-->
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.brooklyn</groupId>
+    <artifactId>brooklyn-karaf</artifactId>
+    <version>0.10.0-SNAPSHOT</version>  <!-- BROOKLYN_VERSION -->
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>brooklyn-karaf-httpcomponents-extension</artifactId>
+  <packaging>bundle</packaging>
+
+  <name>Apache Http Component extension</name>
+  <description>
+    An OSGi fragment to extend the http component async bundle to see org.apache.http.ssl package
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <!-- TODO re-use pluginManagement to brooklyn-parent -->
+        <version>2.5.4</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Fragment-Host>org.apache.httpcomponents.httpasyncclient</Fragment-Host>
+            <Import-Package>
+                *,
+                org.apache.http.ssl;version="[4.4.0,4.5.0)"
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/470dda2c/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/karaf/pom.xml b/karaf/pom.xml
index 8d02f38..8540ca8 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -61,6 +61,7 @@
   <modules>
     <module>init</module>
     <module>jetty-config</module>
+    <module>httpcomponent-extension</module>
     <module>features</module>
     <module>commands</module>
   </modules>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/470dda2c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7729165..a6cff34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -155,7 +155,7 @@
         <maxmind.version>0.8.1</maxmind.version>
         <maxmind-db.version>0.3.4</maxmind-db.version>
         <jna.version>4.0.0</jna.version>
-        <winrm4j.version>0.3.5</winrm4j.version>
+        <winrm4j.version>0.4.0</winrm4j.version>
         <karaf.version>4.0.4</karaf.version>
         <felix-osgi-compendium.version>1.4.0</felix-osgi-compendium.version>
         <!-- Transitive dependencies, declared explicitly to avoid version mismatch -->


[6/6] brooklyn-server git commit: This closes #314

Posted by he...@apache.org.
This closes #314


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

Branch: refs/heads/master
Commit: b68f6f840d7fc7a7374e656fb8db60a40c2048a0
Parents: aef606d 470dda2
Author: Alex Heneveld <al...@Alexs-MacBook-Pro.local>
Authored: Wed Aug 31 21:52:22 2016 +0100
Committer: Alex Heneveld <al...@Alexs-MacBook-Pro.local>
Committed: Wed Aug 31 21:52:22 2016 +0100

----------------------------------------------------------------------
 karaf/features/src/main/feature/feature.xml |  2 +
 karaf/httpcomponent-extension/pom.xml       | 55 ++++++++++++++++++++++++
 karaf/pom.xml                               |  1 +
 pom.xml                                     |  2 +-
 4 files changed, 59 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[2/6] brooklyn-server git commit: Set default minRam to 1gb

Posted by he...@apache.org.
Set default minRam to 1gb

Also changes JcloudsLocation\u2019s template building so that if
a config key has a default value then that will be used, if there is
no explicit value (or empty value) set.


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

Branch: refs/heads/master
Commit: b3de104bf769d80234f68135feff6e2b7469ad6c
Parents: 88192c1
Author: Aled Sage <al...@gmail.com>
Authored: Wed Aug 31 20:33:48 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Wed Aug 31 20:40:30 2016 +0100

----------------------------------------------------------------------
 .../brooklyn/core/location/cloud/CloudLocationConfig.java   | 2 +-
 .../apache/brooklyn/location/jclouds/JcloudsLocation.java   | 9 +++++----
 .../jclouds/JcloudsHardwareProfilesStubbedLiveTest.java     | 5 +++++
 3 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b3de104b/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java b/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java
index f749f64..77d888f 100644
--- a/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java
+++ b/core/src/main/java/org/apache/brooklyn/core/location/cloud/CloudLocationConfig.java
@@ -103,7 +103,7 @@ public interface CloudLocationConfig {
         "Whether to require 64-bit OS images (true), 32-bit images (false), or either (null)");
     
     public static final ConfigKey<Object> MIN_RAM = new BasicConfigKey<Object>(Object.class, "minRam",
-        "Minimum amount of RAM, either as string (4gb) or number of MB (4096), for use in selecting the machine/hardware profile", null);
+        "Minimum amount of RAM, either as string (4gb) or number of MB (4096), for use in selecting the machine/hardware profile", "1gb");
     
     public static final ConfigKey<Integer> MIN_CORES = new BasicConfigKey<Integer>(Integer.class, "minCores",
         "Minimum number of cores, for use in selecting the machine/hardware profile", null);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b3de104b/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 9ed2672..a1d1293 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
@@ -1647,10 +1647,11 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
 
         // Apply the template builder and options properties
         for (Map.Entry<ConfigKey<?>, CustomizeTemplateBuilder> entry : SUPPORTED_TEMPLATE_BUILDER_PROPERTIES.entrySet()) {
-            ConfigKey<?> name = entry.getKey();
-            CustomizeTemplateBuilder code = entry.getValue();
-            if (config.containsKey(name) && config.get(name) != null) {
-                code.apply(templateBuilder, config, config.get(name));
+            ConfigKey<?> key = entry.getKey();
+            Object val = config.containsKey(key) ? config.get(key) : key.getDefaultValue();
+            if (val != null) {
+                CustomizeTemplateBuilder code = entry.getValue();
+                code.apply(templateBuilder, config, val);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b3de104b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsHardwareProfilesStubbedLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsHardwareProfilesStubbedLiveTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsHardwareProfilesStubbedLiveTest.java
index d899da1..b95c371 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsHardwareProfilesStubbedLiveTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsHardwareProfilesStubbedLiveTest.java
@@ -63,6 +63,10 @@ public class JcloudsHardwareProfilesStubbedLiveTest extends AbstractJcloudsStubb
 
     @Test(groups={"Live", "Live-sanity"})
     public void testJcloudsCreateWithHardwareProfiles() throws Exception {
+        // default minRam is 1gb (but default smallest VM in softlayer is 1024mb so not a particularly useful test!)
+        obtainMachine();
+        assertTrue(template.getHardware().getRam() >= 1000, "template="+template);
+        
         obtainMachine(MutableMap.of(JcloudsLocationConfig.MIN_RAM, "4096"));
         assertTrue(template.getHardware().getRam() >= 4096, "template="+template);
         
@@ -76,4 +80,5 @@ public class JcloudsHardwareProfilesStubbedLiveTest extends AbstractJcloudsStubb
         obtainMachine(MutableMap.of(JcloudsLocationConfig.HARDWARE_ID, hardwareId));
         assertEquals(template.getHardware().getId(), hardwareId, "template="+template);
     }
+    
 }