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

fix(ingest): azuread group mapping do not stop ingestion #7169

Merged
merged 3 commits into from
Jan 30, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -513,30 +513,36 @@ def _map_identity_to_urn(self, func, id_to_extract, mapping_identifier, id_type)

def _map_azure_ad_groups(self, azure_ad_groups):
for azure_ad_group in azure_ad_groups:
corp_group_urn, error_str = self._map_identity_to_urn(
self._map_azure_ad_group_to_urn,
azure_ad_group,
"azure_ad_group_mapping",
"group",
)
if error_str is not None:
continue
group_name = self._extract_regex_match_from_dict_value(
azure_ad_group,
self.config.azure_ad_response_to_groupname_attr,
self.config.azure_ad_response_to_groupname_regex,
)
if not self.config.groups_pattern.allowed(group_name):
self.report.report_filtered(f"{corp_group_urn}")
continue
self.selected_azure_ad_groups.append(azure_ad_group)
corp_group_snapshot = CorpGroupSnapshot(
urn=corp_group_urn,
aspects=[],
)
corp_group_info = self._map_azure_ad_group_to_corp_group(azure_ad_group)
corp_group_snapshot.aspects.append(corp_group_info)
yield corp_group_snapshot
try:
yield from self._map_azure_ad_group(azure_ad_group)
except Exception as e:
self.report.report_failure("azure_ad_group", str(e))

def _map_azure_ad_group(self, azure_ad_group):
corp_group_urn, error_str = self._map_identity_to_urn(
self._map_azure_ad_group_to_urn,
azure_ad_group,
"azure_ad_group_mapping",
"group",
)
if error_str is not None:
return
group_name = self._extract_regex_match_from_dict_value(
azure_ad_group,
self.config.azure_ad_response_to_groupname_attr,
self.config.azure_ad_response_to_groupname_regex,
)
if not self.config.groups_pattern.allowed(group_name):
self.report.report_filtered(f"{corp_group_urn}")
return
self.selected_azure_ad_groups.append(azure_ad_group)
corp_group_snapshot = CorpGroupSnapshot(
urn=corp_group_urn,
aspects=[],
)
corp_group_info = self._map_azure_ad_group_to_corp_group(azure_ad_group)
corp_group_snapshot.aspects.append(corp_group_info)
yield corp_group_snapshot

# Converts Azure group profile into DataHub CorpGroupInfoClass Aspect
def _map_azure_ad_group_to_corp_group(self, group):
Expand Down