Skip to content

Commit 766154b

Browse files
authored
Merge pull request #9 from lhhyung/master
Fix error when calling collect_region in collect_resources
2 parents d4c3a0a + ce74203 commit 766154b

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

Diff for: src/plugin/manager/base.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import os
21
import abc
3-
import logging
42
import datetime
5-
import time
3+
import logging
4+
import os
65
import re
6+
import time
77
from typing import Union
88

9-
from spaceone.core.manager import BaseManager
109
from spaceone.core import utils
10+
from spaceone.core.manager import BaseManager
1111
from spaceone.inventory.plugin.collector.lib import *
1212

1313
_LOGGER = logging.getLogger("spaceone")
@@ -52,6 +52,13 @@ def list_managers_by_cloud_service_groups(cls, cloud_service_groups: list) -> li
5252
if manager.cloud_service_group:
5353
yield manager
5454

55+
@classmethod
56+
def get_managers_by_cloud_service_group(cls, cloud_service_group: str):
57+
sub_cls = cls.__subclasses__()
58+
for manager in sub_cls:
59+
if manager.__name__ == cloud_service_group:
60+
return manager
61+
5562
@classmethod
5663
def collect_metrics(cls, cloud_service_group: str):
5764
if not os.path.exists(os.path.join(_METRIC_DIR, cloud_service_group)):
@@ -93,7 +100,14 @@ def collect_resources(self, options: dict, secret_data: dict, schema: str):
93100
yield cloud_service
94101
success_count, error_count = total_count
95102

96-
yield from self.collect_region(secret_data)
103+
subscriptions_manager = (
104+
AzureBaseManager.get_managers_by_cloud_service_group(
105+
"SubscriptionsManager"
106+
)
107+
)
108+
location_info = subscriptions_manager().list_location_info(secret_data)
109+
110+
yield from self.collect_region(location_info)
97111

98112
except Exception as e:
99113
yield make_error_response(

0 commit comments

Comments
 (0)