Network deployment deleter, refactored
diff --git a/planetstack/openstack_observer/steps/sync_network_deployments.py b/planetstack/openstack_observer/steps/sync_network_deployments.py
index 04f3270..c776ff1 100644
--- a/planetstack/openstack_observer/steps/sync_network_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_network_deployments.py
@@ -16,31 +16,34 @@
     requested_interval = 0 
     provides=[Network, NetworkDeployments, Sliver]
     
-    def fetch_pending(self):
-        # network deployments are not visible to users. We must ensure
-        # networks are deployed at all deploymets available to their slices. 
-        slice_deployments = SliceDeployments.objects.all()
-        slice_deploy_lookup = defaultdict(list)
-        for slice_deployment in slice_deployments:
-            slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
-        
-        network_deployments = NetworkDeployments.objects.all()
-        network_deploy_lookup = defaultdict(list)
-        for network_deployment in network_deployments:
-            network_deploy_lookup[network_deployment.network].append(network_deployment.deployment)
+    def fetch_pending(self, deleted):
+        if (deleted):
+            return NetworkDeployments.deleted_objects.all()
+        else:
+            # network deployments are not visible to users. We must ensure
+            # networks are deployed at all deploymets available to their slices. 
+            slice_deployments = SliceDeployments.objects.all()
+            slice_deploy_lookup = defaultdict(list)
+            for slice_deployment in slice_deployments:
+                slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
+            
+            network_deployments = NetworkDeployments.objects.all()
+            network_deploy_lookup = defaultdict(list)
+            for network_deployment in network_deployments:
+                network_deploy_lookup[network_deployment.network].append(network_deployment.deployment)
 
-        for network in Network.objects.filter():
-            # ignore networks that have
-            # template.visibility = private and translation = none
-            if network.template.visibility == 'private' and not network.template.translation == 'none':
-                continue				
-            expected_deployments = slice_deploy_lookup[network.owner]
-            for expected_deployment in expected_deployments:
-                if network not in network_deploy_lookup or \
-                  expected_deployment not in network_deploy_lookup[network]:
-                    nd = NetworkDeployments(network=network, deployment=expected_deployment)
-                    nd.save()
-        return NetworkDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+            for network in Network.objects.filter():
+                # ignore networks that have
+                # template.visibility = private and translation = none
+                if network.template.visibility == 'private' and not network.template.translation == 'none':
+                    continue				
+                expected_deployments = slice_deploy_lookup[network.owner]
+                for expected_deployment in expected_deployments:
+                    if network not in network_deploy_lookup or \
+                      expected_deployment not in network_deploy_lookup[network]:
+                        nd = NetworkDeployments(network=network, deployment=expected_deployment)
+                        nd.save()
+            return NetworkDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
 
     def get_next_subnet(self, deployment=None):
         # limit ourself to 10.0.x.x for now
@@ -114,4 +117,15 @@
                 raise e            
         
           
-    
+    def delete_record(self, network_deployment): 
+        driver = OpenStackDriver().client_driver(caller=network_deployment.network.owner.creator,
+                                                 tenant=network_deployment.network.owner.name,
+                                                 deployment=network_deployment.deployment.name)
+        if (network_deployment.router_id) and (network_deployment.subnet_id):
+            driver.delete_router_interface(network_deployment.router_id, network_deployment.subnet_id)
+        if network_deployment.subnet_id:
+            driver.delete_subnet(network_deployment.subnet_id)
+        if network_deployment.router_id:
+            driver.delete_router(network_deployment.router_id)
+        if network_deployment.net_id:
+            driver.delete_network(network_deployment.net_id)