if security_group.get("name") == OtcConfig.SECUGROUPNAME and ( security_group.get("vpc_id") == OtcConfig.VPCID or OtcConfig.VPCID is None ) :
OtcConfig.SECUGROUP = security_group["id"]
if security_group.get("name") == OtcConfig.SOURCE_GROUP and ( security_group.get("vpc_id") == OtcConfig.VPCID or OtcConfig.VPCID is None ) :
OtcConfig.SOURCE_GROUP_ID = security_group["id"]
the second condition is not satisfied if the VPC is specified but the SG is not tagged.
( security_group.get("vpc_id") == OtcConfig.VPCID or OtcConfig.VPCID is None )
This extra check seems unnecessary?
So this command fails for new security groups but not old ones.
otc ecs run-instances --count 1 --instance-type c1.medium --instance-name TEST_VM_API --image-name Standard_openSUSE_42.1_JeOS_latest --subnet-name subnet-az1-131 --vpc-name TEST --group-names TEST --key-name TEST
The problem seems to lie with these if checks:
the second condition is not satisfied if the VPC is specified but the SG is not tagged.
( security_group.get("vpc_id") == OtcConfig.VPCID or OtcConfig.VPCID is None )
This extra check seems unnecessary?
So this command fails for new security groups but not old ones.
otc ecs run-instances --count 1 --instance-type c1.medium --instance-name TEST_VM_API --image-name Standard_openSUSE_42.1_JeOS_latest --subnet-name subnet-az1-131 --vpc-name TEST --group-names TEST --key-name TEST
with --security-group-ids, it works.