@Test public void testGeneratedHostnameUsesPublicIpIfEmptyListOfPrivate() throws Exception { SshMachineLocation machine = mgmt.getLocationManager().createLocation(LocationSpec.create(SshMachineLocation.class) .configure("privateAddresses", ImmutableList.of()) .configure("address", "4.3.2.1")); assertEquals(customizer.generateHostname(machine), "ip-4-3-2-1-"+machine.getId()); }
protected String generateHostname(SshMachineLocation machine) { String hostnameTemplate = config.get(HOSTNAME_TEMPLATE); if (Strings.isNonBlank(hostnameTemplate)) { return TemplateProcessor.processTemplateContents(hostnameTemplate, machine, ImmutableMap.<String, Object>of()); } else { return null; } }
SetHostnameCustomizer extends BasicMachineLocationCustomizer { protected String generateHostname(SshMachineLocation machine) { String hostnameTemplate = config.get(HOSTNAME_TEMPLATE); if (Strings.isNonBlank(hostnameTemplate)) { return TemplateProcessor.processTemplateContents(hostnameTemplate, machine, ImmutableMap.<String, Object>of()); } else { return null; } } }
SetHostnameCustomizer extends BasicMachineLocationCustomizer { protected String generateHostname(SshMachineLocation machine) { String hostnameTemplate = config.get(HOSTNAME_TEMPLATE); if (Strings.isNonBlank(hostnameTemplate)) { return TemplateProcessor.processTemplateContents(hostnameTemplate, machine, ImmutableMap.<String, Object>of()); } else { return null; } } SetHostnameCustomizer(ConfigBag config); }
SetHostnameCustomizer extends BasicMachineLocationCustomizer { protected String generateHostname(SshMachineLocation machine) { String hostnameTemplate = config.get(HOSTNAME_TEMPLATE); if (Strings.isNonBlank(hostnameTemplate)) { return TemplateProcessor.processTemplateContents(hostnameTemplate, machine, ImmutableMap.<String, Object>of()); } else { return null; } } SetHostnameCustomizer(ConfigBag config); @Override void customize(MachineLocation machine); String setLocalHostname(SshMachineLocation machine); String setLocalHostname(SshMachineLocation machine, String hostName, String domainFixed); }
SetHostnameCustomizer extends BasicMachineLocationCustomizer { protected String generateHostname(SshMachineLocation machine) { String hostnameTemplate = config.get(HOSTNAME_TEMPLATE); if (Strings.isNonBlank(hostnameTemplate)) { return TemplateProcessor.processTemplateContents(hostnameTemplate, machine, ImmutableMap.<String, Object>of()); } else { return null; } } SetHostnameCustomizer(ConfigBag config); @Override void customize(MachineLocation machine); String setLocalHostname(SshMachineLocation machine); String setLocalHostname(SshMachineLocation machine, String hostName, String domainFixed); static final Logger log; static final ConfigKey<String> FIXED_HOSTNAME; static final ConfigKey<String> FIXED_DOMAIN; static final ConfigKey<String> HOSTNAME_TEMPLATE; static final ConfigKey<String> LOCAL_HOSTNAME; static final ConfigKey<String> LOCAL_IP; static final ConfigKey<Predicate<? super MachineLocation>> MACHINE_FILTER; }