Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

Commit

Permalink
fix of delete-subnet command
Browse files Browse the repository at this point in the history
  • Loading branch information
hodigy committed Apr 14, 2017
1 parent f88b03f commit 2fd9b8f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions otcclient/plugins/ecs/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,21 @@ def create_subnet():
args = [
arg( '--subnet-name', dest='SUBNETNAME', help='Name of the subnet reference will use during VM creation'),
arg( '--subnet-id', dest='SUBNETID', help='Id of the subnet will use during VM creation'),
arg('--vpc-name',dest='VPCNAME', help='Name of the VPC reference will use during VM creation'),
arg( '--vpc-id', dest='VPCID', help='Id of the VPC will use during VM creation')
]
)
def delete_subnet():
if not (OtcConfig.VPCNAME is None):
ecs.convertVPCNameToId()
if OtcConfig.SUBNETNAME:
ecs.convertSUBNETNameToId()

url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1/" + OtcConfig.PROJECT_ID + "/subnets" + OtcConfig.SUBNETID
url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1/" + OtcConfig.PROJECT_ID + "/vpcs/" + OtcConfig.VPCID + "/subnets/" + OtcConfig.SUBNETID
ret = utils_http.delete(url)
if OtcConfig.DEBUG:
print(url)
print(ret)
return ret


Expand Down Expand Up @@ -965,6 +971,7 @@ def convertVOLUMENameToId():

@staticmethod
def convertSUBNETNameToId():

url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1/" + OtcConfig.PROJECT_ID + "/subnets"
ar = []

Expand All @@ -982,7 +989,9 @@ def convertSUBNETNameToId():
if len(ret) > 0:
ret = ret + ","
ret = ret + subnet["id"]
OtcConfig.SUBNETID = ret

OtcConfig.SUBNETID = ret


@staticmethod
def convertIMAGENameToId():
Expand Down

0 comments on commit 2fd9b8f

Please sign in to comment.