29
29
import java .util .Map ;
30
30
import java .util .Set ;
31
31
32
+ import com .google .common .base .Preconditions ;
32
33
import com .google .common .net .HostAndPort ;
33
34
import org .apache .brooklyn .api .location .Location ;
34
35
import org .apache .brooklyn .api .location .LocationSpec ;
@@ -384,7 +385,10 @@ protected void updateMachineConfig(T machine, Map<?, ?> flags) {
384
385
// For backwards compatibility, where peristed state did not have this.
385
386
origConfigs = Maps .newLinkedHashMap ();
386
387
}
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
+ }
388
392
Map <String , Object > strFlags = ConfigBag .newInstance (flags ).getAllConfig ();
389
393
Map <String , Object > origConfig = ((ConfigurationSupportInternal )machine .config ()).getLocalBag ().getAllConfig ();
390
394
origConfigs .put (machine , origConfig );
@@ -399,11 +403,9 @@ private void parseMachineConfig(AbstractLocation machine) {
399
403
String winrm = machine .config ().get (ConfigKeys .newStringConfigKey ("winrm" ));
400
404
machine .config ().removeKey (ConfigKeys .newStringConfigKey ("winrm" ));
401
405
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 );
403
407
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" ));
407
409
408
410
UserAndHostAndPort userAndHostAndPort ;
409
411
String host ;
0 commit comments