You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by gr...@apache.org on 2015/06/03 02:02:04 UTC
[1/2] incubator-brooklyn git commit: Remove shared statics causing
issues in Clocker with more than one JcloudsLocation
Repository: incubator-brooklyn
Updated Branches:
refs/heads/master d16597cf9 -> 5dd08aa11
Remove shared statics causing issues in Clocker with more than one JcloudsLocation
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/b34229f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/b34229f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/b34229f1
Branch: refs/heads/master
Commit: b34229f141b50027bc95dbdc5019a1384863f476
Parents: 4d673a8
Author: Andrew Kennedy <gr...@apache.org>
Authored: Tue Jun 2 11:51:06 2015 +0100
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Wed Jun 3 00:37:12 2015 +0100
----------------------------------------------------------------------
.../jclouds/ComputeServiceRegistryImpl.java | 1 -
.../location/jclouds/JcloudsLocation.java | 21 ++++++++++----------
2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b34229f1/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java b/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
index 48ac86f..b3da5a6 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
@@ -37,7 +37,6 @@ import org.jclouds.sshj.config.SshjSshClientModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import brooklyn.entity.basic.Entities;
import brooklyn.entity.basic.Sanitizer;
import brooklyn.util.collections.MutableMap;
import brooklyn.util.config.ConfigBag;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b34229f1/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
index d0cc0ce..3f8120a 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
@@ -46,6 +46,7 @@ import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -204,7 +205,8 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
private static final Pattern LIST_PATTERN = Pattern.compile("^\\[(.*)\\]$");
private static final Pattern INTEGER_PATTERN = Pattern.compile("^\\d*$");
- private static boolean loggedSshKeysHint = false;
+ private final AtomicBoolean loggedSshKeysHint = new AtomicBoolean(false);
+ private final AtomicBoolean listedAvailableTemplatesOnNoSuchTemplate = new AtomicBoolean(false);
private final Map<String,Map<String, ? extends Object>> tagMapping = Maps.newLinkedHashMap();
@@ -1145,8 +1147,6 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
// TODO put user metadata and tags into notes, when jclouds exposes notes, because metadata not exposed via web portal
}
}
-
- private static boolean listedAvailableTemplatesOnNoSuchTemplate = false;
/** returns the jclouds Template which describes the image to be built, for the given config and compute service */
public Template buildTemplate(ComputeService computeService, ConfigBag config) {
@@ -1213,13 +1213,15 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
throw new IllegalStateException("Not authorized to access cloud "+this+" to resolve "+templateBuilder, e);
} catch (Exception e) {
try {
- synchronized (this) {
+ IOException ioe = Exceptions.getFirstThrowableOfType(e, IOException.class);
+ if (ioe != null) {
+ LOG.warn("IOException found...", ioe);
+ throw ioe;
+ }
+ if (listedAvailableTemplatesOnNoSuchTemplate.compareAndSet(false, true)) {
// delay subsequent log.warns (put in synch block) so the "Loading..." message is obvious
LOG.warn("Unable to match required VM template constraints "+templateBuilder+" when trying to provision VM in "+this+" (rethrowing): "+e);
- if (!listedAvailableTemplatesOnNoSuchTemplate) {
- listedAvailableTemplatesOnNoSuchTemplate = true;
- logAvailableTemplates(config);
- }
+ logAvailableTemplates(config);
}
} catch (Exception e2) {
LOG.warn("Error loading available images to report (following original error matching template which will be rethrown): "+e2, e2);
@@ -1502,8 +1504,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
* if this config key is not set, use a key `brooklyn_id_rsa` and `.pub` in `MGMT_BASE_DIR`,
* with permission 0600, creating it if necessary, and logging the fact that this was created.
*/
- if (!loggedSshKeysHint && !config.containsKey(PRIVATE_KEY_FILE)) {
- loggedSshKeysHint = true;
+ if (!config.containsKey(PRIVATE_KEY_FILE) && loggedSshKeysHint.compareAndSet(false, true)) {
LOG.info("Default SSH keys not found or not usable; will create new keys for each machine. "
+ "Create ~/.ssh/id_rsa or "
+ "set "+PRIVATE_KEY_FILE.getName()+" / "+PRIVATE_KEY_PASSPHRASE.getName()+" / "+PASSWORD.getName()+" "
[2/2] incubator-brooklyn git commit: This closes #671
Posted by gr...@apache.org.
This closes #671
* github/pr/671:
Remove shared statics causing issues in Clocker with more than one JcloudsLocation
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/5dd08aa1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/5dd08aa1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/5dd08aa1
Branch: refs/heads/master
Commit: 5dd08aa11cd613e6b0ccad0e19d6b5880f34141f
Parents: d16597c b34229f
Author: Andrew Kennedy <gr...@apache.org>
Authored: Wed Jun 3 01:01:56 2015 +0100
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Wed Jun 3 01:01:56 2015 +0100
----------------------------------------------------------------------
.../jclouds/ComputeServiceRegistryImpl.java | 1 -
.../location/jclouds/JcloudsLocation.java | 21 ++++++++++----------
2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5dd08aa1/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------