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

Aled Sage commented on BROOKLYN-136:
------------------------------------

TL;DR: I lean towards us adding dynamically-created location definitions to the 
catalog. On rebind, we can combine those with the ones in brooklyn.properties.
This is an interim step. We need to figure out how this should interact with 
brooklyn.properties

---
The current code goes through the REST api 
`LocatonResource.create(LocationSpec)`. It creates a `LocationDefinition` and 
registers it by calling `mgmt.getLocationRegistry().updateDefinedLocation(l)`, 
but this is not persisted.

It currently uses the deprecated `LocationSpec`, which says "deprecated since 
0.7.0 location spec objects will not be used from the client, instead pass yaml 
location spec strings".

---
Clocker handles the problem by [simplified description] storing the location 
definitions as attributes, and on rebind it re-registers them via 
`mgmt.getLocationRegistry().updateDefinedLocation(definition)`.

---
The `CatalogResource.create(yaml)` currently only supports template, entity and 
policy. It does not support locations being created.

If we fix it so we're able to call `brooklyn().getCatalog().addItem(yaml)` with 
a yaml representation of a location definition, then we can piggyback on the 
rest of the catalog code for it to be automatically persisted.

---
There are big challenges longer term for the distinction between locations read 
from brooklyn.properties and those persisted in the catalog (once supported).

We solved this for blueprints in the catalog by saying that, once persisted, 
the catalog was the definitive source (e.g. modifying catalog.xml and 
restarting Brooklyn will have no effect; however we never liked the catalog.xml 
anyway!).

For locations, we could treat dynamically added things completely differently 
from brooklyn.properties things - i.e. only add dynamic things to the catalog, 
and only support persisting the deletion of dynamic things from the catalog.

Longer term, we want a better way to populate the locations (e.g. if a user 
starts off with no brooklyn.properties, then have a wizard guide them), and to 
maintain it.


> "Add a new location" not persisted
> ----------------------------------
>
>                 Key: BROOKLYN-136
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-136
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.7.0-SNAPSHOT
>            Reporter: Aled Sage
>
> If I use the web-console's Catalog tab, and click the "+" to add a new 
> location... The location is successfully added and is usable (i.e. it appears 
> in the drop-down list of available locations when adding an application, or 
> can be referenced in YAML).
> However, when I restart Brooklyn the location has disappeared.
> It should be persisted.



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

Reply via email to