Skip to content

Commit

Permalink
Merge pull request #1913 from openedx/asheehan-edx/sso-orchestrator-e…
Browse files Browse the repository at this point in the history
…xception-handling

chore: orchestrator exception handling and submission refinements
  • Loading branch information
alex-sheehan-edx authored Oct 17, 2023
2 parents 7f668f8 + 5e9c8f0 commit 8ce4ce3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Change Log
Unreleased
----------
[4.6.6]
-------
chore: orchestrator exception handling and submission refinements

[4.6.5]
-------
feat: Added logs for Degreed2 client
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.6.5"
__version__ = "4.6.6"
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def update(self, request, *args, **kwargs):
with transaction.atomic():
sso_configuration_record.update(**request_data)
sso_configuration_record.first().submit_for_configuration(updating_existing_record=True)
except (TypeError, FieldDoesNotExist, ValidationError) as e:
except (TypeError, FieldDoesNotExist, ValidationError, SsoOrchestratorClientError) as e:
LOGGER.error(f'{CONFIG_UPDATE_ERROR}{e}')
return Response({'error': f'{CONFIG_UPDATE_ERROR}{e}'}, status=HTTP_400_BAD_REQUEST)
serializer = self.serializer_class(sso_configuration_record.first())
Expand Down
7 changes: 4 additions & 3 deletions enterprise/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4082,7 +4082,8 @@ def submit_for_configuration(self, updating_existing_record=False):
config_data = {}
if self.identity_provider == self.SAP_SUCCESS_FACTORS:
for field in self.sap_config_fields:
sap_data[utils.camelCase(field)] = getattr(self, field)
if field_value := getattr(self, field):
sap_data[utils.camelCase(field)] = field_value
is_sap = True
else:
for field in self.base_saml_config_fields:
Expand All @@ -4091,8 +4092,8 @@ def submit_for_configuration(self, updating_existing_record=False):
config_data['enable'] = True
else:
config_data['enable'] = getattr(self, field)
else:
config_data[utils.camelCase(field)] = getattr(self, field)
elif field_value := getattr(self, field):
config_data[utils.camelCase(field)] = field_value

EnterpriseSSOOrchestratorApiClient().configure_sso_orchestration_record(
config_data=config_data,
Expand Down

0 comments on commit 8ce4ce3

Please sign in to comment.