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

fix npe when no public address for MarathonTaskLocation.targetMachine #265

Merged
merged 1 commit into from Mar 29, 2016
Merged

fix npe when no public address for MarathonTaskLocation.targetMachine #265

merged 1 commit into from Mar 29, 2016

Conversation

johnmccabe
Copy link
Member

Fixes the issue raised in #264, have tested in Blue Box VPN in both a publically accessible cluster and one accessible only via VPN.

@grkvlt I don't have a solid grasp on the handling of hostnames in this case so suspect this may be too simplistic a fix.

@@ -149,7 +150,7 @@ public HostAndPort openPortForwarding(HasNetworkAddresses targetMachine, int tar
publicSide = HostAndPort.fromParts(marathonHostname, targetPort);
}
pfw.associate(marathonHostname, publicSide, (Location) targetMachine, targetPort);
portmap.put(publicSide, HostAndPort.fromParts(targetMachine.getHostname(), targetPort));
portmap.put(publicSide, HostAndPort.fromParts(((MarathonTaskLocation) targetMachine).getSubnetHostname(), targetPort));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe do something like:

MarathonTaskLocation location = (MarathonTaskLocation) targetMachine;
pfw.associate(marathonHostname, publicSide, targetMachine, targetPort);
String hostname = Optional.fromNullable(location.getHostname()).or(location.getSubnetHostname());
portmap.put(publicSide, HostAndPort.fromParts(hostname, targetPort));

aledsage added a commit to aledsage/clocker that referenced this pull request Mar 29, 2016
@aledsage aledsage merged commit d5eef0a into brooklyncentral:master Mar 29, 2016
@grkvlt
Copy link
Member

grkvlt commented Mar 29, 2016

@johnmccabe @aledsage Are you sure this is right?

grkvlt added a commit that referenced this pull request Apr 2, 2016
…ase/1.1.x

* 'master' of github.com:brooklyncentral/clocker:
  Update Brooklyn to 0.10.0-SNAPSHOT
  Mesos: fix rebind, and don’t include “unmanaged” tasks
  DockerUtils: fix deprecated use of addEnricher
  Mesos: avoid duplicate sensor-changed events
  Marathon NPE for private host: address PR #265
  Fix DockerHost failing if local certs-dir not existing
  fix npe when no public address for MarathonTaskLocation.targetMachine
  MesosFramework.scanTasks: add TODO about race
  MarathonTask: better handle unmanaged tasks
  Minor logging improvements
  Mesos: not “onfire” if just task/app onfire
  Mesos: fix rebind

Conflicts:
	jsgui/src/main/webapp/index.html
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

Successfully merging this pull request may close these issues.

None yet

3 participants