Build failed in Jenkins: brooklyn-master-windows #147

2016-06-10 Thread Apache Jenkins Server
See 

--
[...truncated 31022 lines...]
org.apache.brooklyn.camp.brooklyn.ConfigInheritanceYamlTest.tearDown(org.apache.brooklyn.camp.brooklyn.ConfigInheritanceYamlTest)
  Run 1: ConfigInheritanceYamlTest.tearDown:139 » FileSystem 
C:\Users\CHRIST~1\AppData\...
  Run 2: ConfigInheritanceYamlTest.tearDown:139 » FileSystem 
C:\Users\CHRIST~1\AppData\...
  Run 3: ConfigInheritanceYamlTest.tearDown:139 » FileSystem 
C:\Users\CHRIST~1\AppData\...
  Run 4: ConfigInheritanceYamlTest.tearDown:139 » FileSystem 
C:\Users\CHRIST~1\AppData\...
  Run 5: ConfigInheritanceYamlTest.tearDown:139 » FileSystem 
C:\Users\CHRIST~1\AppData\...
  Run 6: ConfigInheritanceYamlTest.tearDown:139 » FileSystem 
C:\Users\CHRIST~1\AppData\...
  Run 7: ConfigInheritanceYamlTest.tearDown:139 » FileSystem 
C:\Users\CHRIST~1\AppData\...


Tests run: 338, Failures: 1, Errors: 0, Skipped: 283

[JENKINS] Recording test results
[INFO] 
[INFO] Reactor Summary:
[INFO] 
[INFO] Brooklyn REST JavaScript Web GUI ... SUCCESS [ 49.303 s]
[INFO] Brooklyn Server Root ... SUCCESS [  0.270 s]
[INFO] Brooklyn Parent Project  SUCCESS [  5.824 s]
[INFO] Brooklyn Test Support Utilities  SUCCESS [  6.908 s]
[INFO] Brooklyn Logback Includable Configuration .. SUCCESS [  1.573 s]
[INFO] Brooklyn Common Utilities .. SUCCESS [ 26.923 s]
[INFO] Brooklyn API ... SUCCESS [  3.731 s]
[INFO] CAMP Server Parent Project . SUCCESS [  0.687 s]
[INFO] CAMP Base .. SUCCESS [  4.472 s]
[INFO] Brooklyn Test Support .. SUCCESS [  2.455 s]
[INFO] Brooklyn REST Swagger Apidoc Utilities . SUCCESS [  3.417 s]
[INFO] Brooklyn Logback Configuration . SUCCESS [  0.685 s]
[INFO] CAMP Server  SUCCESS [  8.364 s]
[INFO] Brooklyn Felix Runtime . SUCCESS [  4.474 s]
[INFO] Brooklyn Groovy Utilities .. SUCCESS [  1.456 s]
[INFO] Brooklyn Core .. SUCCESS [04:23 min]
[INFO] Brooklyn Policies .. SUCCESS [01:20 min]
[INFO] Brooklyn WinRM Software Entities ... SUCCESS [  9.609 s]
[INFO] Brooklyn Secure JMXMP Agent  SUCCESS [ 11.072 s]
[INFO] Brooklyn JMX RMI Agent . SUCCESS [  2.301 s]
[INFO] Brooklyn Jclouds Location Targets .. SUCCESS [ 25.916 s]
[INFO] Brooklyn Software Base . SUCCESS [01:26 min]
[INFO] Brooklyn CAMP REST API . FAILURE [ 53.771 s]
[INFO] Brooklyn Hazelcast Storage . SKIPPED
[INFO] Brooklyn Launcher Common ... SKIPPED
[INFO] Brooklyn REST API .. SKIPPED
[INFO] Brooklyn REST Resources  SKIPPED
[INFO] Brooklyn REST Server ... SKIPPED
[INFO] Brooklyn Launcher .. SKIPPED
[INFO] Brooklyn Command Line Interface  SKIPPED
[INFO] Brooklyn REST Client ... SKIPPED
[INFO] Brooklyn Test Framework  SKIPPED
[INFO] Brooklyn OSGi init . SKIPPED
[INFO] Brooklyn Karaf . SKIPPED
[INFO] Jetty config fragment .. SKIPPED
[INFO] Brooklyn Karaf Features  SKIPPED
[INFO] Brooklyn Karaf Shell Commands .. SKIPPED
[INFO] Brooklyn Karaf Distro .. SKIPPED
[INFO] Brooklyn Karaf pax-exam itest .. SKIPPED
[INFO] Brooklyn Library Root .. SKIPPED
[INFO] Brooklyn CM SaltStack .. SKIPPED
[INFO] Brooklyn CM Ansible  SKIPPED
[INFO] Brooklyn CM Integration Root ... SKIPPED
[INFO] Brooklyn Network Software Entities . SKIPPED
[INFO] Brooklyn OSGi Software Entities  SKIPPED
[INFO] Brooklyn Database Software Entities  SKIPPED
[INFO] Brooklyn Web App Software Entities . SKIPPED
[INFO] Brooklyn Messaging Software Entities ... SKIPPED
[INFO] Brooklyn NoSQL Data Store Software Entities  SKIPPED
[INFO] Brooklyn Monitoring Software Entities .. SKIPPED
[INFO] Brooklyn QA  SKIPPED
[INFO] Brooklyn Examples Aggregator Project ... SKIPPED
[INFO] Brooklyn Examples Aggregator Project - Webapps . SKIPPED

[GitHub] brooklyn-server pull request #194: Prevents premature resolving of external ...

2016-06-10 Thread ahgittin
Github user ahgittin commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/194#discussion_r66627553
  
--- Diff: 
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlTest.java
 ---
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.camp.brooklyn;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+import java.io.StringReader;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.location.Location;
+import 
org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplier;
+import 
org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplierWithoutMapArg;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.StartableApplication;
+import org.apache.brooklyn.core.internal.BrooklynProperties;
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
+import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
+import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
+import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.util.core.internal.ssh.SshTool;
+import org.apache.brooklyn.util.core.task.DeferredSupplier;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+
+// also see ExternalConfigYamlTest
+public class JcloudsLocationExternalConfigYamlTest extends 
AbstractYamlRebindTest {
+
+private static final Logger log = 
LoggerFactory.getLogger(ExternalConfigYamlTest.class);
+
+private static final ConfigKey MY_CONFIG_KEY = 
ConfigKeys.newStringConfigKey("my.config.key");
+
+/** @return A started management context */
+protected LocalManagementContext createOrigManagementContext() {
+return RebindTestUtils.managementContextBuilder(mementoDir, 
classLoader)
+.properties(externalProps())
+.persistPeriodMillis(getPersistPeriodMillis())
+.forLive(useLiveManagementContext())
+.emptyCatalog(useEmptyCatalog())
+.buildStarted();
+}
+
+/** @return An unstarted management context using the specified 
mementoDir (or default if null) */
+protected LocalManagementContext createNewManagementContext(File 
mementoDir) {
+if (mementoDir==null) mementoDir = this.mementoDir;
+return RebindTestUtils.managementContextBuilder(mementoDir, 
classLoader)
+.properties(externalProps())
+.forLive(useLiveManagementContext())
+.emptyCatalog(useEmptyCatalog())
+.buildUnstarted();
+}
+
+private BrooklynProperties externalProps() {
+BrooklynProperties props = BrooklynProperties.Factory.newDefault();
+props.put("brooklyn.external.myprovider", 
MyExternalConfigSupplier.class.getName());
+props.put("brooklyn.external.myprovider.mykey", "myval");
+props.put("brooklyn.external.myproviderWithoutMapArg", 
MyExternalConfigSupplierWithoutMapArg.class.getName());
+return props;
+}
+
+@Test(groups="Live")
+public void testJcloudsInheritanceAndPasswordSecret() throws Exception 
{
+String yaml = Joiner.on("\n").join(
+"services:",
+"- type: "+EmptySoftwareProcess.class.getName(),
+"location:",
+"  jclouds:aws-ec2:",
+"password: $brooklyn:external(\"myprovider\", 

[GitHub] brooklyn-server issue #194: Prevents premature resolving of external config

2016-06-10 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/194
  
LGTM, minor comments, including test and naming

let's give it a day for @aledsage @andreaturli @neykov to comment on 
names/future and see whether to do in this PR but happy to merge as is


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #194: Prevents premature resolving of external ...

2016-06-10 Thread ahgittin
Github user ahgittin commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/194#discussion_r66627723
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/util/core/config/ConfigBag.java ---
@@ -367,6 +367,22 @@ public Object getStringKey(String key) {
 }
 }
 
+/** Puts into this bag the raw value for the given key in the given 
bag, if it was present. */
+@Beta
+public  ConfigBag copyRaw(ConfigBag source, ConfigKey key) {
--- End diff --

this is the significant api addition

it feels right to me but wdyt @aledsage ?

also @nakomis we should probably add a test for this


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #194: Prevents premature resolving of external ...

2016-06-10 Thread ahgittin
Github user ahgittin commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/194#discussion_r66626931
  
--- Diff: 
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlTest.java
 ---
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.camp.brooklyn;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+import java.io.StringReader;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.location.Location;
+import 
org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplier;
+import 
org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplierWithoutMapArg;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.StartableApplication;
+import org.apache.brooklyn.core.internal.BrooklynProperties;
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
+import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
+import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
+import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.util.core.internal.ssh.SshTool;
+import org.apache.brooklyn.util.core.task.DeferredSupplier;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+
+// also see ExternalConfigYamlTest
+public class JcloudsLocationExternalConfigYamlTest extends 
AbstractYamlRebindTest {
+
+private static final Logger log = 
LoggerFactory.getLogger(ExternalConfigYamlTest.class);
+
+private static final ConfigKey MY_CONFIG_KEY = 
ConfigKeys.newStringConfigKey("my.config.key");
+
+/** @return A started management context */
+protected LocalManagementContext createOrigManagementContext() {
--- End diff --

i think in 0.10.0-SNAPSHOT the superclass has a 
`createBrooklynProperties()` method you could extend instead, removing the 
`create*ManagementContext(...)` overrides


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #195: Sanitize effector parameters when reporting an e...

2016-06-10 Thread ygy
Github user ygy commented on the issue:

https://github.com/apache/brooklyn-server/pull/195
  
LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread neykov
Github user neykov commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66622693
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,402 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if 'sensors' is not specified, defaults to 
'mapMatching'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if 'sensors' is not specified, defaults to matching 
case-insensitive suffix of "
++ "'port', 'uri', 'url', 'endpoint' or 'hostAndPort'",
+"(?i)(.+\\.)?(port|uri|url|endpoint|hostandport)");
+
+@SuppressWarnings("serial")
+public static ConfigKey 
SENSOR_NAME_CONVERTER = ConfigKeys.newConfigKey(
+new TypeToken() {},
+"sensorNameConverter",
+"The converter to use, to map from the original sensor name to 
the re-published sensor name");
+
+public static class SensorNameConverter implements Function {
+private final String network;
+
+public SensorNameConverter(String network) {
+this.network = network;
+}
+
+@Override
+public String apply(String input) {
+if (input == null) throw new NullPointerException("Sensor name 
must not be null");
+String lowerInput = input.toLowerCase();
+if (lowerInput.endsWith("uri")) {
+

[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread neykov
Github user neykov commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66622079
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
--- End diff --

It does, but that rules out sensors like `httpPort` which are used in the 
wild. Perhaps we should standardize on the sensor naming instead.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #195: Sanitize effector parameters when reporti...

2016-06-10 Thread bostko
GitHub user bostko opened a pull request:

https://github.com/apache/brooklyn-server/pull/195

Sanitize effector parameters when reporting an exception



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/bostko/brooklyn-server 
effector_utils_sanitize_logs

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/195.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #195


commit 3c0c8af2d591b6026945dd112f55450dbc752947
Author: Valentin Aitken 
Date:   2016-06-10T14:25:46Z

Sanitize effector parameters when reporting an exception




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-server/pull/192


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread aledsage
Github user aledsage commented on the issue:

https://github.com/apache/brooklyn-server/pull/192
  
Thanks all - merging now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66616715
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
+
+@SuppressWarnings("serial")
+public static ConfigKey 
SENSOR_NAME_CONVERTER = ConfigKeys.newConfigKey(
+new TypeToken() {},
+"sensorNameConverter",
+"The converter to use, to map from the original sensor name to 
the re-published sensor name");
+
+public static class SensorNameConverter implements Function {
+private final String network;
+
+public 

[GitHub] brooklyn-server issue #194: Prevents premature resolving of external config

2016-06-10 Thread nakomis
Github user nakomis commented on the issue:

https://github.com/apache/brooklyn-server/pull/194
  
This is in addition to the changes in 
https://github.com/apache/brooklyn-server/pull/193


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #194: Prevents premature resolving of external ...

2016-06-10 Thread nakomis
GitHub user nakomis opened a pull request:

https://github.com/apache/brooklyn-server/pull/194

Prevents premature resolving of external config

If external config is resolved too early, it can lead to resolved values 
being persisted (security flaw). Also, changes to the external config supplier 
are not reflected when the config is subsequently read

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/nakomis/brooklyn-server fix/external-config

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/194.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #194


commit 9185b32e94fa396b8648096309a3fa8c92bd5c4a
Author: Martin Harris 
Date:   2016-06-10T13:21:40Z

Prevents premature resolving of external config




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66601272
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
--- End diff --

@geomacy yes, you're right. I checked what we're doing elsewhere and it 
does assume a ".port" suffix:

https://github.com/apache/brooklyn-server/blob/rel/apache-brooklyn-0.9.0/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcess.java#L59-L61

https://github.com/apache/brooklyn-server/blob/rel/apache-brooklyn-0.9.0/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L76-L96


---
If your project is set 

[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66600767
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
+
+@SuppressWarnings("serial")
+public static ConfigKey 
SENSOR_NAME_CONVERTER = ConfigKeys.newConfigKey(
+new TypeToken() {},
+"sensorNameConverter",
+"The converter to use, to map from the original sensor name to 
the re-published sensor name");
+
+public static class SensorNameConverter implements Function {
+private final String network;
+
+public 

[jira] [Commented] (BROOKLYN-298) sshj hangs (waiting for shell to finish) after script completed - maybe VPN went down+up during exec

2016-06-10 Thread Svetoslav Neykov (JIRA)

[ 
https://issues.apache.org/jira/browse/BROOKLYN-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15324327#comment-15324327
 ] 

Svetoslav Neykov commented on BROOKLYN-298:
---

Adding a keep-alive should detect this.
http://stackoverflow.com/questions/10351484/how-to-keep-ssh-connections-alive-using-sshj

> sshj hangs (waiting for shell to finish) after script completed - maybe VPN 
> went down+up during exec
> 
>
> Key: BROOKLYN-298
> URL: https://issues.apache.org/jira/browse/BROOKLYN-298
> Project: Brooklyn
>  Issue Type: Bug
>Affects Versions: 0.9.0
>Reporter: Aled Sage
>
> I was deploying an app whose launch command started docker and pulled an 
> image. The task hung, showing in the web-console:
> {noformat}
> In progress - SSH executing, launching 
> VanillaSoftwareProcessImpl{id=nisq2gz4yi}
> {noformat}
> I believe this is because my VPN disconnected and then reconnected, and our 
> sshj command keeps waiting for the result - even though the command has 
> finished executing.
> Looking at the target VM, the command has completed (and the script uploaded 
> by SshjTool has been deleted). There is no evidence of any Brooklyn-initiated 
> commands executing, according to {{ps aux}}.
> Drilling into the activity view in the Brooklyn web-console, the currently 
> executing thread shows:
> {noformat}
> SSH executing, launching VanillaSoftwareProcessImpl{id=nisq2gz4yi}
> Task[ssh: launching VanillaSoftwareProcessImpl{id=nisq2gz4yi}]@TPnVc8Qs
> Submitted by SoftlyPresent[value=Task[launch (main)]@mvL4OvdH]
> In progress, thread waiting (timed) on 
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@408df99d
> At: net.schmizz.concurrent.Promise.tryRetrieve(Promise.java:168)
> net.schmizz.concurrent.Promise.retrieve(Promise.java:137)
> net.schmizz.concurrent.Event.await(Event.java:103)
> 
> net.schmizz.sshj.connection.channel.AbstractChannel.join(AbstractChannel.java:282)
> 
> org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$ShellAction.create(SshjTool.java:1012)
> 
> org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$ShellAction.create(SshjTool.java:925)
> 
> org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.acquire(SshjTool.java:630)
> 
> org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.acquire(SshjTool.java:616)
> 
> org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$1.run(SshjTool.java:331)
> 
> org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.execScript(SshjTool.java:326)
> 
> org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers$1.exec(ExecWithLoggingHelpers.java:82)
> 
> org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers$3.apply(ExecWithLoggingHelpers.java:166)
> 
> org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers$3.apply(ExecWithLoggingHelpers.java:164)
> org.apache.brooklyn.util.pool.BasicPool.exec(BasicPool.java:146)
> 
> org.apache.brooklyn.location.ssh.SshMachineLocation.execSsh(SshMachineLocation.java:611)
> 
> org.apache.brooklyn.location.ssh.SshMachineLocation$13.execWithTool(SshMachineLocation.java:790)
> 
> org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers.execWithLogging(ExecWithLoggingHelpers.java:164)
> 
> org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers.execScript(ExecWithLoggingHelpers.java:80)
> 
> org.apache.brooklyn.location.ssh.SshMachineLocation.execScript(SshMachineLocation.java:774)
> 
> org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver.execute(AbstractSoftwareProcessSshDriver.java:272)
> 
> org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper.executeInternal(ScriptHelper.java:366)
> 
> org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper$8.call(ScriptHelper.java:287)
> 
> org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper$8.call(ScriptHelper.java:285)
> 
> org.apache.brooklyn.util.core.task.DynamicSequentialTask$DstJob.call(DynamicSequentialTask.java:359)
> 
> org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:519)
> {noformat}
> Running {{netstat -antp TCP}} on my local machine, I still see an established 
> ssh connection:
> {noformat}
> tcp4   0  0  10.104.3.10.54535  10.104.1.193.22ESTABLISHED
> {noformat}
> I do *not* see a corresponding entry when I run {{sudo netsat -anp}} on the 
> target VM.
> ---
> Looking in the Brooklyn code at {{SshjTool$ShellAction.create}}, I wonder 
> what else we could call on sshj to check if our connection is ok and/or the 
> command has actually completed. We are already calling {{shell.isOpen()}} and 

[GitHub] brooklyn-server issue #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread geomacy
Github user geomacy commented on the issue:

https://github.com/apache/brooklyn-server/pull/192
  
Couple of minor questions and comments but none that *need* done,  looks 
good to me.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Created] (BROOKLYN-298) sshj hangs (waiting for shell to finish) after script completed - maybe VPN went down+up during exec

2016-06-10 Thread Aled Sage (JIRA)
Aled Sage created BROOKLYN-298:
--

 Summary: sshj hangs (waiting for shell to finish) after script 
completed - maybe VPN went down+up during exec
 Key: BROOKLYN-298
 URL: https://issues.apache.org/jira/browse/BROOKLYN-298
 Project: Brooklyn
  Issue Type: Bug
Affects Versions: 0.9.0
Reporter: Aled Sage


I was deploying an app whose launch command started docker and pulled an image. 
The task hung, showing in the web-console:

{noformat}
In progress - SSH executing, launching VanillaSoftwareProcessImpl{id=nisq2gz4yi}
{noformat}

I believe this is because my VPN disconnected and then reconnected, and our 
sshj command keeps waiting for the result - even though the command has 
finished executing.

Looking at the target VM, the command has completed (and the script uploaded by 
SshjTool has been deleted). There is no evidence of any Brooklyn-initiated 
commands executing, according to {{ps aux}}.

Drilling into the activity view in the Brooklyn web-console, the currently 
executing thread shows:

{noformat}
SSH executing, launching VanillaSoftwareProcessImpl{id=nisq2gz4yi}

Task[ssh: launching VanillaSoftwareProcessImpl{id=nisq2gz4yi}]@TPnVc8Qs
Submitted by SoftlyPresent[value=Task[launch (main)]@mvL4OvdH]

In progress, thread waiting (timed) on 
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@408df99d
At: net.schmizz.concurrent.Promise.tryRetrieve(Promise.java:168)
net.schmizz.concurrent.Promise.retrieve(Promise.java:137)
net.schmizz.concurrent.Event.await(Event.java:103)

net.schmizz.sshj.connection.channel.AbstractChannel.join(AbstractChannel.java:282)

org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$ShellAction.create(SshjTool.java:1012)

org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$ShellAction.create(SshjTool.java:925)

org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.acquire(SshjTool.java:630)

org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.acquire(SshjTool.java:616)

org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$1.run(SshjTool.java:331)

org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.execScript(SshjTool.java:326)

org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers$1.exec(ExecWithLoggingHelpers.java:82)

org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers$3.apply(ExecWithLoggingHelpers.java:166)

org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers$3.apply(ExecWithLoggingHelpers.java:164)
org.apache.brooklyn.util.pool.BasicPool.exec(BasicPool.java:146)

org.apache.brooklyn.location.ssh.SshMachineLocation.execSsh(SshMachineLocation.java:611)

org.apache.brooklyn.location.ssh.SshMachineLocation$13.execWithTool(SshMachineLocation.java:790)

org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers.execWithLogging(ExecWithLoggingHelpers.java:164)

org.apache.brooklyn.util.core.task.system.internal.ExecWithLoggingHelpers.execScript(ExecWithLoggingHelpers.java:80)

org.apache.brooklyn.location.ssh.SshMachineLocation.execScript(SshMachineLocation.java:774)

org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver.execute(AbstractSoftwareProcessSshDriver.java:272)

org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper.executeInternal(ScriptHelper.java:366)

org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper$8.call(ScriptHelper.java:287)

org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper$8.call(ScriptHelper.java:285)

org.apache.brooklyn.util.core.task.DynamicSequentialTask$DstJob.call(DynamicSequentialTask.java:359)

org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:519)
{noformat}

Running {{netstat -antp TCP}} on my local machine, I still see an established 
ssh connection:

{noformat}
tcp4   0  0  10.104.3.10.54535  10.104.1.193.22ESTABLISHED
{noformat}

I do *not* see a corresponding entry when I run {{sudo netsat -anp}} on the 
target VM.

---
Looking in the Brooklyn code at {{SshjTool$ShellAction.create}}, I wonder what 
else we could call on sshj to check if our connection is ok and/or the command 
has actually completed. We are already calling {{shell.isOpen()}} and 
{{session.getExitStatus()!=null}}. We could add calls to {{session.isOpen()}}, 
{{session.getExitSignal()}} and/or {{session.getExitWasCoreDumped()}}.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66598970
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
--- End diff --

Although that then won't match xyz.HostAndPort.  Hm. Would it be worth 
checking for that suffix explicitly?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66596473
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
+
+@SuppressWarnings("serial")
+public static ConfigKey 
SENSOR_NAME_CONVERTER = ConfigKeys.newConfigKey(
+new TypeToken() {},
+"sensorNameConverter",
+"The converter to use, to map from the original sensor name to 
the re-published sensor name");
+
+public static class SensorNameConverter implements Function {
+private final String network;
+
+public 

[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66594543
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
+
+@SuppressWarnings("serial")
+public static ConfigKey 
SENSOR_NAME_CONVERTER = ConfigKeys.newConfigKey(
+new TypeToken() {},
+"sensorNameConverter",
+"The converter to use, to map from the original sensor name to 
the re-published sensor name");
+
+public static class SensorNameConverter implements Function {
+private final String network;
+
+public 

[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66594302
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
--- End diff --

Maybe worth adding an explicit "." in front of the port|uri|url|endpoint?   
 Just in case e.g. "port" would unintentionally match a sensor called 
xyz_export or something?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with 

[GitHub] brooklyn-server issue #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/192
  
Couple of comments then LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66592324
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
--- End diff --

why have SENSOR and SENORS?
Would it not be simpler to just have SENSORS? If someone only wants one 
sensor to be mapped they can configure SENSORS with one entry.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #192: Adds OnSubnetNetworkEnricher

2016-06-10 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/192#discussion_r66591368
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/network/AbstractOnNetworkEnricher.java
 ---
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.brooklyn.core.network;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.enricher.AbstractEnricher;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.location.Machines;
+import org.apache.brooklyn.core.location.access.PortForwardManager;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.net.Networking;
+import org.apache.brooklyn.util.text.StringPredicates;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Lists;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+
+@Beta
+public abstract class AbstractOnNetworkEnricher extends AbstractEnricher {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractOnNetworkEnricher.class);
+
+@SuppressWarnings("serial")
+public static final ConfigKey SENSOR = 
ConfigKeys.newConfigKey(
+new TypeToken() {}, 
+"sensor",
+"The sensor whose mapped value is to be re-published (with 
suffix \"mapped.networkName\"); "
++ "either 'sensor' or 'sensors' should be specified");
+
+@SuppressWarnings("serial")
+public static ConfigKey> 
SENSORS = ConfigKeys.newConfigKey(
+new TypeToken>() {}, 
+"sensors",
+"The multiple sensors whose mapped values are to be 
re-published (with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to 'mapAll'");
+
+public static ConfigKey MAP_MATCHING = 
ConfigKeys.newStringConfigKey(
+"mapMatching",
+"Whether to map all, based on a sensor naming convention 
(re-published with suffix \"mapped.networkName\"); "
++ "if neither 'sensor' or 'sensors' is specified, 
defaults to matchin case-insensitive suffix of "
++ "'port', 'uri', 'url' or 'endpoint' ",
+"(?i).*(port|uri|url|endpoint)");
+
+@SuppressWarnings("serial")
+public static ConfigKey 
SENSOR_NAME_CONVERTER = ConfigKeys.newConfigKey(
+new TypeToken() {},
+"sensorNameConverter",
+"The converter to use, to map from the original sensor name to 
the re-published sensor name");
+
+public static class SensorNameConverter implements Function {
+private final String network;
+
+public 

[GitHub] brooklyn-docs pull request #77: Machine naming in locations

2016-06-10 Thread drigodwin
GitHub user drigodwin opened a pull request:

https://github.com/apache/brooklyn-docs/pull/77

Machine naming in locations

Added instructions to give a custom name to VMs in a location

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/drigodwin/brooklyn-docs machine-name

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-docs/pull/77.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #77


commit 0ab362c1bdf009dfa7795cba75e0fe90979a37a0
Author: Duncan Godwin 
Date:   2016-06-10T10:03:22Z

Added machine naming in locations




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-dist pull request #37: Generate ssh keys for the brooklyn host

2016-06-10 Thread andreaturli
GitHub user andreaturli opened a pull request:

https://github.com/apache/brooklyn-dist/pull/37

Generate ssh keys for the brooklyn host



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/andreaturli/brooklyn-dist patch-1

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-dist/pull/37.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #37


commit 869813aae4c135f1964807365de531c1d16bf57c
Author: Andrea Turli 
Date:   2016-06-10T09:19:01Z

Generate ssh keys for the brooklyn host




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #150: Ability to perform installation on a Wind...

2016-06-10 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/150#discussion_r66581776
  
--- Diff: 
software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/WinRmTool.java
 ---
@@ -46,7 +46,7 @@
 ConfigKey PROP_HOST = newStringConfigKey("host", "Host to 
connect to (required)", null);
 ConfigKey PROP_PORT = ConfigKeys.newIntegerConfigKey("port", 
"WinRM port to use when connecting to the remote machine");
 ConfigKey USE_HTTPS_WINRM = 
ConfigKeys.newBooleanConfigKey("winrm.useHttps", "The parameter tells the 
machine sensors whether the winrm port is over https. If the parameter is true 
then 5986 will be used as a winrm port.", false);
-ConfigKey RETRIES_OF_NETWORK_FAILURES = 
ConfigKeys.newIntegerConfigKey("retriesOfNetworkFailures", "The parameter sets 
the number of retries for connection failures. If you use high value, consider 
taking care for the machine's network.");
+ConfigKey RETRIES_OF_NETWORK_FAILURES = 
ConfigKeys.newIntegerConfigKey("retriesOfNetworkFailures", "The parameter sets 
the number of retries for connection failures. If you use high value, consider 
taking care for the machine's network.", 4);
--- End diff --

For the record, it looks like this used to default to 16 in winrm4j, if no 
value was passed in by Brooklyn: 
https://github.com/cloudsoft/winrm4j/blob/0.3.5/client/src/main/java/io/cloudsoft/winrm4j/client/WinRmClient.java#L581


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #150: Ability to perform installation on a Wind...

2016-06-10 Thread bostko
Github user bostko commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/150#discussion_r66580748
  
--- Diff: 
software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
 ---
@@ -49,15 +50,27 @@ public void start() {
 
 @Override
 public void install() {
+// TODO: At some point in the future, this should probably be 
refactored to get the name of the machine in WinRmMachineLocation and set it as 
the hostname sensor
+String hostname = null;
+if 
(entity.getConfig(VanillaWindowsProcess.INSTALL_REBOOT_REQUIRED)) {
+WinRmExecuteHelper checkHostnameTask = newScript("Checking 
hostname")
--- End diff --

Actually  AD blueprint doesn't change the Computer Name, it is changing the 
`%UserDnsDomain%` and `%USERDOMAIN%` which breaks the default authentication 
where we supply only Windows username without any computer name.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #150: Ability to perform installation on a Wind...

2016-06-10 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/150#discussion_r66579605
  
--- Diff: 
software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
 ---
@@ -49,15 +50,27 @@ public void start() {
 
 @Override
 public void install() {
+// TODO: At some point in the future, this should probably be 
refactored to get the name of the machine in WinRmMachineLocation and set it as 
the hostname sensor
+String hostname = null;
+if 
(entity.getConfig(VanillaWindowsProcess.INSTALL_REBOOT_REQUIRED)) {
+WinRmExecuteHelper checkHostnameTask = newScript("Checking 
hostname")
--- End diff --

@bostko @nakomis why do we retrieve this *before* executing the install 
command?

My understanding is that we added the hostname lookup to handle "Ability to 
perform installation on a Windows Blueprint which changes Computer Name and 
requires reboot." What will change the Computer Name? Do we expect it to be the 
"install.command"? If so, surely we should retrieve the hostname *after* 
executing the install command?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #66: Windows - Advices for blueprints that are us...

2016-06-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-docs/pull/66


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---