opentelekomcloud / python-otcclient

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

Issue creating ingress/egress rules #45

Closed mattbarrio closed 7 years ago

mattbarrio commented 7 years ago

ISSUE

When creating a security group and then adding an ingress/egress rule with a VPC and group-names flag set it fails

STEPS TO REPRODUCE

When creating a security group via the following command: otc ecs create-security-group --group-names ${ENV_NAME}-secgroup --vpc-name ${ENV_NAME}-vpc

openstack security group list | ID | Name | Description | Project | | 04ea89d2-caa4-4007-a811-bcdcca6c45f3 | ol-staging-secgroup | | |

It does not set the VPC correctly. This causes adding a security group rule with the VPC and group-names flags set to fail as this check does not return any security group id from convertSECUGROUPNameToId()

root@09fcbc9483fe:/src# otc ecs authorize-security-group-ingress --group-names ${ENV_NAME}-secgroup --vpc-name ${ENV_NAME}-vpc --protocol tcp --ethertype IPv4 --portmin 22 --portmax 22 --cidr 0.0.0.0/0 otc: TypeError("cannot concatenate 'str' and 'NoneType' objects",) for help use --help

After updating the description with the VPC id and running the same command it is successful in adding the security rule.

I believe this stems from the following change: https://github.com/OpenTelekomCloud/python-otcclient/issues/41 Possible that the os-security-group endpoint is not handling the vpc correctly when creating the group.

hodigy commented 7 years ago

Creation of a securtiy group is made by a call to API 7.2 Creating a Security Group (Native OpenStack API), described in ECS API reference. https://docs.otc.t-systems.com/en-us/doc/pdf/20170329/20170329173651_87827.pdf

This call doesn't accept VPC definition anymore. So your 1st example command is working correctly.

Mainly convertSECUGROUPNameToId needs to be corrected, I'm working on it at https://github.com/OpenTelekomCloud/python-otcclient/issues/47

hodigy commented 7 years ago

fixed in pull req. #50

zsoltn commented 7 years ago

Based on @hodigy comment I close.