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

Only log duplicate email & group message when we're not in refresh mode #102

Merged
merged 1 commit into from
Dec 6, 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
38 changes: 20 additions & 18 deletions lifecycle/target_suitecrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,16 @@ def _fetch_all_emails(self, refresh=False):
address = ent["attributes"]["email_address"]
_id = ent["id"]
if address in self._emails_to_id:
logging.warning(
(
"Duplicate E-mail address entries found in suitecrm server:"
"Address '%s' has IDs '%s' and '%s'. Using the first one only."
),
address,
self._emails_to_id[address],
_id,
)
if not refresh:
logging.warning(
(
"Duplicate E-mail address entries found in suitecrm server:"
"Address '%s' has IDs '%s' and '%s'. Using the first one only."
),
address,
self._emails_to_id[address],
_id,
)
else:
self._emails_to_id[address] = _id
return self._emails_to_id
Expand All @@ -279,15 +280,16 @@ def _fetch_all_groups(self, refresh=False):
groupname = ent["attributes"]["name"]
_id = ent["id"]
if groupname in self._groups_to_id:
logging.warning(
(
"Duplicate Group entries found in suitecrm server:"
"Group '%s' has IDs '%s' and '%s'. Using the first one only."
),
groupname,
self._groups_to_id[groupname],
_id,
)
if not refresh:
logging.warning(
(
"Duplicate Group entries found in suitecrm server:"
"Group '%s' has IDs '%s' and '%s'. Using the first one only."
),
groupname,
self._groups_to_id[groupname],
_id,
)
else:
self._groups_to_id[groupname] = _id
self._groups_to_attributes[groupname] = ent["attributes"]
Expand Down