Skip to content
This repository has been archived by the owner on Feb 14, 2025. It is now read-only.

Commit

Permalink
precommit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroroiz committed Apr 8, 2024
1 parent 33e801e commit 7830ee0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions confidant/routes/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,12 @@ def create_credential():
return jsonify(error_msg), 403

data = request.get_json()
if not data.get('documentation') and settings.get('ENFORCE_DOCUMENTATION'):
if not data.get('documentation') \
and settings.get('ENFORCE_DOCUMENTATION'):
return jsonify({'error': 'documentation is a required field'}), 400
if not data.get('credential_pairs'):
return jsonify({'error': 'credential_pairs is a required field'}), 400
error = {'error': 'credential_pairs is a required field'}
return jsonify(error), 400
if not isinstance(data.get('metadata', {}), dict):
return jsonify({'error': 'metadata must be a dict'}), 400
# Ensure credential pair keys are lowercase
Expand Down Expand Up @@ -892,7 +894,8 @@ def update_credential(id):
).save()
except PutError as e:
logger.error(e)
return jsonify({'error': 'Failed to add credential to archive.'}), 500
error = {'error': 'Failed to add credential to archive.'}
return jsonify(error), 500
try:
cred = Credential(
id=id,
Expand All @@ -912,7 +915,8 @@ def update_credential(id):
cred.save()
except PutError as e:
logger.error(e)
return jsonify({'error': 'Failed to update active credential.'}), 500
error = {'error': 'Failed to update active credential.'}
return jsonify(error), 500

if services:
service_names = [x.id for x in services]
Expand Down

0 comments on commit 7830ee0

Please sign in to comment.