[GitHub] brooklyn-server issue #908: Added a DashboardAggregator

2017-12-06 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/908
  
test failure fixed, only thing left to decide is whether this is the 
correct place or not


---


[GitHub] brooklyn-server pull request #908: Added a DashboardAggregator

2017-12-05 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Added a DashboardAggregator

Added a DashboardAggregator. This aggregator will pull together dashboard 
sensors from it's children and merge them together. This however, does not 
touch the owner or environment sensors as there is no good way to aggregate 
them.

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
add_dashboard_aggregator

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

https://github.com/apache/brooklyn-server/pull/908.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 #908


commit 972ae5c6fa562adc2a09de7954f4e41bfe50024a
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-12-05T11:53:00Z

Added a DashboardAggregator




---


Re: Brooklyn REST API - omitting fields in JSON objects

2017-11-08 Thread Graeme Miller
Hello,

I agree with Thomas here. This seems like an API breaking change, and
should be reserved for V2 if it at all.
I lean towards reverting.

Regards,
Graeme

On 8 November 2017 at 10:01, Thomas Bouron 
wrote:

> Hi all.
>
> I'm not a fan of excluding fields from the JSON payload, if empty, for few
> reasons:
> 1. this is a breaking change for the UI and CLI which will be time
> consuming to fix (very fiddly to guard against this in JS for example)
> 2. this makes it harder to design clients, because you need to guard
> against the presence of those fields. The swagger page displays all fields
> leading the user/dev to think that they are always returned in the payload
> 3. I don't think it saves bandwidth to remove a `constraints: []` from the
> final JSON. If you want to have a smaller payload, I would much prefer to
> set a query string flag to restrict (or expand) the full body, something
> like `?summary=true` => returns only necessary information.
>
> Now, my comments apply for the API endpoints under /v1 only. I'm all in
> favour of break things with a v2 API though.
>
> Best.
>
> On Mon, 6 Nov 2017 at 15:17 Alex Heneveld  >
> wrote:
>
> >
> > Hi All-
> >
> > Until recently our REST API returned full records in most cases,
> > including often lots of empty lists and maps and sometimes nulls -- such
> > as `constraints: []` on all config keys.
> >
> > The widespread preference in REST / JSON community seems to be to omit
> > these unless there is a very good reason for having them, e.g. Google
> > JSON Style Guide [1].
> >
> > Recently in replacing deprecated FasterXML annotations with newer ones
> > many fields were changed to be included only if NON_EMPTY, in line with
> > that preference, but this is technically a breaking change.  And it's
> > not just technical, as there are a few places in UI code which assume
> > fields exist which now do break.  These are easy to fix once they're
> > encountered at runtime but tedious to ensure no problems at design time.
> >
> > Thus we have two choices:
> >
> > * Yes, make this break now.  This (v1.0) is probably the best time.
> > There is no efficient way to pass this through a deprecation cycle. Cost
> > is adding to release nodes and REST API client breakages and fixes.
> > * No, revert any `Include(NON_EMPTY)` annotations recently introduced to
> > be strict about backwards-compatibility here.  Cost is restoring old
> > behaviour and bloat/ugliness in the API response objects.
> >
> > I have a preference for "Yes", roll-forward and tolerate some breakages
> > with the shift to 1.0.
> >
> > Best
> > Alex
> >
> >
> > [1]
> >
> > https://google.github.io/styleguide/jsoncstyleguide.
> xml#Empty/Null_Property_Values
> >
> > --
>
> Thomas Bouron • Senior Software Engineer @ Cloudsoft Corporation •
> https://cloudsoft.io/
> Github: https://github.com/tbouron
> Twitter: https://twitter.com/eltibouron
>


[GitHub] brooklyn-server pull request #884: Add brooklyn-cli as a feature to karaf

2017-11-07 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Add brooklyn-cli as a feature to karaf

https://github.com/apache/brooklyn-server/pull/882 added brooklyn-cli to a 
catalog.bom. This causes brooklyn to fail to start, as karaf can't find 
brooklyn-cli. This PR adds brooklyn-cli to karaf

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
add_brooklyn_cli_feature

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

https://github.com/apache/brooklyn-server/pull/884.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 #884


commit a2570d8b0a462e94410e2b2f5eab29b56100a0c5
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-11-07T21:17:22Z

Add brooklyn-cli as a feature to karaf




---


[GitHub] brooklyn-library pull request #139: Update visitors-creation-script.sql

2017-11-06 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

https://github.com/apache/brooklyn-library/pull/139

Update visitors-creation-script.sql

Need all privileges for three tier app

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

$ git pull https://github.com/Graeme-Miller/brooklyn-library patch-3

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

https://github.com/apache/brooklyn-library/pull/139.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 #139


commit 5a8b1f288b47878d0d89dbbaf35ad7eae42d71c9
Author: Graeme-Miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-11-06T16:51:43Z

Update visitors-creation-script.sql




---


[GitHub] brooklyn-library pull request #136: Fix Library Feature File

2017-11-01 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

https://github.com/apache/brooklyn-library/pull/136

Fix Library Feature File

**Issue**
When building Brooklyn karaf, brooklyn-library-catalog is not included in 
the system folder. This means that on startup Karaf goes to a remote repository 
(sonatype) or local maven cache to retrieve it. A separate PR will be created 
to stop Brooklyn from using remote repos.

**Fix**
Update the feature brooklyn-library-all such that it contains a reference 
to the brooklyn-library-catalog bundle. This means that when building Brooklyn, 
brooklyn-library-catalog is included in the systems folder.

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

$ git pull https://github.com/Graeme-Miller/brooklyn-library 
add_brooklyn_lib_to_feature

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

https://github.com/apache/brooklyn-library/pull/136.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 #136


commit 4e9f0c80a62e5ba2c62cacf1cd4a23ef7eb804d3
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-11-01T11:36:06Z

add org.apache.brooklyn/brooklyn-library-catalog to the feature file




---


[GitHub] brooklyn-server pull request #869: Reverted code for selecting subnet hostna...

2017-10-27 Thread Graeme-Miller
Github user Graeme-Miller closed the pull request at:

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


---


[GitHub] brooklyn-server issue #869: Reverted code for selecting subnet hostname for ...

2017-10-27 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/869
  
Spoke to @aledsage and we have agreed reverting #849 is the way to go. I 
have created #871 to do this


---


[GitHub] brooklyn-server pull request #871: Revert "Retrieve the right AWS metadata f...

2017-10-27 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Revert "Retrieve the right AWS metadata for private hostname"

This reverts commit 8877368aa4c04e21eecd167538f878c4e0681900.

Please see discussion on this PR: 
https://github.com/apache/brooklyn-server/pull/869

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
revert_subnet_hostname

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

https://github.com/apache/brooklyn-server/pull/871.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 #871


commit 2fb23337d48611a5cf9deb061cbd29f7b7137718
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-10-27T12:18:57Z

Revert "Retrieve the right AWS metadata for private hostname"

This reverts commit 8877368aa4c04e21eecd167538f878c4e0681900.




---


[GitHub] brooklyn-server issue #869: Reverted code for selecting subnet hostname for ...

2017-10-26 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/869
  
@aledsage did a quick investigation and it looks like you are right.
In AMP 4.8, our main.uri (which is highlighted in the UI) would be based 
off of the host.subnet.hostname so would be publicly accessible.

With the change in https://github.com/apache/brooklyn-server/pull/849 
host.subnet.hostname would be populated correctly, and would not be publicly 
accessible. 

I am happy to close this PR and revert 
https://github.com/apache/brooklyn-server/pull/849 if you think that is the 
right route?



---


[GitHub] brooklyn-server pull request #869: Reverted code for selecting subnet hostna...

2017-10-25 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Reverted code for selecting subnet hostname for non aws clouds

A change was made to how Brooklyn retrieves the subnet hostname in 
https://github.com/apache/brooklyn-server/pull/849.

The intention of that PR was to remove AWS specific functionality, but 
instead it affected all clouds as it moved all clouds to using 
```node.getHostname()```. This functionality cant be relied on for a number of 
clouds. Openstack, for instance, were getting subnet hostnames like 
'qa-tomcat-ser-lc5dhz8sm3-b80' which do not work. Other affected clouds include 
Azure and Softlayer.

This PR changes the code back to before 849, whilst still removing the AWS 
specific functionality. However, when testing this code, I discovered that for 
most clouds we do not actually get a subnet hostname. Instead we use the subnet 
IP. It's only really AWS that would get a subnet hostname as it uses the AWS 
specific code. If people prefer, we can simply revert 
https://github.com/apache/brooklyn-server/pull/849 instead.

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
fix_subnet_hostname

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

https://github.com/apache/brooklyn-server/pull/869.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 #869


commit 9872e1082e043fd5157c39a2ea6a2dc1e8e37d0e
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-10-24T14:57:54Z

Reverted code for selecting subnet hostname for non aws clouds




---


[GitHub] brooklyn-server issue #869: Reverted code for selecting subnet hostname for ...

2017-10-25 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/869
  
@tbouron  and @andreaturli  it would be good to get your opinion on this.


---


Re: [PROPOSAL] Delete "classic-mode" (always use Karaf)

2017-10-09 Thread Graeme Miller
+1

On 9 October 2017 at 12:56, Thomas Bouron 
wrote:

> +1
>
> On Mon, 9 Oct 2017 at 12:39 Geoff Macartney 
> wrote:
>
> > +1
> >
> > On Mon, 9 Oct 2017 at 12:38 Duncan Godwin  com>
> > wrote:
> >
> > > +1
> > >
> > > On 9 October 2017 at 12:24, Richard Downer  wrote:
> > >
> > > > I offer my opinion through the medium of GIFs:
> > > >
> > > > https://media.giphy.com/media/vohOR29F78sGk/giphy.gif
> > > >
> > > > Richard.
> > > >
> > > >
> > > > On 9 October 2017 at 12:13, Aled Sage  wrote:
> > > >
> > > > > Hi all,
> > > > >
> > > > > I propose that we *delete* Brooklyn classic-mode from master now,
> in
> > > > > preparation for the 1.0.0 release.
> > > > >
> > > > > ---
> > > > >
> > > > > In 0.12.0, we switched the main distro to be the karaf-mode. We
> also
> > > > built
> > > > > the classic-mode distro - the intent being for users to have a
> usable
> > > > > classic mode, rather than being forced immediately to switch to
> karaf
> > > > > without advanced warning.
> > > > >
> > > > > However, we unfortunately did not deprecate classic-mode as clearly
> > as
> > > we
> > > > > should have (e.g. didn't explicitly say that it will be deleted in
> an
> > > > > upcoming release, and didn't deprecate the `Main` class).
> > > > >
> > > > > I think it's still ok to delete it for several reasons:
> > > > >
> > > > > 1. This is a "mode" of running Brooklyn, rather than underlying
> > > > >Brooklyn functionality.
> > > > > 2. The `Main` class [1] etc should not be considered part of our
> > > > >*public* API (even though we didn't explicitly tell people that
> it
> > > > >was internal).
> > > > > 3. As part of 0.12.0 release, we added to the docs instructions for
> > > > >upgrading to Karaf [2].
> > > > > 4. Supporting classic to the same standard as Karaf will become
> > > > >increasingly painful as we do more and more with Bundles!
> > > > > 5. It's a major release, so if we are going to delete it then 1.0.0
> > is
> > > > >the perfect time!
> > > > >
> > > > > Aled
> > > > >
> > > > > [1] https://github.com/apache/brooklyn-server/blob/master/server
> > > > > -cli/src/main/java/org/apache/brooklyn/cli/Main.java
> > > > >
> > > > > [2] http://brooklyn.apache.org/v/0.12.0/ops/upgrade.html#upgrade
> > > > > -from-apache-brooklyn-0110-and-below
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> --
>
> Thomas Bouron • Senior Software Engineer @ Cloudsoft Corporation •
> https://cloudsoft.io/
> Github: https://github.com/tbouron
> Twitter: https://twitter.com/eltibouron
>


[GitHub] brooklyn-server pull request #848: Fix for NPE in BasicBrooklynCatalog

2017-09-29 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Fix for NPE in BasicBrooklynCatalog

When adding a catalog item, through an exception if there is no 
brooklyn.catalog in the YAML

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
exception_when_no_metadata

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

https://github.com/apache/brooklyn-server/pull/848.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 #848


commit 1da2de97b1dfb6f56e43c20875bfec448c7749f0
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-09-29T15:36:14Z

When adding a catlog item, throw an exception if there is no 
brooklyn.catalog in the YAML




---


[GitHub] brooklyn-server pull request #845: Fix BasicBrooklynCatalog create Spec

2017-09-25 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Fix BasicBrooklynCatalog create Spec

If the BasicBrooklynCatalog fails to load a catalog item, it will now fall 
back to the type registry.

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
catalog_create_spec_fix

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

https://github.com/apache/brooklyn-server/pull/845.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 #845


commit 357b82e1abeccf5b7d225b5361e89f8157a476c0
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-09-25T09:34:52Z

Fix BasicBrooklynCatalog create Spec




---


[GitHub] brooklyn-server pull request #832: Add ManagementNodeStateListener support

2017-09-20 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/832#discussion_r139903337
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementNodeStateListenerManager.java
 ---
@@ -0,0 +1,175 @@
+/*
+ * 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.mgmt.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
+import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
+import org.apache.brooklyn.core.mgmt.usage.ManagementNodeStateListener;
+import org.apache.brooklyn.core.server.BrooklynServerConfig;
+import org.apache.brooklyn.util.core.ClassLoaderUtils;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.time.Duration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
+/**
+ * Handles the notification of {@link ManagementNodeStateListener}s.
+ * 
+ * @see {@link BrooklynServerConfig#MANAGEMENT_NODE_STATE_LISTENERS} for 
configuring this.
+ * @see {@link 
org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl#HighAvailabilityManagerImpl(ManagementContextInternal,
 ManagementNodeStateListener)}
+ *  for how we get notified of the state-change.
+ */
+public class ManagementNodeStateListenerManager implements 
ManagementNodeStateListener {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(ManagementNodeStateListenerManager.class);
+
+private final ManagementContextInternal mgmt;
+
+private final Object mutex = new Object();
+
+private final List listeners = 
Lists.newCopyOnWriteArrayList();
+private ManagementNodeState lastPublishedVal;
+
+private final AtomicInteger listenerQueueSize = new AtomicInteger();
+
+private ListeningExecutorService listenerExecutor = 
MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor(new 
ThreadFactoryBuilder()
+.setNameFormat("brooklyn-managementnodestate-listener-%d")
+.build()));
+
+public ManagementNodeStateListenerManager(ManagementContextInternal 
managementContext) {
+this.mgmt = checkNotNull(managementContext, "managementContext");
+
+// Register a coercion from String->ManagementNodeStateListener, 
so that MANAGEMENT_NODE_STATE_LISTENERS defined in brooklyn.cfg
+// will be instantiated, given their class names.
+
TypeCoercions.BrooklynCommonAdaptorTypeCoercions.registerInstanceForClassnameAdapter(
+new ClassLoaderUtils(this.getClass(), managementContext), 
+ManagementNodeStateListener.class);
+
+// Although changing listeners to 
Collection is valid at compile time
+// the collection will contain any objects that could not be 
coerced by the function
+// declared above. Generally this means any string declared in 
brooklyn.properties
+// that is not a ManagementNodeStateListener.
+Collection rawListeners = 
managementContext.getBrooklynProperties().getConfig(BrooklynS

[GitHub] brooklyn-server pull request #832: Add ManagementNodeStateListener support

2017-09-19 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/832#discussion_r139721438
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/mgmt/internal/ManagementNodeStateListenerManager.java
 ---
@@ -0,0 +1,175 @@
+/*
+ * 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.mgmt.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
+import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
+import org.apache.brooklyn.core.mgmt.usage.ManagementNodeStateListener;
+import org.apache.brooklyn.core.server.BrooklynServerConfig;
+import org.apache.brooklyn.util.core.ClassLoaderUtils;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.apache.brooklyn.util.time.Duration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
+/**
+ * Handles the notification of {@link ManagementNodeStateListener}s.
+ * 
+ * @see {@link BrooklynServerConfig#MANAGEMENT_NODE_STATE_LISTENERS} for 
configuring this.
+ * @see {@link 
org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl#HighAvailabilityManagerImpl(ManagementContextInternal,
 ManagementNodeStateListener)}
+ *  for how we get notified of the state-change.
+ */
+public class ManagementNodeStateListenerManager implements 
ManagementNodeStateListener {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(ManagementNodeStateListenerManager.class);
+
+private final ManagementContextInternal mgmt;
+
+private final Object mutex = new Object();
+
+private final List listeners = 
Lists.newCopyOnWriteArrayList();
+private ManagementNodeState lastPublishedVal;
+
+private final AtomicInteger listenerQueueSize = new AtomicInteger();
+
+private ListeningExecutorService listenerExecutor = 
MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor(new 
ThreadFactoryBuilder()
+.setNameFormat("brooklyn-managementnodestate-listener-%d")
+.build()));
+
+public ManagementNodeStateListenerManager(ManagementContextInternal 
managementContext) {
+this.mgmt = checkNotNull(managementContext, "managementContext");
+
+// Register a coercion from String->ManagementNodeStateListener, 
so that MANAGEMENT_NODE_STATE_LISTENERS defined in brooklyn.cfg
+// will be instantiated, given their class names.
+
TypeCoercions.BrooklynCommonAdaptorTypeCoercions.registerInstanceForClassnameAdapter(
+new ClassLoaderUtils(this.getClass(), managementContext), 
+ManagementNodeStateListener.class);
+
+// Although changing listeners to 
Collection is valid at compile time
+// the collection will contain any objects that could not be 
coerced by the function
+// declared above. Generally this means any string declared in 
brooklyn.properties
+// that is not a ManagementNodeStateListener.
+Collection rawListeners = 
managementContext.getBrooklynProperties().getConfig(BrooklynS

[GitHub] brooklyn-client pull request #54: Fixed setting config. Added setting sensor...

2017-09-14 Thread Graeme-Miller
Github user Graeme-Miller closed the pull request at:

https://github.com/apache/brooklyn-client/pull/54


---


[GitHub] brooklyn-library pull request #127: Update visitors-creation-script.sql

2017-09-14 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

https://github.com/apache/brooklyn-library/pull/127

Update visitors-creation-script.sql

An issue was created by #812.

That PR removed the password needed to create the user brooklyn'@'localhost

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

$ git pull https://github.com/Graeme-Miller/brooklyn-library patch-2

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

https://github.com/apache/brooklyn-library/pull/127.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 #127


commit 85bc874af011ff6e9de2045c24ccf323d398cb8a
Author: Graeme-Miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-09-14T15:16:53Z

Update visitors-creation-script.sql




---


[GitHub] brooklyn-server issue #823: Fix creation script

2017-09-14 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/823
  
I have tested this on a MySQLNode and it works


---


[GitHub] brooklyn-server pull request #823: Fix creation script

2017-09-14 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Fix creation script

An issue was created by https://github.com/apache/brooklyn-server/pull/812.

That PR removed the password needed to create the user brooklyn'@'localhost

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server patch-1

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

https://github.com/apache/brooklyn-server/pull/823.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 #823


commit 413aa2cf9cf2593bef33482796892c1370dd2f78
Author: Graeme-Miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-09-14T11:52:06Z

Update visitors-creation-script.sql

commit 5a8e2d0e66cdfa32bff057cfce238c9b3785d8cf
Author: Graeme-Miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-09-14T11:53:11Z

Update visitors-creation-script.sql




---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-14 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138817948
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) {
+StringBuilder msg = new StringBuilder("Listening for ");
+boolean firstWord = true;
+if (sensors!=null) for (Object s: sensors) {
+if (s==null) continue;
+if (!firstWord) { msg.append(", "); } else { firstWord = 
false; }
+// s is normally a sensor but forgive other things if caller 
cheated generics
+msg.append(s instanceof Sensor ? ((Sensor)s).getName() : 
s.toString());
+}
+if (firstWord) msg.append("");
+
+firstWord = true;
--- End diff --

@grkvlt very interesting, didn't know about Collectors.joining(", "), 
that's very handy.

re. the second clause in the if. My understanding of Alex's code is that, 
if there is only one entry, and that entry is self, then we shouldn't add 
"on...". The second clause in the if is to guard against that. Maybe Alex can 
clarify?



---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138651745
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) {
+StringBuilder msg = new StringBuilder("Listening for ");
+boolean firstWord = true;
+if (sensors!=null) for (Object s: sensors) {
+if (s==null) continue;
+if (!firstWord) { msg.append(", "); } else { firstWord = 
false; }
+// s is normally a sensor but forgive other things if caller 
cheated generics
+msg.append(s instanceof Sensor ? ((Sensor)s).getName() : 
s.toString());
+}
+if (firstWord) msg.append("");
+
+firstWord = true;
--- End diff --

lines 620 -> 639 are confusing and it is difficult to extract what the code 
is supposed to do. I had a go at what I think is a simpler solution:
```
if(!myList.isEmpty() && !(myList.size() == 1 && 
myList.iterator().next().equals(getEntity())) {
msg.append(" on ");
List stringList = myList.stream().map((Sensor s) -> {
if (s.equals(getEntity())) {
return "self";
} else if (s instanceof Sensor) {
return ((Sensor) s).getName();
} else {
return s.toString();
}
}).collect(Collectors.toList());
msg.append(String.join(",", stringList));
}
```


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642145
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) {
--- End diff --

This method would benefit from comments to explain what it is doing, with 
multiple loops and nested ifs it isn't easy to tell at a glance.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642446
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) {
+StringBuilder msg = new StringBuilder("Listening for ");
+boolean firstWord = true;
+if (sensors!=null) for (Object s: sensors) {
--- End diff --

do we have a style guide for brooklyn? I have never seen someone put a for 
loop on the same line as an if. Seems to break with our coding conventions.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642216
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
--- End diff --

Should be calling setHighlight, rather than putting directly into the map. 
This would allow these methods to remain uncoupled from how we store the 
highlights. Same for the below highlight methods.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642085
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected <T,U> void highlightTriggers(Iterable> sensors, Iterable sources) {
--- End diff --

This method would benefit from comments to explain what it is doing, with 
multiple loops and nested ifs it isn't easy to tell at a glance.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138638872
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
--- End diff --

Should be calling setHighlight, rather than putting directly into the map. 
This would allow these methods to remain uncoupled from how we store the 
highlights. Same for the below highlight methods.


---


Re: REST API: Policy endpoint addition

2017-09-11 Thread Graeme Miller
PR Created: https://github.com/apache/brooklyn-server/pull/813

On 8 September 2017 at 12:08, Graeme Miller <gra...@cloudsoft.io> wrote:

> Geoff, agree we should be adding it to adjunct, that'll be looked at as
> part of a stage 2 (Alex is going to pick this up). Not sure about the term 
> "usage
> metadata" things like triggers wouldn't be usage info, and if we extend
> this to adjuncts I imagine people writing enricher highlights might want to
> include things like source and target.
>
> Also, I think adding to the policy endpoint is fine, as it is a property
> of a policy in the same way that status or config is.
>
> Thomas, good point about the keys. How would you feel about the endpoint
> not returning any name field:
> [{
>...
>   "highlights": {
> "lastConfirmation": {
>   "description": "sdjnfvsdjvfdjsng",
>   "time": 12345689,
>   "taskId": 1345
> },
> ...
>   }
> }]
> Having both the name and the key might be redundant. If not, I also favour
> your list approach although it is a bit of a pain for the API consumer.
>
>
> On 7 September 2017 at 14:58, Alex Heneveld <alex.heneveld@cloudsoftcorp.
> com> wrote:
>
>>
>> +1 to this, with Thomas's suggestion of a list instead of map and Geoff's
>> suggestion of doing it on adjuncts.  would be nice to have an adjunct api
>> which lets clients treat policies, enrichers, and feeds the same.
>>
>> i can see this being useful for policies to record selected highlights of
>> their activity so a consumer doesn't have to trawl through all activity to
>> see what a policy has done lately.  last value is a good compromise between
>> having some info without trying to remember everything.  sensors on
>> adjuncts could be another way -- maybe we'd move to that in future -- but
>> for now that seems overly complex.
>>
>> --a
>>
>>
>>
>> On 07/09/2017 14:02, Thomas Bouron wrote:
>>
>>> Hi Graeme.
>>>
>>> Sounds very useful to me. Would be great to have this info properly
>>> formatted in the CLI and UI.
>>>
>>> As for the structure, I would suggest to avoid spaces in map keys as best
>>> practice, so having either:
>>>
>>> [{
>>> ...
>>>"highlights": {
>>>  "lastConfirmation": {
>>>"name": "Last Confirmation",
>>>"description": "sdjnfvsdjvfdjsng",
>>>"time": 12345689,
>>>"taskId": 1345
>>>  },
>>>  ...
>>>}
>>> }]
>>>
>>> or maybe even better, something like this:
>>> [{
>>> ...
>>>"highlights": [
>>>  {
>>>"name": "Last Confirmation",
>>>"description": "sdjnfvsdjvfdjsng",
>>>"time": 12345689,
>>>"taskId": 1345
>>>  },
>>>  ...
>>>]
>>> }]
>>>
>>> In terms of implementation, it would be useful to extend it to other
>>> types
>>> of Brooklyn Object such as enrichers, etc. Although, it looks like Geoff
>>> has already made the same comment/suggestion.
>>>
>>> Cheers
>>>
>>>
>>> On Thu, 7 Sep 2017 at 13:30 Graeme Miller <gra...@cloudsoft.io> wrote:
>>>
>>> Hello,
>>>>
>>>> I'd like to make a change to the REST API for policies. As this is a
>>>> REST
>>>> API change I figured it would be best to flag it on the mailing list
>>>> first
>>>> in case anyone has any objections.
>>>>
>>>> It would be useful when consuming this API to be able to find out more
>>>> information about the policy. Specifically, it would be useful to find
>>>> out
>>>> things like last action performed, last policy violation, last
>>>> confirmation, what the triggers are etc.
>>>>
>>>> To do so, I plan to amend the REST API to include 'highlights' for a
>>>> policy. Highlights are a map of a name to a tuple of information
>>>> including
>>>> description, time and task.
>>>>
>>>> Essentially this endpoint:
>>>> "GET /applications/{application}/entities/{entity}/policies"
>>>> Will now include this:
>>>> [{
>>>> ...
>>>>"highlights": {
>>>>  "Last Confirmation": {
>>>>"description": "sdjnfvsdjvfdjsng",
>>>>"time": 12345689,
>>>>"taskId": 1345
>>>>  },
>>>>  ...
>>>>}
>>>> }]
>>>>
>>>> Please shout if you have any problems with this, otherwise I'll submit
>>>> a PR
>>>> shortly with this change.
>>>>
>>>> Regards,
>>>> Graeme Miller
>>>>
>>>>
>>
>


[GitHub] brooklyn-server pull request #813: Added highlights to policy endpoint

2017-09-11 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Added highlights to policy endpoint

Policies now return highlights from the REST API. Highlights are a map of 
ids -> (description, time, task id). They are used to expose more information 
about a policy, for example the last action or the triggers for a policy.

I have also updated the rebind code such that policies can have there 
highlights re-bound.

In the future highlights will be extended to all adjuncts.

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
add_highlight_policy

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

https://github.com/apache/brooklyn-server/pull/813.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 #813


commit 962b777052907b80b93c39dee09dfd976cc87ea9
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-09-07T12:14:42Z

added highlights to policy endpoint




---


Re: REST API: Policy endpoint addition

2017-09-08 Thread Graeme Miller
Geoff, agree we should be adding it to adjunct, that'll be looked at as
part of a stage 2 (Alex is going to pick this up). Not sure about the
term "usage
metadata" things like triggers wouldn't be usage info, and if we extend
this to adjuncts I imagine people writing enricher highlights might want to
include things like source and target.

Also, I think adding to the policy endpoint is fine, as it is a property of
a policy in the same way that status or config is.

Thomas, good point about the keys. How would you feel about the endpoint
not returning any name field:
[{
   ...
  "highlights": {
"lastConfirmation": {
  "description": "sdjnfvsdjvfdjsng",
  "time": 12345689,
  "taskId": 1345
},
...
  }
}]
Having both the name and the key might be redundant. If not, I also favour
your list approach although it is a bit of a pain for the API consumer.


On 7 September 2017 at 14:58, Alex Heneveld <alex.henev...@cloudsoftcorp.com
> wrote:

>
> +1 to this, with Thomas's suggestion of a list instead of map and Geoff's
> suggestion of doing it on adjuncts.  would be nice to have an adjunct api
> which lets clients treat policies, enrichers, and feeds the same.
>
> i can see this being useful for policies to record selected highlights of
> their activity so a consumer doesn't have to trawl through all activity to
> see what a policy has done lately.  last value is a good compromise between
> having some info without trying to remember everything.  sensors on
> adjuncts could be another way -- maybe we'd move to that in future -- but
> for now that seems overly complex.
>
> --a
>
>
>
> On 07/09/2017 14:02, Thomas Bouron wrote:
>
>> Hi Graeme.
>>
>> Sounds very useful to me. Would be great to have this info properly
>> formatted in the CLI and UI.
>>
>> As for the structure, I would suggest to avoid spaces in map keys as best
>> practice, so having either:
>>
>> [{
>> ...
>>"highlights": {
>>  "lastConfirmation": {
>>"name": "Last Confirmation",
>>"description": "sdjnfvsdjvfdjsng",
>>"time": 12345689,
>>"taskId": 1345
>>  },
>>  ...
>>}
>> }]
>>
>> or maybe even better, something like this:
>> [{
>> ...
>>"highlights": [
>>  {
>>"name": "Last Confirmation",
>>"description": "sdjnfvsdjvfdjsng",
>>"time": 12345689,
>>"taskId": 1345
>>  },
>>  ...
>>]
>> }]
>>
>> In terms of implementation, it would be useful to extend it to other types
>> of Brooklyn Object such as enrichers, etc. Although, it looks like Geoff
>> has already made the same comment/suggestion.
>>
>> Cheers
>>
>>
>> On Thu, 7 Sep 2017 at 13:30 Graeme Miller <gra...@cloudsoft.io> wrote:
>>
>> Hello,
>>>
>>> I'd like to make a change to the REST API for policies. As this is a REST
>>> API change I figured it would be best to flag it on the mailing list
>>> first
>>> in case anyone has any objections.
>>>
>>> It would be useful when consuming this API to be able to find out more
>>> information about the policy. Specifically, it would be useful to find
>>> out
>>> things like last action performed, last policy violation, last
>>> confirmation, what the triggers are etc.
>>>
>>> To do so, I plan to amend the REST API to include 'highlights' for a
>>> policy. Highlights are a map of a name to a tuple of information
>>> including
>>> description, time and task.
>>>
>>> Essentially this endpoint:
>>> "GET /applications/{application}/entities/{entity}/policies"
>>> Will now include this:
>>> [{
>>> ...
>>>"highlights": {
>>>  "Last Confirmation": {
>>>"description": "sdjnfvsdjvfdjsng",
>>>"time": 12345689,
>>>"taskId": 1345
>>>  },
>>>  ...
>>>}
>>> }]
>>>
>>> Please shout if you have any problems with this, otherwise I'll submit a
>>> PR
>>> shortly with this change.
>>>
>>> Regards,
>>> Graeme Miller
>>>
>>>
>


REST API: Policy endpoint addition

2017-09-07 Thread Graeme Miller
Hello,

I'd like to make a change to the REST API for policies. As this is a REST
API change I figured it would be best to flag it on the mailing list first
in case anyone has any objections.

It would be useful when consuming this API to be able to find out more
information about the policy. Specifically, it would be useful to find out
things like last action performed, last policy violation, last
confirmation, what the triggers are etc.

To do so, I plan to amend the REST API to include 'highlights' for a
policy. Highlights are a map of a name to a tuple of information including
description, time and task.

Essentially this endpoint:
"GET /applications/{application}/entities/{entity}/policies"
Will now include this:
[{
   ...
  "highlights": {
"Last Confirmation": {
  "description": "sdjnfvsdjvfdjsng",
  "time": 12345689,
  "taskId": 1345
},
...
  }
}]

Please shout if you have any problems with this, otherwise I'll submit a PR
shortly with this change.

Regards,
Graeme Miller


[jira] [Created] (BROOKLYN-531) k8s DockerContainer location public ip

2017-09-05 Thread Graeme Miller (JIRA)
Graeme Miller created BROOKLYN-531:
--

 Summary: k8s DockerContainer location public ip
 Key: BROOKLYN-531
 URL: https://issues.apache.org/jira/browse/BROOKLYN-531
 Project: Brooklyn
  Issue Type: Bug
Reporter: Graeme Miller


When using the DockerContainer entity on a kubernetes location, the public IP 
address of the k8s cluster is populated incorrectly. The private IP is used 
instead.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (BROOKLYN-530) InitScript for Windows machine doesn't run when USER_METADATA_STRING or USER_METADATA_MAP are defined

2017-09-05 Thread Graeme Miller (JIRA)
Graeme Miller created BROOKLYN-530:
--

 Summary: InitScript for Windows machine doesn't run when 
USER_METADATA_STRING or USER_METADATA_MAP are defined
 Key: BROOKLYN-530
 URL: https://issues.apache.org/jira/browse/BROOKLYN-530
 Project: Brooklyn
  Issue Type: Bug
Reporter: Graeme Miller


if JcloudsLocationConfig.USER_METADATA_STRING or 
JcloudsLocationConfig.USER_METADATA_MAP are defined, the initScript for winrm 
will not run 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (BROOKLYN-529) Windows location keyPair issue

2017-09-05 Thread Graeme Miller (JIRA)
Graeme Miller created BROOKLYN-529:
--

 Summary: Windows location keyPair issue
 Key: BROOKLYN-529
 URL: https://issues.apache.org/jira/browse/BROOKLYN-529
 Project: Brooklyn
  Issue Type: Bug
Reporter: Graeme Miller


I can't deploy the following blueprint

{{name: bad
location:
  'jclouds:aws-ec2':
region: eu-west-1
identity: xxx
credential: xxx
imageOwner: 801119661308
imageNameRegex: Windows_Server-2012-R2_RTM-English-64Bit-Base-.*
useJcloudsSshInit: false
keyPair: myKeypair
services:
  - type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess
brooklyn.config:
  install.command: echo installing
  checkRunning.command: echo running}}

while the slightly modified version

{{name: bad
location:
  'jclouds:aws-ec2':
region: eu-west-1
identity: xxx
credential: xxx
imageOwner: 801119661308
imageNameRegex: Windows_Server-2012-R2_RTM-English-64Bit-Base-.*
useJcloudsSshInit: false
services:
  - type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess
brooklyn.config:
  install.command: echo installing
  checkRunning.command: echo running}}

works fine.

if you specify a keyPair, jclouds won’t wait for the admin password to be ready 
and will return the node without password; while if the blueprint doesn’t 
specify a keyPair name, jclouds will generate one and will use the private key 
to decrypt the admin password and pass back to brooklyn a node with a valid 
`LoginCredentials.password`



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] brooklyn-server issue #796: Disabled AUTO_WRAP_CATALOG_YAML_AS_BUNDLE

2017-08-21 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/796
  
no longer required


---
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 #798: Fix template forward reference

2017-08-18 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/798
  
I have tested locally and can confirm that this fixes the issue that I saw. 
This PR adds a test for that issue, but thought it was best to double check.

This code looks good as well, although I don't know this area of the code 
particularly well.


---
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 #796: Disabled AUTO_WRAP_CATALOG_YAML_AS_BUNDLE

2017-08-14 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Disabled AUTO_WRAP_CATALOG_YAML_AS_BUNDLE



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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
turn_off_auto_wrap

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

https://github.com/apache/brooklyn-server/pull/796.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 #796


commit e830f07d5cd769099b0cb3b0ce8f169c81569700
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-08-14T12:58:38Z

Disabled AUTO_WRAP_CATALOG_YAML_AS_BUNDLE




---
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 issue #205: use ~~~ rather than ```

2017-08-07 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-docs/pull/205
  
@m4rkmckenna updated


---
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 #205: use ~~~ rather than ```

2017-08-07 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

use ~~~ rather than ```

This keeps this page in line with other pages. Also it was causing issues 
in a downstream project.


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

$ git pull https://github.com/Graeme-Miller/brooklyn-docs 
versioning_format_fix

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

https://github.com/apache/brooklyn-docs/pull/205.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 #205


commit 6c10b6f749b683429df526b1b163793155a8b579
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-08-07T14:41:57Z

use ~~~ rather than ```




---
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 #770: Add null checks to Azure default network

2017-07-20 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Add null checks to Azure default network



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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
fix_npe_azure_def_net

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

https://github.com/apache/brooklyn-server/pull/770.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 #770


commit 25fef9685ed2e627bead26b56ae663752bf2a940
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-07-20T13:15:06Z

Add null checks to Azure default network




---
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 #755: Added endpoint test boms

2017-07-05 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Added endpoint test boms



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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
add_endpoint_test_boms

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

https://github.com/apache/brooklyn-server/pull/755.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 #755


commit a3e1812d77c877ab852f1c497678a5bae26ac8a7
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-07-05T10:27:26Z

Added endpoint test boms




---
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 #745: Azure ARM default network fixes from PR suggesti...

2017-07-04 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/745
  
@neykov I have rebased


---
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 #747: BROOKLYN-520: better error if type missin...

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

https://github.com/apache/brooklyn-server/pull/747#discussion_r124574322
  
--- Diff: 
camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
 ---
@@ -130,6 +132,12 @@ public static BrooklynComponentTemplateResolver 
newInstance(BrooklynClassLoading
 
 private static BrooklynComponentTemplateResolver 
newInstance(BrooklynClassLoadingContext context, ConfigBag attrs, 
AbstractResource optionalTemplate) {
 String type = getDeclaredType(null, optionalTemplate, attrs);
+if (type == null) {
--- End diff --

Can type be the empty string? Might want to consider doing 
StringUtils.isEmpty


---
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 #745: Azure ARM default network fixes from PR suggesti...

2017-06-27 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/745
  
@neykov that's a good point about the default networking functionality 
being different in 2.0.1. I'd still recommend merging this PR as it is useful 
for downstream projects that use the latest JClouds.

Not sure I 100% follow your comment about quota failures. However, if it is 
acceptable I will research and fix in a separate PR?


---
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 #745: Azure ARM default network fixes from PR s...

2017-06-26 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Azure ARM default network fixes from PR suggestions

Important Note: Azure ARM doesn't currently work with the master of 
Brooklyn. Currently, after a Azure ARM VM is created, JClouds attempts to list 
all of the nodes in the resource group but cannot parse the result due to a 
missing property (vhd for DataDisk). I have tested with the latest JClouds code 
in master and we do not have this issue. 

However, we are currently on the latest released version of JClouds (2.0.1) 
and we cannot pull in the code in mater until there is another JClouds release. 
As such, the code that has been written for default network has been written 
against the code in JClouds master and will work when we upgrade to the next 
version of JClouds. If you need working Azure ARM support, and default 
networking build JClouds master locally, and build brooklyn against it.

-

Various fixes:
- IpOptions were being added incorrectly to templateOptions. They were 
being set as a map, when they should have been a list of maps
- When checking templateOptions for existing config, look for 'networks' 
rather than NETWORK_NAME config (which resolves to 'networkName'). Still use 
NETWORK_NAME config when checking in brooklyn config
- Check that a region has been set in brooklyn config 
(config.get(CLOUD_REGION_ID)) if not, don't try and create a default network. 
It was suggested that I could move the default network creation to later in 
JCloudsLocation after the templateOptions have been built. This would mean that 
a default region would have been added to the templateOptions if none was 
specified in config. I attempted to implement this, but ran into an issue. The 
AzureTemplateOptions in JClouds 2.0.1 is different to the AzureTemplateOptions 
in JClouds master. As such, it is not possible to amend the 
AzureTemplateOptions from Brooklyn code, as we would not be able to modify the 
ipOptions (a concept that only exists in JClouds master). As such, I have put 
the null check in for the time being. After the next JClouds release, I will 
come back and fix this
- Check for the situation where a default network exists, but a default 
subnet does not. In this situation create a default subnet only

--

@neykov pointed out there could be issues if we are trying to create 
multiple VM's at the same time due to the these VMs all trying to create the 
default network/subnet. I have investigated and I don't think this will be an 
issue. The default network creation is done in the obtainOnce method of 
JCloudsLocation. If there were a situation where multiple VMs tried to create 
the network at the same time, then all but one would fail. Brooklyn will by 
default will then attempt to get a VM again, and this time it will succeed. To 
test this theory I spooled up three AMPs, and at the same time kicked off a 
deployment of 5 VMs on each AMP (15 total) to try and force this situation. 
Only 3/15 came up correctly, but the failures were quota issues which means 
they got passed network creation.

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
fix_azure_default_network

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

https://github.com/apache/brooklyn-server/pull/745.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 #745


commit 923f452b18b415c39cd7b4f71768953091132f3f
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-06-23T11:53:41Z

Azure ARM default network fixes from PR suggestions




---
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 #742: DefaultAzureArmNetworkCreator improvements

2017-06-22 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/742
  
lgtm thanks @aledsage 


---
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 #200: Fixed advanced example by shipping blueprin...

2017-06-22 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Fixed advanced example by shipping blueprints in repo



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

$ git pull https://github.com/Graeme-Miller/brooklyn-docs 
fix_advanced_example_docs

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

https://github.com/apache/brooklyn-docs/pull/200.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 #200


commit 2c49bccf88cf28046eebe3fceffa7ada9a7d5167
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-06-22T09:59:46Z

Fixed advanced example by shipping blueprints in repo




---
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 #742: DefaultAzureArmNetworkCreator improvement...

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

https://github.com/apache/brooklyn-server/pull/742#discussion_r123482786
  
--- Diff: 
locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreatorTest.java
 ---
@@ -204,7 +199,7 @@ public void testNetworkInTemplate() {
 }
 
 @Test
-public void testIpOptionsInTemplate() {
+public void testIpOptionsInTemplate() throws Exception {
--- End diff --

do these throw exceptions?


---
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 #742: DefaultAzureArmNetworkCreator improvement...

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

https://github.com/apache/brooklyn-server/pull/742#discussion_r123482551
  
--- Diff: 
locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreatorTest.java
 ---
@@ -90,62 +97,44 @@ public void testPreExisting() {
 verify(azureComputeApi).getSubnetApi(TEST_RESOURCE_GROUP, 
TEST_NETWORK_NAME);
 
 Map<String, Object> templateOptions = 
configBag.get(TEMPLATE_OPTIONS);
-Map<String, Object> ipOptions = (Map<String, 
Object>)templateOptions.get("ipOptions");
+Map ipOptions = (Map)templateOptions.get("ipOptions");
 assertEquals(ipOptions.get("subnet"), TEST_SUBNET_ID);
 assertEquals(ipOptions.get("allocateNewPublicIp"), true);
 }
 
 @Test
-public void testVanilla() {
-//Setup config bag
-ConfigBag configBag = ConfigBag.newInstance();
-configBag.put(CLOUD_REGION_ID, TEST_LOCATION);
-
-//Setup mocks
-
when(computeService.getContext().unwrapApi(AzureComputeApi.class)).thenReturn(azureComputeApi);
-when(azureComputeApi.getSubnetApi(TEST_RESOURCE_GROUP, 
TEST_NETWORK_NAME)).thenReturn(subnetApi);
-
when(subnetApi.get(TEST_SUBNET_NAME)).thenReturn(null).thenReturn(subnet); 
//null first time, subnet next
-when(subnet.id()).thenReturn(TEST_SUBNET_ID);
-
-
when(azureComputeApi.getResourceGroupApi()).thenReturn(resourceGroupApi);
-when(resourceGroupApi.get(TEST_RESOURCE_GROUP)).thenReturn(null);
-
-
when(azureComputeApi.getVirtualNetworkApi(TEST_RESOURCE_GROUP)).thenReturn(virtualNetworkApi);
-
-
-//Test
-
DefaultAzureArmNetworkCreator.createDefaultNetworkAndAddToTemplateOptionsIfRequired(computeService,
 configBag);
-
-//verify
-verify(subnetApi, times(2)).get(TEST_SUBNET_NAME);
-verify(subnet).id();
-verify(azureComputeApi, 
times(2)).getSubnetApi(TEST_RESOURCE_GROUP, TEST_NETWORK_NAME);
-
-verify(azureComputeApi, times(2)).getResourceGroupApi();
-verify(resourceGroupApi).get(TEST_RESOURCE_GROUP);
-verify(azureComputeApi).getVirtualNetworkApi(TEST_RESOURCE_GROUP);
-
-Map<String, Object> templateOptions = 
configBag.get(TEMPLATE_OPTIONS);
-Map<String, Object> ipOptions = (Map<String, 
Object>)templateOptions.get("ipOptions");
-assertEquals(ipOptions.get("subnet"), TEST_SUBNET_ID);
-assertEquals(ipOptions.get("allocateNewPublicIp"), true);
+public void testVanillaWhereNoResourceGroup() throws Exception {
+runVanilla(ImmutableMap.of(), false);
 }
-
+
 @Test
-public void testVanillaWhereTemplateOptionsAlreadySpecified() {
+public void testVanillaWhereExistingResourceGroup() throws Exception {
+runVanilla(ImmutableMap.of(), true);
+}
+
+@Test
+public void testVanillaWhereTemplateOptionsAlreadySpecified() throws 
Exception {
+ImmutableMap additionalConfig = 
ImmutableMap.of(TEMPLATE_OPTIONS, ImmutableMap.of("unrelated-key", 
"unrelated-value"));
+ConfigBag result = runVanilla(additionalConfig, false);
+Map<String, ?> templateOptions = result.get(TEMPLATE_OPTIONS);
+assertEquals(templateOptions.get("unrelated-key"), 
"unrelated-value");
+}
+
+protected ConfigBag runVanilla(Map additionalConfig, boolean 
resoureGroupExists) throws Exception {
--- End diff --

I can see why you've created a generic vanilla test here (looks like it 
cuts down on code repetition), but I think that it introduces a couple of 
problems:
*) Makes the tests more difficult to understand (the runVanilla method 
itself is longer than an individual test used to be due to the necessity of 
adding if blocks to cope with different resource group cases)
*) Makes the tests more difficult to maintain (if the mock calls change for 
one of the tests, you have to modify the generic test and understand what all 
the other tests that rely on it expect it to do)

The tests themselves were pretty short before and as such I don't see a 
justification for this change. I would suggest reverting this to repeating the 
code per test.



---
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 #739: A default network is now created when dep...

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

https://github.com/apache/brooklyn-server/pull/739#discussion_r123230837
  
--- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreator.java
 ---
@@ -0,0 +1,129 @@
+/*
+ * 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.location.jclouds.networking.creator;
+
+import static 
org.apache.brooklyn.core.location.cloud.CloudLocationConfig.CLOUD_REGION_ID;
+import static 
org.apache.brooklyn.location.jclouds.api.JcloudsLocationConfigPublic.NETWORK_NAME;
+import static 
org.apache.brooklyn.location.jclouds.api.JcloudsLocationConfigPublic.TEMPLATE_OPTIONS;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableMap;
+
+import org.jclouds.azurecompute.arm.AzureComputeApi;
+import org.jclouds.azurecompute.arm.domain.ResourceGroup;
+import org.jclouds.azurecompute.arm.domain.Subnet;
+import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
+import org.jclouds.compute.ComputeService;
+
+import org.apache.brooklyn.util.core.config.ConfigBag;
+
+public class DefaultAzureArmNetworkCreator {
+
+public static final Logger LOG = 
LoggerFactory.getLogger(DefaultAzureArmNetworkCreator.class);
+
+private static final String DEFAULT_RESOURCE_GROUP = 
"brooklyn-default-resource-group";
+private static final String DEFAULT_NETWORK_NAME = 
"brooklyn-default-network";
+private static final String DEFAULT_SUBNET_NAME = 
"brooklyn-default-subnet";
+
+private static final String defaultVnetAddressPrefix = "10.1.0.0/16";
+private static final String defaultSubnetAddressPrefix = "10.1.0.0/24";
+
+public static void 
createDefaultNetworkAndAddToTemplateOptions(ComputeService computeService, 
ConfigBag config) {
+Map<String, Object> templateOptions = config.get(TEMPLATE_OPTIONS);
+
+//Only create a default network if we haven't specified a network 
name (in template options or config) or ip options
+if (config.containsKey(NETWORK_NAME)) {
+LOG.info("Network config specified when creating Azure 
location. Not creating default network");
+return;
+}
+if (templateOptions != null && 
(templateOptions.containsKey(NETWORK_NAME.getName()) || 
templateOptions.containsKey("ipOptions"))) {
+LOG.info("Network config specified when creating Azure 
location. Not creating default network");
+return;
+}
+
+LOG.info("Network config not specified when creating Azure 
location. Creating default network if doesn't exist");
+
+AzureComputeApi api = 
computeService.getContext().unwrapApi(AzureComputeApi.class);
+String location = config.get(CLOUD_REGION_ID);
+
+String resourceGroupName = DEFAULT_RESOURCE_GROUP  + "-" + 
location;
+String vnetName = DEFAULT_NETWORK_NAME + "-" + location;
+String subnetName = DEFAULT_SUBNET_NAME + "-" + location;
+
+//Check if default already exists
+Subnet preexistingSubnet = api.getSubnetApi(resourceGroupName, 
vnetName).get(subnetName);
+if(preexistingSubnet != null){
+LOG.info("Default Azure network and subnet already created, 
"+vnetName);
+updateTemplateOptions(config, preexistingSubnet);
+return;
+}
+
+
+LOG.info("Network config not specified when creating Azure 
location and default network/subnet does not exists. Creating");
+
+createResourceGroupI

[jira] [Commented] (BROOKLYN-519) Persisting yaml blueprint with $brooklyn:entitySpec stores all configs

2017-06-21 Thread Graeme Miller (JIRA)

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

Graeme Miller commented on BROOKLYN-519:


You mentioned 0.10.0 of brooklyn. Have you confirmed this is an issue for 
master of brooklyn?

> Persisting yaml blueprint with $brooklyn:entitySpec stores all configs
> --
>
> Key: BROOKLYN-519
> URL: https://issues.apache.org/jira/browse/BROOKLYN-519
> Project: Brooklyn
>  Issue Type: Bug
>Reporter: Valentin Aitken
>
> Scenario:
> # Deploy the blueprint:
> {noformat}
> location: localhost
> services:
> - type: org.apache.brooklyn.entity.stock.BasicApplication
>   brooklyn.config:
> childSpec:
>   $brooklyn:entitySpec:
>- type: brooklyn.entity.group.DynamicCluster
> {noformat}
> # Inspect persistence 
> {noformat}
> 
>   
> org.apache.brooklyn.entity.group.DynamicCluster
> 
> 
> 
>   
> cluster.initial.quorumSize
> false
> 
>   cluster.initial.quorumSize
>   java.lang.Integer
>   Initial cluster quorum size - number of initial 
> nodes that must have been successfully started to report success (if  0, 
> then use value of INITIAL_SIZE)
>   -1
>   false
>class="com.google.common.base.Predicates$ObjectPredicate">ALWAYS_TRUE
> 
>   
>   
> cluster.initial.size
> false
> 
>   cluster.initial.size
>   .
> 
>   
> ...
> 
>   
> 
> {noformat}
> Concern:
> Persisting all config keys can lead to persistence problems when changing 
> config keys of a type.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] brooklyn-server issue #739: A default network is now created when deploying ...

2017-06-21 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/739
  
The failure was due to my test class having an un-approve licence. I have 
updated the class and pushed- this should force a retest


---
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 #739: A default network is now created when dep...

2017-06-20 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

A default network is now created when deploying to Azure ARM

In an upcoming release of JClouds, support for Azure ARM will be added. The 
JClouds code for Azure ARM will place each created VM into a network based on 
it's group ID. As we do not use the concept of a group ID in Brooklyn, this 
means that each VM deployed by Brooklyn is deployed in it's own subnet. 

For most other clouds, a sensible default network is provided by the cloud. 
As such a Brooklyn user can be assured that if he deploys a blueprint with 
multiple VMs, they can reach each other on the private IPs that are provided. 
Unless we create a default network in Azure, those blueprints will not be 
portable and a user will have to manually create a network first. I believe 
that it is confusing for a user to have the clouds act differently on 
networking, which is an essential part of Brooklyn.

A few things to mention:
*) The default network/subnet is only created when needed
*) The default network/subnet is created per region
*) It is never cleaned up or deleted


As a side note, I discovered this as AMP, which is a downstream project of 
Brooklyn, pulled in and was using Azure ARM support from JClouds. An older 
version of the JClouds code created the default network, but was recently 
removed meaning a regression in AMP. The code which I have added to create a 
default network is based on the JClouds code.


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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
add_azure_default_network

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

https://github.com/apache/brooklyn-server/pull/739.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 #739


commit 120d9075e56972a486ae473cced62f1380b4cbb6
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-06-20T14:59:04Z

A default network is now created when deploying to Azure ARM




---
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-client issue #42: Improve login handling.

2017-06-19 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-client/pull/42
  
Just want to chime in with a different opinion. I think we should merge as 
is, and not implement the functionality to allow users to switch between 
multiple hosts.

For me, it is a question of ease of use vs security. I am uncomfortable 
caching any passwords locally as it is insecure- but I can see why it is 
necessary.  Caching multiple passwords doesn't seem necessary to me and makes 
the solution much less secure (we never clean up the passwords, so we store a 
list of passwords for all hosts ever visited).

Also, I feel like it violates the principle of least astonishment. I was 
quite surprised when I checked the local cache and there was a list of 
passwords in there. Including a password that was not a brooklyn password that 
I must have entered in error. I think that users would be surprised by the 
behaviour of the CLI to cache all passwords entered.





---
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-client issue #54: Fixed setting config. Added setting sensors

2017-06-14 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-client/pull/54
  
Actually, maybe all that is needed is some clarity about how to use this in 
the help documentation and some better error information.

I was fixing this because of this Jira 
(https://issues.apache.org/jira/browse/BROOKLYN-465) and I also found using set 
confusing. 

How would you both feel about me updating the help documentation for set to 
say it is JSON, and to quote strings? I'll also leave in the changes to allow 
sensors to be set.


---
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-client pull request #54: Fixed setting config. Added setting sensor...

2017-06-12 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

https://github.com/apache/brooklyn-client/pull/54

Fixed setting config. Added setting sensors



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

$ git pull https://github.com/Graeme-Miller/brooklyn-client 
set_config_sensor

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

https://github.com/apache/brooklyn-client/pull/54.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 #54


commit 34382b09fbb8d0bd3d4b1f3cc6c4d139df7ab8c7
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-06-12T13:20:45Z

Fixed setting config. Added setting sensors




---
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.
---


Re: Is the deploy user available via the API?

2017-06-09 Thread Graeme Miller
If it is the Brooklyn user you're talking about, it should not be difficult
to add. Just amend this

line to include the user. You can get the user by doing
this: Entitlements.getEntitlementContext().user().



On 9 June 2017 at 11:26, Thomas Bouron 
wrote:

> Hi Murdo.
>
> Assuming you are talking about the username of the cloud provider you
> deploy machines to, this information appears in the debug log and maybe the
> activity's stdout and stderr but nowhere else.
>
> If you are talking about the logged user in Brooklyn, I don't think this
> information is recorded upon deployment.
>
> Best.
>
> On Fri, 9 Jun 2017 at 11:18 Murdo Aird 
> wrote:
>
> > Hi
> >
> > Is the username of the account who deployed an entity exposed via the API
> > at all? Thanks
> >
> > Thanks
> > Murdo
> > --
> >
> > Murdo Aird
> >
> > VP, Operations
> >
> > Phone: +44 7738150240 <+44%207738%20150240> | Skype: murdo.aird
> >
> > Twitter: @MurdoAird  | LinkedIn:
> > https://uk.linkedin.com/in/murdo
> >
> > [image: Cloudsoft Logo.jpg] 
> >
> > Stay up to date with everything Cloudsoft:
> > [image: Twitter_Logo_White_On_Blue.png] 
> > [image:
> > YouTube-social-icon_red_48px.png]
> > 
> >
> --
>
> Thomas Bouron • Senior Software Engineer @ Cloudsoft Corporation •
> https://cloudsoft.io/
> Github: https://github.com/tbouron
> Twitter: https://twitter.com/eltibouron
>


[jira] [Commented] (BROOKLYN-469) CLI: Panic when login attempted with malformed URL

2017-06-07 Thread Graeme Miller (JIRA)

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

Graeme Miller commented on BROOKLYN-469:


[~sjcorbett] I just tested this and got the following result:
Graemes-MBP:cli graememiller$ ./target/bin/darwin.amd64/br login 
http://localhost:sdnfksdjnfkjsndfkjsd
Get http://localhost:sdnfksdjnfkjsndfkjsd/v1/server/version: invalid URL port 
"sdnfksdjnfkjsndfkjsd"

Are you happy to close this issue?


> CLI: Panic when login attempted with malformed URL
> --
>
> Key: BROOKLYN-469
> URL: https://issues.apache.org/jira/browse/BROOKLYN-469
> Project: Brooklyn
>  Issue Type: Bug
>Reporter: Sam Corbett
>
> The cli panics when the URL for login isn't a URI:
> {code}
> $ br login http://localhost:sdnfksdjnfkjsndfkjsd
> panic: runtime error: invalid memory address or nil pointer dereference
> [signal 0xb code=0x1 addr=0x10 pc=0x647b1]
> goroutine 1 [running]:
> panic(0x4134c0, 0xc820014120)
>   /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
> github.com/apache/brooklyn-client/cli/net.(*Network).SendRequestGetStatusCode(0xc8200105c0,
>  0xc8200ea000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/net/net.go:124
>  +0x1e1
> github.com/apache/brooklyn-client/cli/api/version.Version(0xc8200105c0, 0x0, 
> 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/api/version/version.go:31
>  +0xb4
> github.com/apache/brooklyn-client/cli/commands.(*Login).Run(0xc820015300, 
> 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/commands/login.go:125
>  +0xfa8
> github.com/apache/brooklyn-client/cli/command_runner.ConcreteRunner.RunCmdByName(0x7bdd60,
>  0xc820015320, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/command_runner/runner.go:49
>  +0xe7
> github.com/apache/brooklyn-client/cli/command_runner.(*ConcreteRunner).RunCmdByName(0xc820016540,
>  0x49bb98, 0x5, 0xc82008e8c0, 0x0, 0x0)
>   :1 +0xe0
> github.com/apache/brooklyn-client/cli/app.getCommand.func1(0xc82008e8c0)
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/app/app.go:82
>  +0x57
> github.com/apache/brooklyn-client/cli/vendor/github.com/urfave/cli.Command.Run(0x49bb98,
>  0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc8200c0fa0, 0x1e, 0x0, ...)
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/vendor/github.com/urfave/cli/command.go:174
>  +0x1399
> github.com/apache/brooklyn-client/cli/vendor/github.com/urfave/cli.(*App).Run(0xc82008e3c0,
>  0xc82000a730, 0x5, 0x5, 0x0, 0x0)
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/vendor/github.com/urfave/cli/app.go:187
>  +0x112b
> main.main()
>   
> /Users/sam/code/brooklyn.io/brooklyn/brooklyn-client/cli/target/src/github.com/apache/brooklyn-client/cli/br/brooklyn.go:62
>  +0x915
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


Re: [VOTE] Accept contribution of Brooklyn Container Service

2017-05-31 Thread Graeme Miller
+1

On 31 May 2017 at 12:43, Geoff Macartney 
wrote:

> +1 binding
>
> On Wed, 31 May 2017 at 12:19 Andrew Kennedy <
> andrew.kenn...@cloudsoftcorp.com> wrote:
>
> > +1 Binding
> >
> > This is a really useful addition to Brooklyn. It will allow users to
> target
> > what are now the de facto standards for microservices and cloud native
> > applications.
> >
> > Andrew.
> >
> > On Wed, 31 May 2017 at 11:56 Andrew Kennedy <
> > andrew.kenn...@cloudsoftcorp.com> wrote:
> >
> > > All,
> > >
> > > - https://github.com/cloudsoft/brooklyn-container-service
> > >
> > > This repository contains Brooklyn Container Service, which is a set of
> > > locations and entities for Apache Brooklyn that allow deployment of
> > > applications to container based locations. The locations provided
> > > use the jclouds Docker provider and the fabric8 Kubernetes client to
> > > give Brooklyn access to Docker Engine, Docker Swarm, Kubernetes and
> > > OpenShift. As well as these locations, entities that represent Docker
> > > containers and Kubernetes pods are included, which can be used to build
> > > applications. Blueprints for containerised applications can also be
> > > developed and deployed using the usual Brooklyn components. This is a
> > > useful addition to Apache Brooklyn and allows the project to extend its
> > > scope to include this essential part of the Cloud Native ecosystem.
> > >
> > > Container Service was developed by Cloudsoft Corporation as part of its
> > > AMP product over the last year, based on the earlier open source
> Clocker
> > > codebase. There have been 14 contributors, making 379 commits in 50
> > > files, with around 3.3 KLOC of Java. The commit being discussed here
> has
> > > id `975807b89df63833d9b53b50d508cb5d782ad7b0` and tag
> `apache-brooklyn`,
> > > and the code can be accessed at the following URLs:
> > >
> > > -
> > >
> > https://github.com/cloudsoft/brooklyn-container-service/tree/
> 975807b89df63833d9b53b50d508cb5d782ad7b0
> > > -
> > >
> > https://github.com/cloudsoft/brooklyn-container-service/
> releases/tag/apache-brooklyn
> > >
> > > This vote is to determine whether the Brooklyn PMC is in favour of
> > > accepting the code contribution. If the vote passes, the PMC and the
> > > authors of the code will work together to complete the ASF IP Clearance
> > > process and merge the Container Service repository into Apache
> Brooklyn.
> > >
> > > [ ] +1 : Accept contribution of Brooklyn Container Service
> > > [ ]  0 : No opinion
> > > [ ] -1 : Reject contribution because...
> > >
> > > The vote is open for 72 hours and will close at 11h00 UTC/12h00 BST on
> > > Saturday 03 June 2017 and the results will be announced on this list.
> > >
> > > Thanks,
> > > Andrew.
> > > --
> > >
> > > Andrew Kennedy ; Founder clocker.io project ; @grkvlt ; Cloudsoft
> > >
> > --
> >
> > Andrew Kennedy ; Founder clocker.io project ; @grkvlt ; Cloudsoft
> >
>


[GitHub] brooklyn-client pull request #42: Improve login handling.

2017-05-25 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-client/pull/42#discussion_r118496514
  
--- Diff: cli/io/config.go ---
@@ -70,3 +98,111 @@ func (config *Config) Read() {
dec := json.NewDecoder(fileToRead)
dec.Decode()
 }
+
+
+// getCredentials reads credentials from .brooklyn_cli data formatted for 
versions > 0.11.0
+// Note that the password is base64 encoded to avoid json formatting 
problems
+//{
+//  "credentials": {
+//  "password": "cGFzc3dvcmQ=",
+//  "username": "geoff"
+//  },
+//  "skipSslChecks": false,
+//  "target": "http://geoffs-macbook-pro.local:8081;
+//}
+func (config *Config) getCredentials(target string) (username string, 
password string, err error) {
+   credentials, found := config.Map[credentialsKey].(string)
+   if !found {
+   err = errors.New("No credentials found for " + target)
+   return
+   }
+
+   if decoded, errd := base64.StdEncoding.DecodeString(credentials); errd 
!= nil {
+   err = errors.New("Could not decode credentials for " + target)
+   return
+   } else {
+   userAndPassword := strings.SplitN(string(decoded), ":", 2)
+   if len(userAndPassword) != 2 {
--- End diff --

Ah, I see. So, in theory, it could be an issue if the user has a ':' in 
their username- but that is quite unlikely.


---
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-client pull request #42: Improve login handling.

2017-05-25 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-client/pull/42#discussion_r118458597
  
--- Diff: cli/io/config.go ---
@@ -70,3 +98,111 @@ func (config *Config) Read() {
dec := json.NewDecoder(fileToRead)
dec.Decode()
 }
+
+
+// getCredentials reads credentials from .brooklyn_cli data formatted for 
versions > 0.11.0
+// Note that the password is base64 encoded to avoid json formatting 
problems
+//{
+//  "credentials": {
+//  "password": "cGFzc3dvcmQ=",
+//  "username": "geoff"
+//  },
+//  "skipSslChecks": false,
+//  "target": "http://geoffs-macbook-pro.local:8081;
+//}
+func (config *Config) getCredentials(target string) (username string, 
password string, err error) {
+   credentials, found := config.Map[credentialsKey].(string)
+   if !found {
+   err = errors.New("No credentials found for " + target)
+   return
+   }
+
+   if decoded, errd := base64.StdEncoding.DecodeString(credentials); errd 
!= nil {
+   err = errors.New("Could not decode credentials for " + target)
+   return
+   } else {
+   userAndPassword := strings.SplitN(string(decoded), ":", 2)
+   if len(userAndPassword) != 2 {
--- End diff --

It is possible for a brooklyn user to have a ':' in there password.
If that is the case then they will not be able to use the BR command as we 
will fail at this line.
I suggest encoding/decoding username and password separately


---
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-client pull request #42: Improve login handling.

2017-05-25 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-client/pull/42#discussion_r118458240
  
--- Diff: cli/br/brooklyn.go ---
@@ -30,27 +30,14 @@ import (
"path/filepath"
 )
 
-func getNetworkCredentialsFromConfig(yamlMap map[string]interface{}) 
(string, string, string, bool) {
-   var target, username, password string
-   var skipSslChecks bool
-   target, found := yamlMap["target"].(string)
-   if found {
-   auth, found := yamlMap["auth"].(map[string]interface{})
-   if found {
-   creds := auth[target].(map[string]interface{})
-   username, found = creds["username"].(string)
-   if found {
-   password, found = creds["password"].(string)
-   }
-   }
-   skipSslChecks, _ = yamlMap["skipSslChecks"].(bool)
-   }
-   return target, username, password, skipSslChecks
-}
-
 func main() {
config := io.GetConfig()
-   target, username, password, skipSslChecks := 
getNetworkCredentialsFromConfig(config.Map)
+   skipSslChecks := config.GetSkipSslChecks()
+   target, username, password, err := config.GetNetworkCredentials()
+   if err != nil && !isLogin(os.Args) {
--- End diff --

It might read nicer to skip config.GetNetworkCredentials() if it is login, 
rather than ignore the error


---
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-client pull request #42: Improve login handling.

2017-05-25 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-client/pull/42#discussion_r118455814
  
--- Diff: cli/commands/login.go ---
@@ -53,6 +58,30 @@ func (cmd *Login) Metadata() 
command_metadata.CommandMetadata {
}
 }
 
+
+func (cmd *Login) promptAndReadUsername() (username string) {
+   for username == "" {
+   reader := bufio.NewReader(os.Stdin)
+   fmt.Print("Enter Username: ")
+   user, err := reader.ReadString('\n')
+   if err != nil {
+   error_handler.ErrorExit(err)
+   }
+   username = strings.TrimSpace(user)
+   }
+   return username
+}
+
+func (cmd *Login) promptAndReadPassword() (password string) {
+   fmt.Print("Enter Password: ")
--- End diff --

why no loop like in promptAndReadUsername?


---
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-client pull request #42: Improve login handling.

2017-05-25 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-client/pull/42#discussion_r118458766
  
--- Diff: cli/br/brooklyn.go ---
@@ -30,27 +30,14 @@ import (
"path/filepath"
 )
 
-func getNetworkCredentialsFromConfig(yamlMap map[string]interface{}) 
(string, string, string, bool) {
-   var target, username, password string
-   var skipSslChecks bool
-   target, found := yamlMap["target"].(string)
-   if found {
-   auth, found := yamlMap["auth"].(map[string]interface{})
-   if found {
-   creds := auth[target].(map[string]interface{})
-   username, found = creds["username"].(string)
-   if found {
-   password, found = creds["password"].(string)
-   }
-   }
-   skipSslChecks, _ = yamlMap["skipSslChecks"].(bool)
-   }
-   return target, username, password, skipSslChecks
-}
-
 func main() {
config := io.GetConfig()
-   target, username, password, skipSslChecks := 
getNetworkCredentialsFromConfig(config.Map)
+   skipSslChecks := config.GetSkipSslChecks()
+   target, username, password, err := config.GetNetworkCredentials()
+   if err != nil && !isLogin(os.Args) {
--- End diff --

A nice to have: if the user hasn't previously called login we will error 
here. However, we could change the command to login here and continue. They 
would be prompted for a username and password.


---
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-client pull request #52: Delete requrest now only fail is an unsucc...

2017-05-23 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

https://github.com/apache/brooklyn-client/pull/52

Delete requrest now only fail is an unsuccessful code is returned



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

$ git pull https://github.com/Graeme-Miller/brooklyn-client 
update_delete_req

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

https://github.com/apache/brooklyn-client/pull/52.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 #52


commit a094624683dcbf0c0f3ab134c7f80e5fcaaf8909
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-23T14:47:17Z

Delete requrest now only fail is an unsuccessful code is returned




---
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 #186: Add todo

2017-05-23 Thread Graeme-Miller
Github user Graeme-Miller closed the pull request at:

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


---
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] [Commented] (BROOKLYN-472) YAML anchors cause failure when adding YAML blueprint to catalog

2017-05-23 Thread Graeme Miller (JIRA)

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

Graeme Miller commented on BROOKLYN-472:


[~Nakomis] could you confirm that this is because of what Mark has said above 
and close this issue if it is?

> YAML anchors cause failure when adding YAML blueprint to catalog
> 
>
> Key: BROOKLYN-472
> URL: https://issues.apache.org/jira/browse/BROOKLYN-472
> Project: Brooklyn
>  Issue Type: Bug
>Affects Versions: 0.11.0
>Reporter: Martin Harris
>Priority: Minor
>
> Deploying the following using the blueprint composer with 'Application' 
> selected *works*
> {code}
> anchors:
> - 
>   type:
> org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
>   name:System Tools
>   brooklyn.config:
> launch.command:"true"
> checkRunning.command:  "true"
> stop.command:  "true"
> pre.install.command:   "true"
> post.launch.command:   "true"
> services: [*systemTools]
> location: localhost
> {code}
> Deploying the following using the blueprint composer with 'Catalog' *doesn't 
> work*
> {code}
> anchors:
> - 
>   type:
> org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
>   name:System Tools
>   brooklyn.config:
> launch.command:"true"
> checkRunning.command:  "true"
> stop.command:  "true"
> pre.install.command:   "true"
> post.launch.command:   "true"
> brooklyn.catalog:
>   id: foobar
>   version: 1.0.0
>   itemType: template
>   name: foobar
>   item:
> services: [*systemTools]
> {code}
> It fails with the following error:
> {quote}
> Updating existing catalog entries is forbidden: foobar:1.0.0. Use forceUpdate 
> argument to override.
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] brooklyn-docs pull request #189: Split catalog

2017-05-22 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Split catalog



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

$ git pull https://github.com/Graeme-Miller/brooklyn-docs split_catalog

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

https://github.com/apache/brooklyn-docs/pull/189.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 #189


commit ba2cb7d3261beffe362af7175574fedace8a6b2c
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-22T15:08:09Z

Split location into seperate files

commit de0f5125ddee2612ffc67b659be981fe9d11383f
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-22T15:35:35Z

Made the catalog pages proper children

commit 683fcac40d0e51d28935f65337a13d750b4fbda4
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-22T15:52:12Z

Moved the catalog children

commit 0390c51d99101bc677a2466e7be1ccd62b71e34c
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-22T15:54:51Z

added layout to catalog children

commit 826258288d55d4443f3c60b0fac163f9f3eb96a7
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-22T16:26:33Z

Removed duplicate colon




---
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 #186: Add todo

2017-05-19 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Add todo



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

$ git pull https://github.com/Graeme-Miller/brooklyn-docs addTodo

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

https://github.com/apache/brooklyn-docs/pull/186.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 #186


commit 9f8541ecf345746d7d010d63eb4057b44b1a69a6
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-19T13:07:44Z

added catalog to blueprints

commit 65042d4ae1107b7b795456045156ab5a65db84bb
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-19T14:52:11Z

Revert "added catalog to blueprints"

This reverts commit 9f8541ecf345746d7d010d63eb4057b44b1a69a6.

commit 79a929f5d2385fec02fe1ca73ae0c78f4843df0e
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-19T14:52:22Z

Added a todo




---
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 #180: Update bundle upload

2017-05-19 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/180#discussion_r117458781
  
--- Diff: guide/blueprints/catalog/index.md ---
@@ -375,153 +375,120 @@ the latest non-snapshot version will be loaded when 
an entity is instantiated.
 
 ### Bundling Catalog Resources
 
-When deploying a blueprint, it is possible to deploy it as an OSGI bundle 
with additional resources scoped
-to this bundle. This is particularly useful when, for example, deploying a 
Tomcat server with a `.war` file
-which is deployed using a classpath path such as `classpath://mywar.war`.
+It is possible to add an OSGi bundle to AMP. This is useful when you have 
a blueprint that needs to reference external scripts/resources or when you have 
multiple blueprints that you want to keep in sync. Brooklyn will persist any 
uploaded bundles so that they are available after a restart, or a HA failover.
 
-In this example, we will create a simple `server` catalog item, bundled 
with a simple text file.
+In this example, we will create a simple `my-server` catalog item, bundled 
with a simple script. The script will be run when launching the server.
 
-First, create the text file with some sample contents:
+First, create a folder called bundleFolder, then add a file called 
myfile.sh to it. 
+The contents of myfile.sh should be as follows:
 
 ~~~ bash
-echo Hello, World! > myfile.txt
+echo Hello, World!
 ~~~
 
-Now create a file called `catalog.bom` with the following contents:
+Now create a file in bundleFolder called `catalog.bom` with the following 
contents:
 
 ~~~ yaml
 brooklyn.catalog:
-  bundle: script-server
+  bundle: MyServerBundle
   version: 1.0.0
-  items:
-  - id: script-server
-itemType: entity
-item:
-  type: server
-  brooklyn.config:
-files.runtime:
-  classpath://myfile.txt: files/myfile.txt
+  item:  
+id: my-server
+type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
+brooklyn.config:
+  files.runtime:
+classpath://myfile.sh: files/myfile.sh
+  launch.command: |
+chmod +x ./files/myfile.sh
+./files/myfile.sh
+
+  checkRunning.command:
+echo "Running"  
+
 ~~~
 
-The `bundle: script-server` line specifies the OSGI bundle name for this 
blueprint. Any resources included
+The `bundle: MyServerBundle` line specifies the OSGI bundle name for this 
bundle. Any resources included
 in this bundle will be accessible on the classpath, but will be scoped to 
this bundle. This prevents an
 issue where multiple bundles include the same resource.
 
-To create the bundle, simply zip the `.bom` and `.txt` files as follows:
+To create the bundle, simply use the BR command as follows:
 
 ~~~ bash
-zip script-server.zip catalog.bom myfile.txt
+br add-catalog bundleFolder
 ~~~
 
-Currently the only supported method for uploading the bundle to the server 
is via the API, e.g. using
-`curl`:
-
-~~~ bash
-curl -X POST -u admin:password -H "Content-Type: application/zip" 
--data-binary @/tmp/zip/script-server.zip "http://127.0.0.1:8081/v1/catalog;
-~~~
-
-We can now deploy an instance of our script server as follows:
+This will have added our bundle to the catalog. We can now deploy an 
instance of our server as follows:
 
 ~~~ yaml
 location: localhost
 services:
-- type: script-server
+- type: my-server
 ~~~
 
-And we can now inspect the contents of the file copied to the server
+We can now see the result of running that script. In the UI find the 
activities for this application. The start activity has a sub task called 
launch (you will have to click through multiple activities called start/launch. 
Looking at the stdout of the launch task you should see:
 
-~~~ bash
-cat 
/tmp/brooklyn-martin/apps/nl9djqbq2i/entities/EmptySoftwareProcess_g52gahfxnt/files/myfile.txt
-~~~
-~~~ bash
+~~~ bash  
 Hello, World!
 ~~~
 
-Now modify `myfile.txt` to contain a different message, change the version 
number in `catalog.bom` to
-`1.1.0`, re-build the zip file and re-post it to the server
-
-If you now deploy a new instance of the script-server using the same YAML 
as used above, you should be
-able to confirm that the new script has been copied to the server:
-
+Alternatively you can view the script directly if you ran this against 
localhost:
 ~~~ bash
-cat 
/tmp/brooklyn-martin/apps/bwu57darkd/entities/EmptySoftwareProcess_umcgshzduk/files/myfile.txt
 
+cat 
/tmp/brooklyn-username/apps/nl9djqbq2i/entities/EmptySoftwareProces

Code Contribution: Container Service

2017-05-10 Thread Graeme Miller
Hello,

We at Cloudsoft Corporation have spent some time developing functionality
on top of Brooklyn that allows a user to deploy to Swarm, Kubernetes and
Openshift. We call this functionality the Cloudsoft Container Service.

We'd like to contribute this code back to Apache Brooklyn. The code comes
complete with documentation and tests and has been well reviewed by people
within Cloudsoft. We view this as mature code, that has been shipped with
our product for some time.

To find more information about how a user would use these locations please
see this documentation[1].

If people are in favour of this, we can provide more deatails about the
code and put it to a vote.

Regards,
Graeme Miller

[1] https://docs.cloudsoft.io/ccs/locations/index.html


[GitHub] brooklyn-docs pull request #180: Update bundle upload

2017-05-10 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Update bundle upload



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

$ git pull https://github.com/Graeme-Miller/brooklyn-docs updateBundleUpload

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

https://github.com/apache/brooklyn-docs/pull/180.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 #180


commit 1ced5fa083e8b1f79d1f23d56adfed5fd376d786
Author: Martin Harris <git...@nakomis.com>
Date:   2017-04-07T09:46:43Z

Adds documentation for bundling catalog resources in a zip file

commit da1163f57bbc645da6a37615676f524b1d6e7f42
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-09T15:50:36Z

Tweaks to bundle uploaad docs

commit c71bfe3c0b2ef41f76e66325efff5bca11ab87e8
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-05-09T15:58:40Z

Minor formatting tweak to bundle guide




---
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 #605: Add series of meta effectors for composite opera...

2017-05-05 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/605
  
@grkvlt this PR is rather large, and missing tests. I suggest it is closed 
for now and we work out a way to break this down.

Some ideas for how to break it down:
*) Separate PR's per effector would be nice
*) New sensor types as separate PRs (e.g. 
AbstractCompositeEffector/PeriodicEffectorPolicy.java)
*) Refactors as separate PRs (Moving AddSensor)

This should make it easier to review and merge.

What are your thoughts on 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.
---


Re: Faster PR reviews

2017-05-04 Thread Graeme Miller
bo which isn't great for the PR raiser or the community.
So, I favour any suggestions on how to deal with these kind of situations
that further empower Brooklyn reviewers to comment on PRs like this to
raise concerns and/or ask for simplification/re-work/labs approach.

Lastly, I don't just want to single out your YOML PR here as this certainly
isn't a unique situation. Any PR which enters into the multiple thousands
of lines added is in my opinion getting too big to review- and you're not
the only one to create a PR like that!

Regards,
Graeme Miller

[1] In the interests of transparency, full data set here:
https://docs.google.com/spreadsheets/d/1zDXyhs9AOW1s3f
0Zhd3oZlAW4nKdn7hLPd-118zwPhw/edit?usp=sharing
Some notes:
*) I had to manually remove PRs from the data set that were obviously
broken (e.g. Spark 17547 <https://github.com/apache/spark/pull/17547>) or
were part of some greater release process (Kubernetes 44824
<https://github.com/kubernetes/kubernetes/pull/44824>). I have tried to do
this fairly, however there is a chance that things were removed that
shouldn't be, or things were left in that shouldn't be.
*) I tried to stick to Apache Repos. Apache doesn't host the repos on
github, it mirrors them there. Because of this it is not clear what was
closed and what was merged. The data should be thought of as containing
closed PRs not merged PRs.
*) I used the pygithub library to get this data. Code here:

> g = Github(login_or_token="user", "password")
> repo =  g.get_organization("apache").get_repo("brooklyn-server")
> first500PRs= repo.get_pulls(state="closed")[:500]
> for pr in first500PRs:
>  print pr.title, "**", pr.additions, "**", pr.deletions

*) I only looked at additions. There may be different results for
additions-subtractions (to get rid of any moved files that git couldn't
process correctly) or even additions + subtractions (if you are reviewing a
PR, you have to look at the subtractions as well)

On 4 May 2017 at 09:38, Geoff Macartney <geoff.macart...@cloudsoftcorp.com>
wrote:

> +1 to eyeballing
>
> Some other random thoughts:
>
> - but let's put some emphasis on that 3rd point about good test coverage.
> It is a lot less unnerving to accept a non-trivial PR with good test
> coverage than one without, and just reading the tests is often the best way
> to figure out what a PR is actually doing
> - "master"  _is_  pretty stable, and it would be a shame to get away from
> that;
> - I think some guidelines would help. At the end of the day each PR is a
> judgement call, but it's about setting expectations - e.g. reviewers don't
> necessarily have to figure out all the implications and possible problems a
> PR might introduce, just make an "honest effort" to review what they see.
>
>
>
>
> On Wed, 3 May 2017 at 23:52 Richard Downer <rich...@apache.org> wrote:
>
> > All,
> >
> > A lot of very good points going on here - thank you to everyone who has
> > contributed to this conversation. It's clear that we are doing a
> disservice
> > to our contributors and things need to change. We need to be merging (or,
> > rarely, rejecting) PRs consistently and promptly. Obviously, difficulty
> > comes in how we do this while keeping quality up.
> >
> > After reading the debate so far, I think Alex has come up with a simple
> and
> > sensible suggestion:
> >
> > On 03/05/2017 02:13, Alex Heneveld wrote:
> >
> > > I'm suggesting we make more of an effort, and we fall back to an
> "eyeball
> > > test" a certain period of time (7 days max, less if it's simple?),
> triage
> > > the review to look at:
> > >
> > > * clearly helpful & not obviously wrong
> > > * low-risk / doesn't break compatibility
> > > * good test coverage (and passing)
> > > * likely to be maintained
> > >
> > > If these can't be confirmed, the reviewer should say what they have
> > doubts
> > > about, maybe suggest what the contributor could do to help, or appeal
> to
> > > other committers more familiar with an area. In any case get a
> discussion
> > > going.
> > >
> > > If these do seem confirmed, I still suggest we don't merge immediately
> in
> > > the absence of a thorough review, but ping specific committers likely
> to
> > be
> > > interested.  If no thorough review after a few more days, _then_ merge.
> > >
> > > I'm not suggesting any heavyweight process, but just enough to put
> > healthy
> > > forces on us as reviewers.
> > >
> >
> > And Aled makes some sensible observations around this subject:
> >
&

[GitHub] brooklyn-server issue #645: Persist OSGi bundles

2017-04-28 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/645
  
I have briefly reviewed the code and I am in the process of testing it.
If you guys are happy to merge go ahead- I'll keep on with testing just in 
case


---
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] [Commented] (BROOKLYN-449) Intermittent NoClassDefFoundError deploying a redis blueprint

2017-04-20 Thread Graeme Miller (JIRA)

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

Graeme Miller commented on BROOKLYN-449:


There is an image here: cloudsoft.tv:6000/amp-groovy-issue that contains an AMP 
with this issue

> Intermittent NoClassDefFoundError deploying a redis blueprint
> -
>
> Key: BROOKLYN-449
> URL: https://issues.apache.org/jira/browse/BROOKLYN-449
> Project: Brooklyn
>  Issue Type: Bug
>Reporter: Duncan Grant
> Attachments: amp.debug.log, amp.info.log, karaf.log, karaf output
>
>
> I've seen the following error occasionally during redis deployment.  Most of 
> the time it seems to work.
> java.lang.NoClassDefFoundError: Could not initialize class 
> org.codehaus.groovy.runtime.InvokerHelper
> I'm deploying https://github.com/brooklyncentral/brooklyn-redis-server using 
> the catalog.tests.bom
> Sorry - the logs are in kibana and I don't know how to export them.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Updated] (BROOKLYN-449) Intermittent NoClassDefFoundError deploying a redis blueprint

2017-04-20 Thread Graeme Miller (JIRA)

 [ 
https://issues.apache.org/jira/browse/BROOKLYN-449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Graeme Miller updated BROOKLYN-449:
---
Attachment: karaf output

also attached a collection of karaf commands from a running issue with this 
error

> Intermittent NoClassDefFoundError deploying a redis blueprint
> -
>
> Key: BROOKLYN-449
> URL: https://issues.apache.org/jira/browse/BROOKLYN-449
> Project: Brooklyn
>  Issue Type: Bug
>Reporter: Duncan Grant
> Attachments: amp.debug.log, amp.info.log, karaf.log, karaf output
>
>
> I've seen the following error occasionally during redis deployment.  Most of 
> the time it seems to work.
> java.lang.NoClassDefFoundError: Could not initialize class 
> org.codehaus.groovy.runtime.InvokerHelper
> I'm deploying https://github.com/brooklyncentral/brooklyn-redis-server using 
> the catalog.tests.bom
> Sorry - the logs are in kibana and I don't know how to export them.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Updated] (BROOKLYN-449) Intermittent NoClassDefFoundError deploying a redis blueprint

2017-04-20 Thread Graeme Miller (JIRA)

 [ 
https://issues.apache.org/jira/browse/BROOKLYN-449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Graeme Miller updated BROOKLYN-449:
---
Attachment: karaf.log
amp.info.log
amp.debug.log

log files from when this issue was hit

> Intermittent NoClassDefFoundError deploying a redis blueprint
> -
>
> Key: BROOKLYN-449
> URL: https://issues.apache.org/jira/browse/BROOKLYN-449
> Project: Brooklyn
>  Issue Type: Bug
>Reporter: Duncan Grant
> Attachments: amp.debug.log, amp.info.log, karaf.log
>
>
> I've seen the following error occasionally during redis deployment.  Most of 
> the time it seems to work.
> java.lang.NoClassDefFoundError: Could not initialize class 
> org.codehaus.groovy.runtime.InvokerHelper
> I'm deploying https://github.com/brooklyncentral/brooklyn-redis-server using 
> the catalog.tests.bom
> Sorry - the logs are in kibana and I don't know how to export them.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


Re: Next release candidate

2017-04-18 Thread Graeme Miller
Hi Richard,

Duncan Grant, should this PR be merged in as it fixes node.js requirements:
https://github.com/apache/brooklyn-library/pull/98

Also, there are two fixes here for rebind:
https://github.com/apache/brooklyn-server/pull/633
https://github.com/apache/brooklyn-server/pull/634

Regards,
Graeme


On 18 April 2017 at 09:45, Duncan Godwin 
wrote:

> Hi Richard,
>
> These PRs fix JBoss in Ubuntu 16+
>
> https://github.com/apache/brooklyn-server/pull/636
> https://github.com/apache/brooklyn-library/pull/100
>
> And this PR improves our password generation by ensuring we're using secure
> random not random:
>
> https://github.com/apache/brooklyn-library/pull/99
>
> I think having them in, especially the last one would be good.
>
> Many thanks
>
> Duncan
>
> On 18 April 2017 at 08:00, Richard Downer  wrote:
>
> > All,
> >
> > What PRs should be merged into our release branch for the next 0.11.0 RC?
> >
> > Jira ticket BROOKLYN-473 was the release blocker, and it is fixed by:
> > https://github.com/apache/brooklyn-server/pull/634
> > https://github.com/apache/brooklyn-server/pull/633
> > so they are in.
> >
> > I've also had a request to merge
> > https://github.com/apache/brooklyn-library/pull/98, which fixes the
> > Node.js
> > entity on recent Ubuntu releases. I'd normally want to avoid too many
> > last-minute inclusions, but Node.js is popular at the moment so having a
> > working entity is desirable, and the PR looks low risk.
> >
> > Anything else?
> >
> > I'm planning to kick off the release at around 12:00 UTC today (1pm UK
> > time) so please respond ASAP.
> >
> > Thanks
> > Richard.
> >
>


[GitHub] brooklyn-server pull request #636: Enable older Java versions

2017-04-17 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/636#discussion_r111724361
  
--- Diff: 
utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java ---
@@ -621,6 +621,7 @@ private static Object getFlag(Map flags, String 
flagName, Object defaultVal
 public static String installJava(int version) {
 Preconditions.checkArgument(version == 6 || version == 7 || 
version == 8, "Supported Java versions are 6, 7, or 8");
 List commands = new LinkedList();
+commands.add(ok(addOpenJDKPPK()));
--- End diff --

I can't see any harm in it



---
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 #634: BROOKLYN-474: rebind to policy with private cons...

2017-04-13 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/634
  
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 issue #623: BundleMaker copy fix

2017-04-07 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/623
  
@drigodwin no, it doesn't. If we were creating a zip from scratch we would 
do what I have done here, and create a zip entry with only the name. The zip 
code would then figure out the rest.

We should be doing exactly the same thing for copying a zip, i.e. we should 
not pre-set what we think the compressed size, and other info are going to be.


---
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 #623: BundleMaker copy fix

2017-04-07 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/623
  
Can you provide steps to re-produce
@m4rkmckenna quickest way to replicate is to use the brooklyn cli from 
here: https://github.com/apache/brooklyn-client/pull/44. Using that CLI, zip up 
a folder and send it to a standard brooklyn.

Even though go creates the zip correctly, brooklyn is unable to copy it due 
to a mismatch between the amount of compressed bytes the zipfile created by go 
is reporting, and the zipfile created by java is reporting. This is likely due 
a difference between the algorithms go and java use.
--

does this happen for every uploaded zip
No, as long as the same algorithm and compression level is used this should 
not happen. I have yet to be able to recreate this with anything other than the 
zip created by go (which leads me to believe google are using a different, 
smarter algorithm)





---
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 #623: BundleMaker copy fix

2017-04-07 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

BundleMaker copy fix

When cloning a zip, we were using the ZipEntry from the input zip.
This causes issues, as the info in the input ZipEntry is not necessarily 
correct for the output zip.
Specifically, compressed size can be different. This causes exceptions when 
the wrong amount of bytes are written.

This change means that a new ZipEntry is created, and the info from the 
input ZipEntry is ignored.

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server zip_copy_fix

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

https://github.com/apache/brooklyn-server/pull/623.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 #623


commit d7908ddf303fefa7f334c3b67380a77dab96824c
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-04-07T11:21:04Z

BundleMaker copy fix




---
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-client pull request #44: Added the ability to upload a zip via the ...

2017-04-07 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

https://github.com/apache/brooklyn-client/pull/44

Added the ability to upload a zip via the CLI

@geomacy would you please review?

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

$ git pull https://github.com/Graeme-Miller/brooklyn-client upload_zip

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

https://github.com/apache/brooklyn-client/pull/44.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 #44


commit 1cf07d53241c80e1552b8af224f634ce5c7f8170
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-04-05T15:12:04Z

Added the ability to upload a zip via the CLI




---
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 #616: Fixed BlobStoreContextFactoryImpl. It can...

2017-03-31 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Fixed BlobStoreContextFactoryImpl. It can now have dsl in its config



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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
fix_blobstore_dsl

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

https://github.com/apache/brooklyn-server/pull/616.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 #616


commit 5d0d9925cc338391e528304710467de467f6a642
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-03-31T15:12:53Z

Fixed BlobStoreContextFactoryImpl. It can now have dsl in its 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 issue #594: Revert "add original failing test from @sjcorbet...

2017-03-15 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/594
  
Ok, so the circular dependency is:
* dependency has been added between brooklyn-rest-server and 
brooklyn-software-nosql
* brooklyn-rest-server is a part of brooklyn-server, as is brooklyn-core.
* brooklyn-software-nosql depends on brooklyn-core.

Brooklyn builds brooklyn-server first, then later it builds 
brooklyn-software-nosql. With this added dependency, that fails as 
brooklyn-server relies on brooklyn-software-nosql. 

We can't reverse the order as brooklyn-software-nosql relies on 
brooklyn-server (because of its brooklyn-core dependency).

In short, if you update the version numbers and try and rebuild, it will 
fail. As brooklyn-software-nosql has not been built by the time brooklyn-server 
is being built.





---
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 #594: Revert "add original failing test from @s...

2017-03-14 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Revert "add original failing test from @sjcorbett"

This reverts commit d7cbaeed46d7fedf8e49df015baa812352060f45.

That commit added a dependency on brooklyn-software-nosql.

However, this causes a circular dependency as brooklyn-software-nosql 
depends on brooklyn-server. 

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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
revert_added_test

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

https://github.com/apache/brooklyn-server/pull/594.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 #594


commit cec85c486cd815c426d9c619b0a46cbad2e901df
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-03-14T15:35:38Z

Revert "add original failing test from @sjcorbett"

This reverts commit d7cbaeed46d7fedf8e49df015baa812352060f45.




---
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 #592: Fix publication of EC2 host address in DefaultCo...

2017-03-13 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/592
  
Tested locally, works as expected:
![screen shot 2017-03-13 at 17 24 
51](https://cloud.githubusercontent.com/assets/3742990/23866871/1a04afc0-0812-11e7-90bb-755c3667f3b1.png)



---
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-447) waitForSshable deprecated without replacement

2017-03-06 Thread Graeme Miller (JIRA)
Graeme Miller created BROOKLYN-447:
--

 Summary: waitForSshable deprecated without replacement
 Key: BROOKLYN-447
 URL: https://issues.apache.org/jira/browse/BROOKLYN-447
 Project: Brooklyn
  Issue Type: Bug
Reporter: Graeme Miller
Priority: Minor


In [this PR|https://github.com/apache/brooklyn-server/pull/529] the config 
waitForSshable was deprecated in favour of the newly added config 
pollForFirstReachableAddress. However, setting pollForFirstReachableAddress 
does not have the same result as setting waitForSshable.

Issue 1)
waitForSshable is a config key that, when set to true, instructs the 
JCloudsLocation ensure that AMP can ssh to the location after it has been 
setup. pollForFirstReachableAddress will wait for the location to be setup and 
then will attempt to ensure at least one address is reachable. It would be 
possible to pass the pollForFirstReachableAddress check without being sshable.

Issue 2)
waitForSshable is also used to control creating users. If waitForSshable is set 
to true then createUser is 
[called|https://github.com/apache/brooklyn-server/blob/master/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java#L804].
 Create user will ssh into the JCloudsLocation and setup a user, which will of 
course fail if we cannot SSH into the location. For this reason in situations 
where we expect we will not be able to SSH in (e.g. using a docker container 
location based on an image without sshd), then waitForSshable is usually set to 
false which ensures we don't wait for it to be SSHable and that we don't 
attempt to create a user. pollForFirstReachableAddress does not control the 
creation of users.

--

I suggest that we remove the deprecated status from waitForSshable. Also, I 
think it would be advisable to create a new piece of config called createUser 
that controls whether or not we create users. This way we can de-couple user 
creation from waitForSshable





--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] brooklyn-server pull request #554: Ensured the \n character is escaped when ...

2017-02-16 Thread Graeme-Miller
Github user Graeme-Miller closed the pull request at:

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


---
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 #554: Ensured the \n character is escaped when escapin...

2017-02-09 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-server/pull/554
  
@aledsage has pointed out a way to get around the problem I am having, so I 
no longer need this PR. However, I think it might still be useful

@neykov, the use case here is that I have brooklyn.config like this:
```
brooklyn.config:
  brooklyn.cfg.additions: |
brooklyn.location.jclouds.aws-ec2.identity = test_ident
brooklyn.location.jclouds.aws-ec2.credential = test_key
```
Brooklyn sets the config to be 

```
brooklyn.location.jclouds.aws-ec2.identity = 
test_ident\nbrooklyn.location.jclouds.aws-ec2.credential = test_key
```
(please note '\n' is a character, not a '\\' followed by an 'n'. If you use 
a '\\' followed by an 'n' this works)

I later pump this config into a bash env variable like this:
```
shell.env:
  BROOKLYN_CFG_ADDITIONS: $brooklyn:config("brooklyn.cfg.additions")
```

However, when the string is bash encoded, the '\n' is not encoded. My 
script then ends up looking like this:
```
BROOKLYN_CFG_ADDITIONS="brooklyn.location.jclouds.aws-ec2.identity = 
test_ident
brooklyn.location.jclouds.aws-ec2.credential = test_key"
```

Which means the \n is used to create a line break in the script (which does 
nothing) rather than keeping the \n in the variable.

Changing this bash encoding means my script ends up looking like this:
```
BROOKLYN_CFG_ADDITIONS="brooklyn.location.jclouds.aws-ec2.identity = 
test_ident\nbrooklyn.location.jclouds.aws-ec2.credential = test_key"
```


Whilst Aleds suggestion will work, I worry others might try to use multi 
line bash config in the same way that I did.


---
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 #554: Ensured the \n character is escaped when ...

2017-02-09 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Ensured the \n character is escaped when escaping a string for bash



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

$ git pull https://github.com/Graeme-Miller/brooklyn-server 
bash_string_escape_fix

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

https://github.com/apache/brooklyn-server/pull/554.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 #554


commit e94e2e076511baa327ce63507da490126285de44
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-02-09T10:33:19Z

Ensured the \n character is escaped when escaping a string for bash




---
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 #147: Added knwon issues section to azure arm

2017-01-27 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Added knwon issues section to azure arm



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

$ git pull https://github.com/Graeme-Miller/brooklyn-docs 
azure_arm_known_issues

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

https://github.com/apache/brooklyn-docs/pull/147.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 #147


commit 6360e554539ba338e6eb4834b679993b3d0f0911
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-01-27T13:44:12Z

Added knwon issues section to azure arm




---
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 #142: Added docs for useMachinePublicAddressAsPri...

2017-01-25 Thread Graeme-Miller
GitHub user Graeme-Miller opened a pull request:

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

Added docs for useMachinePublicAddressAsPrivateAddress



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

$ git pull https://github.com/Graeme-Miller/brooklyn-docs add_private_ip_doc

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

https://github.com/apache/brooklyn-docs/pull/142.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 #142


commit c0fcdaac46ae568ac08963afca93133d15997e5e
Author: graeme.miller <graeme.mil...@cloudsoftcorp.com>
Date:   2017-01-25T16:10:54Z

Added docs for useMachinePublicAddressAsPrivateAddress




---
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-client issue #38: Exclude cli/.glide/* (cache) from rat + git

2017-01-23 Thread Graeme-Miller
Github user Graeme-Miller commented on the issue:

https://github.com/apache/brooklyn-client/pull/38
  
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-client pull request #38: Exclude cli/.glide/* (cache) from rat + gi...

2017-01-23 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-client/pull/38#discussion_r97389393
  
--- Diff: cli/pom.xml ---
@@ -101,6 +101,7 @@
 
 vendor/**
 glide.*
--- End diff --

looks like we were already trying to exclude it :)


---
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 #140: Add Azure Classic and ARM docs

2017-01-19 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/140#discussion_r96904988
  
--- Diff: guide/ops/locations/_azure-ARM.md ---
@@ -0,0 +1,92 @@
+---
+section: Azure Compute ARM
+section_type: inline
+section_position: 2.1.1
+---
+
+### Azure Compute ARM
+
+Azure Resource Manager (ARM) is a framework for deploying and managing 
applications across resources and managing groups of resources as single 
logical units on the Microsoft Azure cloud computing platform.
+
+ Setup the Azure credentials
+
+Firstly, install and configure Azure CLI following [these 
steps](http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/).
+
+Using the Azure CLI, run the following commands to create a service 
principal
+
+# Set mode to ARM
+azure config mode arm
+
+# Enter your Microsoft account credentials when prompted
+azure login
+
+# Set current subscription to create a service principal
+azure account set 
+
+# Create an AAD application with your information.
+azure ad app create --name  --password  --home-page 
 --identifier-uris 
+
+# For example: azure ad app create --name "myappname"  --password abcd 
--home-page "https://myappwebsite; --identifier-uris "https://myappwebsite;
+
+# Output will include a value for `Application Id`, which will be used 
for the live tests
+
+# Create a Service Principal
+azure ad sp create 
+
+# Output will include a value for `Object Id`, to be used in the next 
step 
+
+
+Run the following commands to assign roles to the service principal
+
+# Assign roles for this service principal
+azure role assignment create --objectId  -o Contributor -c 
/subscriptions//
+
+Look up the the tenant Id
+
+azure account show -s  --json
+
+# output will be a JSON which will include the `Tenant id`
+
+Verify service principal
+
+azure login -u  -p  --service-principal 
--tenant 
+
+ Using the Azure ARM Location
+
+Below is an example Azure ARM location in YAML which will launch a Ubuntu 
instance in south east asia:
+
+brooklyn.catalog:
+  id: my-azure-arm-location
+  name: "My Azure ARM location"
+  itemType: location
+  item:
+type: jclouds:azurecompute-arm
+brooklyn.config:
+  identity: 
+  credential: 
+  endpoint: 
https://management.azure.com/subscriptions/
+  oauth.endpoint: 
https://login.microsoftonline.com//oauth2/token
+  
+  jclouds.azurecompute.arm.publishers: OpenLogic
+  region: southeastasia
+  loginUser: brooklyn
+  templateOptions:
+overrideAuthenticateSudo: true 
+
+Fill the values ``, ``, `` and 
`` in from the values generated when 
--- End diff --

looks like this might be specific to me. This looks good to merge


---
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 #140: Add Azure Classic and ARM docs

2017-01-19 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/140#discussion_r96874537
  
--- Diff: guide/ops/locations/_azure-classic.md ---
@@ -0,0 +1,235 @@
+---
+section: Azure Compute Classic
+section_type: inline
+section_position: 2.1
+---
+
+### Azure Compute Classic
+ 
+Azure is a cloud computing platform and infrastructure created by 
Microsoft. Apache Brooklyn includes support for both Azure Classic and Azure 
ARM, as
+one of the [Apache jclouds](http://jclouds.org) supported clouds 
`Microsoft Azure Compute`.
+
+The two modes of using Azure are the "classic deployment" model and the 
newer "resource manager deployment" (ARM)
+model. See 
https://azure.microsoft.com/en-gb/documentation/articles/resource-manager-deployment-model/
+for details.
+
+
+ Setup the Azure credentials
+
+Microsoft Azure requests are signed by SSL certificate. You need to upload 
one into your account in order to use an Azure
+location.
+
+{% highlight bash %}
+# create the certificate request
+mkdir -m 700 $HOME/.brooklyn
+openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout 
$HOME/.brooklyn/azure.pem -out $HOME/.brooklyn/azure.pem
+# create the p12 file, and note your export password. This will be your 
test credentials.
+openssl pkcs12 -export -out $HOME/.brooklyn/azure.p12 -in 
$HOME/.brooklyn/azure.pem -name "brooklyn :: $USER"
+# create a cer file
+openssl x509 -inform pem -in $HOME/.brooklyn/azure.pem -outform der -out 
$HOME/.brooklyn/azure.cer
+{% endhighlight %}
+
+Finally, upload .cer file to the management console at 
https://manage.windowsazure.com/@myId#Workspaces/AdminTasks/ListManagementCertificates
 to authorize this certificate.
+
+Please note, you can find the "myId" value for this link by looking at the 
URL when logged into the Azure management portal.
+
+**Note**, you will need to use `.p12` format in the `brooklyn.properties`.
+
+
+ How to configure Apache Brooklyn to use Azure Compute
+
+First, in your `brooklyn.properties` define a location as follows:
+
+{% highlight properties %}
+brooklyn.location.jclouds.azurecompute.identity=$HOME/.brooklyn/azure.p12
+brooklyn.location.jclouds.azurecompute.credential=

+brooklyn.location.jclouds.azurecompute.endpoint=https://management.core.windows.net/
+brooklyn.location.jclouds.azurecompute.vmNameMaxLength=45

+brooklyn.location.jclouds.azurecompute.jclouds.azurecompute.operation.timeout=12
+brooklyn.location.jclouds.azurecompute.user=
+brooklyn.location.jclouds.azurecompute.password=
+{% endhighlight %}
+
+During the VM provisioning, Azure will set up the account with 
`` and `` automatically.
+Notice, `` must be a minimum of 8 characters and must contain 3 
of the following: a lowercase character, an uppercase
+character, a number, a special character.
+
+To force Apache Brooklyn to use a particular image in Azure, say Ubuntu 
14.04.1 64bit, one can add:
+
+
brooklyn.location.jclouds.azurecompute.imageId=b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB
+
+From $BROOKLYN_HOME, you can list the image IDs available using the 
following command:
+
+./bin/client "list-images --location azure-west-europe"
+
+To force Brooklyn to use a particular hardwareSpec in Azure, one can add 
something like:
+
+brooklyn.location.jclouds.azurecompute.hardwareId=BASIC_A2
+
+From $BROOKLYN_HOME, you can list the hardware profile IDs available using 
the following command:
+
+./bin/client "list-hardware-profiles --location azure-west-europe"
+
+At the time of writing, the classic deployment model has the possible 
values shown below.
+See 
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-size-specs/
+for further details, though that description focuses on the new "resource 
manager deployment"
+rather than "classic".
+
+ * `Basic_A0` to `Basic_A4`
+ * `Standard_D1` to `Standard_D4`
+ * `Standard_G1` to `Standard_G5`
+ * `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`
+
+
+# Named location
+
+For convenience, you can define a named location, like:
+
+{% highlight properties %}
+brooklyn.location.named.azure-west-europe=jclouds:azurecompute:West Europe
+brooklyn.location.named.azure-west-europe.displayName=Azure West Europe

+brooklyn.location.named.azure-west-europe.imageId=b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB
+brooklyn.location.named.azure-west-europe.hardwareId=BASIC_A2
+brooklyn.location.named.azure-west-euro

  1   2   >