aboutsummaryrefslogtreecommitdiffstats
path: root/app/discover/fetchers/api/api_fetch_networks.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/discover/fetchers/api/api_fetch_networks.py')
-rw-r--r--app/discover/fetchers/api/api_fetch_networks.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/discover/fetchers/api/api_fetch_networks.py b/app/discover/fetchers/api/api_fetch_networks.py
index 4b70f65..f76517a 100644
--- a/app/discover/fetchers/api/api_fetch_networks.py
+++ b/app/discover/fetchers/api/api_fetch_networks.py
@@ -34,7 +34,7 @@ class ApiFetchNetworks(ApiAccess):
"X-Auth-Token": token["id"]
}
response = self.get_url(req_url, headers)
- if not "networks" in response:
+ if "networks" not in response:
return []
networks = response["networks"]
req_url = endpoint + "/v2.0/subnets"
@@ -46,7 +46,6 @@ class ApiFetchNetworks(ApiAccess):
for s in subnets:
subnets_hash[s["id"]] = s
for doc in networks:
- doc["master_parent_type"] = "project"
project_id = doc["tenant_id"]
if not project_id:
# find project ID of admin project
@@ -57,12 +56,12 @@ class ApiFetchNetworks(ApiAccess):
if not project:
self.log.error("failed to find admin project in DB")
project_id = project["id"]
- doc["master_parent_id"] = project_id
- doc["parent_type"] = "networks_folder"
- doc["parent_id"] = project_id + "-networks"
- doc["parent_text"] = "Networks"
- # set the 'network' attribute for network objects to the name of network,
- # to allow setting constraint on network when creating network clique
+ self.set_folder_parent(doc, object_type='network',
+ master_parent_id=project_id,
+ master_parent_type='project')
+ # set the 'network' attribute for network objects to the name of
+ # network, to allow setting constraint on network when creating
+ # network clique
doc['network'] = doc["id"]
# get the project name
project = self.inv.get_by_id(self.get_env(), project_id)