opentelekomcloud / python-otcclient

(Obsolete) Python bindings to the T-Systems OTC API
MIT License
15 stars 20 forks source link

Security Groups are no longer tagged with the VPC so the convertSECUGROUPNameToId() does not return a result if the VPC is specified #47

Closed 28formica77 closed 7 years ago

28formica77 commented 7 years ago

The problem seems to lie with these if checks:

        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

with --security-group-ids, it works.

hodigy commented 7 years ago

fixed in pull req. #50

zsoltn commented 7 years ago

Based on @hodigy comment I close.