Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fnmatch validation in manager of account collector #2

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading