Skip to content

Commit

Permalink
Update delete process (#6)
Browse files Browse the repository at this point in the history
* Update delete process

* Bump to version 0.2.1
  • Loading branch information
mabuaisha authored Aug 24, 2020
1 parent 7b656c2 commit 1728e50
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 33 deletions.
26 changes: 15 additions & 11 deletions examples/inputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ username: -YOUR_USERNAME-
password: -YOUR_PASSWORD-

tier1_config:
id: mo_tier1
display_name: MO Tier1 Router
description: MO Tier1 Router
id: test_tier1
display_name: Test Tier1 Router
description: Test Tier1 Router
tier0_path: /infra/tier-0s/tier0

dhcp_server_config:
id: mo_dhcp_server
display_name: MO DHCP Server
description: MO DHCP Server Config
id: test_dhcp_server
display_name: Test DHCP Server
description: Test DHCP Server Config
edge_cluster_path: /infra/sites/default/enforcement-points/default/edge-clusters/272cfe43-ebcc-49bb-8471-62a261ed8931
tags:
- scope: Name
tag: MO DHCP
tag: Test DHCP

segment_config:
id: mo_segment
display_name: MO Segment
description: MO Segment Config
id: test_segment
display_name: Test Segment
description: Test Segment Config
transport_zone_path: /infra/sites/default/enforcement-points/default/transport-zones/1b3a2f36-bfd1-443e-a0f6-4de01abc963e
connectivity_path: { get_attribute: [ tier1, path ] }
dhcp_config_path: { get_attribute: [ dhcb_server_config, path ] }
Expand All @@ -33,9 +33,13 @@ segment_config:
lease_time: 86400
resource_type: SegmentDhcpV4Config
gateway_address: 192.168.11.12/24
dhcp_ranges:
- 192.168.11.100-192.168.11.160
ip_v6_config:
dhcp_config:
server_address: fc7e:f206:db42::6/48
lease_time: 86400
resource_type: SegmentDhcpV6Config
gateway_address: fc7e:f206:db42::2/48
gateway_address: fc7e:f206:db42::2/48
dhcp_ranges:
- fc7e:f206:db42::15-fc7e:f206:db42::200
27 changes: 8 additions & 19 deletions nsx_t_plugin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from nsx_t_sdk.exceptions import NSXTSDKException
from nsx_t_sdk._compat import text_type
from nsx_t_plugin.constants import TASK_DELETE
from nsx_t_plugin.constants import (
DELETE_OPERATION,
CREATE_OPERATION,
Expand Down Expand Up @@ -209,25 +208,15 @@ def validate_if_resource_deleted(nsx_t_resource):
)
return

if TASK_DELETE not in ctx.instance.runtime_properties:
try:
nsx_t_resource.delete()
except NSXTSDKException:
ctx.logger.info(
'{0} {1} cannot be deleted now, try again'
''.format(
nsx_t_resource.resource_type,
nsx_t_resource.resource_id
)
)
raise OperationRetry(
message='{0} {1} deletion is in progress.'.format(
nsx_t_resource.resource_type,
nsx_t_resource.resource_id
)
try:
nsx_t_resource.delete()
except NSXTSDKException:
raise OperationRetry(
message='{0} {1} deletion is in progress.'.format(
nsx_t_resource.resource_type,
nsx_t_resource.resource_id
)
else:
ctx.instance.runtime_properties[TASK_DELETE] = True
)
else:
ctx.logger.info(
'Waiting for {0} "{1}" to be deleted'.format(
Expand Down
4 changes: 2 additions & 2 deletions plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
plugins:
nsx-t:
package_name: cloudify-nsx-t-plugin
source: https://github.com/Cloudify-PS/cloudify-nsx-t-plugin/archive/0.2.0.zip
package_version: '0.2.0'
source: https://github.com/Cloudify-PS/cloudify-nsx-t-plugin/archive/0.2.1.zip
package_version: '0.2.1'
executor: central_deployment_agent

dsl_definitions:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name='cloudify-nsx-t-plugin',
version='0.2.0',
version='0.2.1',
author='Cloudify Platform Ltd.',
author_email='[email protected]',
license='LICENSE',
Expand Down

0 comments on commit 1728e50

Please sign in to comment.