[
https://issues.apache.org/jira/browse/BROOKLYN-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15228068#comment-15228068
]
Aled Sage edited comment on BROOKLYN-248 at 4/6/16 12:05 PM:
-------------------------------------------------------------
I've been looking into this and written a unit test.
The problem is at {{CampResolver.createSpecFromFull}}. At the end of that
method, it only sets the spec's displayName to the name defined in the catalog
metadata if the spec does not already have a name. For {{test-location-2}} in
the example, it already has a displayName because it has inherited all the
config etc from {{test-location-1}}.
We could change this code to always set the display name:
{noformat}
if (Strings.isNonBlank(item.getDisplayName())) {
((AbstractBrooklynObjectSpec<?,
?>)spec).displayName(item.getDisplayName());
}
{noformat}
It's not clear whether we should simply override the value. The problem then
would be the name defined in the catalog would override a name defined in the
item.
I tried the test case below, but with the original and the proposed new code,
it always gave the name "My name in items" rather than "My name in item". Not
sure what we want to do about that.
{noformat}
brooklyn.catalog:
version: 0.1.2
itemType: location
name: My name in top-level
items:
- id: loc1
name: My name in items
item:
type: localhost
name: My name in item
{noformat}
was (Author: aled.sage):
I've been looking into this and written a unit test.
The problem is at {{CampResolver.createSpecFromFull}}. At the end of that
method, it only sets the spec's displayName to the name defined in the catalog
metadata if the spec does not already have a name. For {{test-location-2}} in
the example, it already has a displayName because it has inherited all the
config etc from {{test-location-1}}.
We could change this code to always set the display name:
{noformat}
if (Strings.isNonBlank(item.getDisplayName())) {
((AbstractBrooklynObjectSpec<?,
?>)spec).displayName(item.getDisplayName());
}
{noformat}
It's not clear whether we should simply override the value. The problem then
would be the name defined in the catalog would override a name defined in the
item.
I tried the test case below, but with the original and the proposed new code,
it always gave the name "My name in items" rather than "My name in item". Not
sure what we want to do about that.
{noformat}
brooklyn.catalog:
version: 0.1.2
itemType: location
name: My name in top-level
items:
- id: loc1
name: My name in items
itemType: location
item:
type: localhost
name: My name in item
{noformat}
> Incorrect name in derived locations
> -----------------------------------
>
> Key: BROOKLYN-248
> URL: https://issues.apache.org/jira/browse/BROOKLYN-248
> Project: Brooklyn
> Issue Type: Bug
> Affects Versions: 0.9.0
> Environment: OSX
> Reporter: Duncan Godwin
>
> The following location displays "Test Location 1" for both "Test Location 1"
> and "Test Location 2" when you use it to launch an application.
> See the screenshot here:
> https://s3.amazonaws.com/drigodwin-misc/brooklyn-248-ss.png
> {code}
> brooklyn.catalog:
> version: 0.2.0
> items:
> - id: test-location-1
> name: "Test Location 1"
> itemType: location
> item:
> type: byon:(hosts="10.10.10.102")
> brooklyn.config:
> displayName: testingdisplayName
> user: testinguser
> password: testingpassword
> privateKeyFile: testingprivateKeyFile
> privateKeyPassphrase: testingprivateKeyPassphrase
> - id: test-location-2
> name: "Test Location 2"
> itemType: location
> item:
> type: test-location-1
> brooklyn.config:
> displayName: testingdisplayName2
> user: testinguser2
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)