Skip to content

Commit

Permalink
Merge pull request #2 from cloudforet-io/main
Browse files Browse the repository at this point in the history
Add fnmatch validation in manager of account collector
  • Loading branch information
stat-kwon authored Apr 8, 2024
2 parents 767f9e1 + fda91cf commit 76337ad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugin/manager/account_collector_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
import fnmatch
import logging
from collections import deque
from spaceone.core.manager import BaseManager
Expand Down Expand Up @@ -135,7 +136,7 @@ def _create_project_response(self, parent, locations):
project_state = project_info["state"]

if (
project_id not in self.exclude_projects
self._check_exclude_project(project_id)
and project_state == "ACTIVE"
):
if self._is_trusting_project(project_id):
Expand All @@ -160,3 +161,9 @@ def _is_trusting_project(self, project_id):
return True
else:
return False

def _check_exclude_project(self, project_id):
for exclude_project_id in self.exclude_projects:
if fnmatch.fnmatch(project_id, exclude_project_id):
return False
return True

0 comments on commit 76337ad

Please sign in to comment.