Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parent location in YAML dominates child location due to start behaviour #1377

Open
ahgittin opened this issue May 9, 2014 · 3 comments
Open

Comments

@ahgittin
Copy link
Member

ahgittin commented May 9, 2014

not sure whether this is a bug, but it's a bit surprising and wanted to open it for discussion

currently if you supply yaml such as

location: byon:(hosts="127.0.0.1", name=loopback on app)
services:
- serviceType: brooklyn.entity.basic.EmptySoftwareProcess
  location: localhost:(name=localhost on entity)

the SoftwareProcess entity (empty in this case but same for any) provisions the VM against "loopback on app". it ends up having two locations against it, the first being the provisioning location for localhost ("on entity") due to its being set there at creation time, and the second being an SshMachineLocation in the byon ("loopback on app"), due to the byon provisioning being passed in to start.

the behaviour in SoftwareProcess.start that it prefers locations passed in is sensible enough, and the behaviour at the AbstractApplication.start that it passes its locations to startable children is sensible enough, but the end result is surprising.

IOW i'd have expected any of:

  1. an error as it has two incompatible locations
  2. ignore the parent (ie the yaml spec is treats location at child as an override)
  3. provision in both (though for SoftwareProcess this would not be allowed)

but not
0. ignore the child

what it suggests larger is that perhaps we're being wrong-headed with start(Location) being such a strong pattern. maybe AbstractApplication.start() behaviour should just pass through to children, not attempting to pick up locations defined there, putting the onus on child.start who, when he is looking for a location, will if nothing is passed in or locally specified, walk his ancestor hierarchy.

this would effectively switch behaviour from 0 to 2.

i think that would be a pretty easy code change and would have no impact in normal cases. and on top of that we could where desired implement 1 or 3 instead, of course.

thoughts?

@ahgittin
Copy link
Member Author

ahgittin commented May 9, 2014

test demonstrating this in io.brooklyn.camp.brooklyn.EmptySoftwareProcessYamlTest.testWithAppAndEntityLocations()

@ahgittin
Copy link
Member Author

ahgittin commented May 9, 2014

also alluded to in docs wrt simple-appserver-with-location-byon.yaml in creating-yaml.md (where this was discovered); if we switch to 2 we can be explicit in the docs that the child location dominates

@aledsage
Copy link
Member

This behaviour has now changed - see @ahgittin 's email to the dev@brooklyn mailing list, subject "Locations defined on child items -- Inheriting and overriding locations" on "14/01/2016, 15:52".

aledsage added a commit to aledsage/incubator-brooklyn that referenced this issue Jan 19, 2016
aledsage added a commit to aledsage/incubator-brooklyn that referenced this issue Jan 20, 2016
asfgit pushed a commit to apache/brooklyn-server that referenced this issue Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants