Skip to content

Commit 30dd296

Browse files
committed
Byon dsl config - fix tests failures
1 parent 58847c1 commit 30dd296

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

core/src/main/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocation.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.Map;
3030
import java.util.Set;
3131

32+
import com.google.common.base.Preconditions;
3233
import com.google.common.net.HostAndPort;
3334
import org.apache.brooklyn.api.location.Location;
3435
import org.apache.brooklyn.api.location.LocationSpec;
@@ -384,7 +385,10 @@ protected void updateMachineConfig(T machine, Map<?, ?> flags) {
384385
// For backwards compatibility, where peristed state did not have this.
385386
origConfigs = Maps.newLinkedHashMap();
386387
}
387-
parseMachineConfig((AbstractLocation) machine);
388+
if (((AbstractLocation) machine).config().getBag().getAllConfig().get("provider") != null &&
389+
((AbstractLocation) machine).config().getBag().getAllConfig().get("provider").equals("byon")) {
390+
parseMachineConfig((AbstractLocation) machine);
391+
}
388392
Map<String, Object> strFlags = ConfigBag.newInstance(flags).getAllConfig();
389393
Map<String, Object> origConfig = ((ConfigurationSupportInternal)machine.config()).getLocalBag().getAllConfig();
390394
origConfigs.put(machine, origConfig);
@@ -399,11 +403,9 @@ private void parseMachineConfig(AbstractLocation machine) {
399403
String winrm = machine.config().get(ConfigKeys.newStringConfigKey("winrm"));
400404
machine.config().removeKey(ConfigKeys.newStringConfigKey("winrm"));
401405

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

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

408410
UserAndHostAndPort userAndHostAndPort;
409411
String host;

0 commit comments

Comments
 (0)