Skip to content

Commit

Permalink
Byon dsl config - fix tests failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanayov committed Aug 4, 2017
1 parent 58847c1 commit 30dd296
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Map;
import java.util.Set;

import com.google.common.base.Preconditions;
import com.google.common.net.HostAndPort;
import org.apache.brooklyn.api.location.Location;
import org.apache.brooklyn.api.location.LocationSpec;
Expand Down Expand Up @@ -384,7 +385,10 @@ protected void updateMachineConfig(T machine, Map<?, ?> flags) {
// For backwards compatibility, where peristed state did not have this.
origConfigs = Maps.newLinkedHashMap();
}
parseMachineConfig((AbstractLocation) machine);
if (((AbstractLocation) machine).config().getBag().getAllConfig().get("provider") != null &&
((AbstractLocation) machine).config().getBag().getAllConfig().get("provider").equals("byon")) {
parseMachineConfig((AbstractLocation) machine);
}
Map<String, Object> strFlags = ConfigBag.newInstance(flags).getAllConfig();
Map<String, Object> origConfig = ((ConfigurationSupportInternal)machine.config()).getLocalBag().getAllConfig();
origConfigs.put(machine, origConfig);
Expand All @@ -399,11 +403,9 @@ private void parseMachineConfig(AbstractLocation machine) {
String winrm = machine.config().get(ConfigKeys.newStringConfigKey("winrm"));
machine.config().removeKey(ConfigKeys.newStringConfigKey("winrm"));

Map<Integer, String> tcpPortMappings = (Map<Integer, String>) machine.config().get(ConfigKeys.newConfigKey(Map.class, "tcpPortMappings"));
Preconditions.checkArgument(ssh != null || winrm != null, "Must specify exactly one of 'ssh' or 'winrm' for machine: " + machine);

if (ssh == null && winrm == null) {
throw new IllegalArgumentException("Must specify exactly one of 'ssh' or 'winrm' for machine: "+machine);
}
Map<Integer, String> tcpPortMappings = (Map<Integer, String>) machine.config().get(ConfigKeys.newConfigKey(Map.class, "tcpPortMappings"));

UserAndHostAndPort userAndHostAndPort;
String host;
Expand Down

0 comments on commit 30dd296

Please sign in to comment.