diff --git a/confidant/routes/blind_credentials.py b/confidant/routes/blind_credentials.py index 8e9ca4de..5cbf6d37 100644 --- a/confidant/routes/blind_credentials.py +++ b/confidant/routes/blind_credentials.py @@ -188,7 +188,9 @@ def create_blind_credential(): if not isinstance(data.get('metadata', {}), dict): return jsonify({'error': 'metadata must be a dict'}), 400 for cred in BlindCredential.data_type_date_index.query( - 'blind-credential', name__eq=data['name']): + 'blind-credential', + filter_condition=BlindCredential.name == data['name'] + ): # Conflict, the name already exists msg = 'Name already exists. See id: {0}'.format(cred.id) return jsonify({'error': msg, 'reference': cred.id}), 409 @@ -210,7 +212,7 @@ def create_blind_credential(): cipher_version=data['cipher_version'], modified_by=authnz.get_logged_in_user(), documentation=data.get('documentation') - ).save(id__null=True) + ).save() # Make this the current revision cred = BlindCredential( id=id, @@ -344,7 +346,7 @@ def update_blind_credential(id): cipher_version=update['cipher_version'], modified_by=authnz.get_logged_in_user(), documentation=update['documentation'] - ).save(id__null=True) + ).save() except PutError as e: logger.error(e) return jsonify( @@ -454,7 +456,7 @@ def revert_blind_credential_to_revision(id, to_revision): cipher_version=revert_credential.cipher_version, modified_by=authnz.get_logged_in_user(), documentation=revert_credential.documentation - ).save(id__null=True) + ).save() except PutError as e: logger.error(e) return jsonify( diff --git a/confidant/routes/credentials.py b/confidant/routes/credentials.py index 045170ba..489d8a45 100644 --- a/confidant/routes/credentials.py +++ b/confidant/routes/credentials.py @@ -616,7 +616,7 @@ def create_credential(): if not _check: return jsonify(ret), 400 for cred in Credential.data_type_date_index.query( - 'credential', name__eq=data['name']): + 'credential', filter_condition=Credential.name == data['name']): # Conflict, the name already exists msg = 'Name already exists. See id: {0}'.format(cred.id) return jsonify({'error': msg, 'reference': cred.id}), 409 @@ -643,7 +643,7 @@ def create_credential(): documentation=data.get('documentation'), tags=data.get('tags', []), last_rotation_date=last_rotation_date, - ).save(id__null=True) + ).save() # Make this the current revision cred = Credential( id=id, @@ -882,7 +882,7 @@ def update_credential(id): documentation=update['documentation'], tags=update['tags'], last_rotation_date=update['last_rotation_date'], - ).save(id__null=True) + ).save() except PutError as e: logger.error(e) return jsonify({'error': 'Failed to add credential to archive.'}), 500 @@ -1056,7 +1056,7 @@ def revert_credential_to_revision(id, to_revision): documentation=revert_credential.documentation, tags=revert_credential.tags, last_rotation_date=revert_credential.last_rotation_date, - ).save(id__null=True) + ).save() except PutError as e: logger.error(e) return jsonify({'error': 'Failed to add credential to archive.'}), 500 diff --git a/confidant/routes/services.py b/confidant/routes/services.py index 3d585505..f8bc9823 100644 --- a/confidant/routes/services.py +++ b/confidant/routes/services.py @@ -650,7 +650,7 @@ def map_service_credentials(id): enabled=data.get('enabled'), revision=revision, modified_by=authnz.get_logged_in_user() - ).save(id__null=True) + ).save() except PutError as e: logger.error(e) return jsonify({'error': 'Failed to add service to archive.'}), 500 @@ -811,7 +811,7 @@ def revert_service_to_revision(id, to_revision): enabled=revert_service.enabled, revision=new_revision, modified_by=authnz.get_logged_in_user() - ).save(id__null=True) + ).save() except PutError as e: logger.error(e) return jsonify({'error': 'Failed to add service to archive.'}), 500