Check for null model objects

As of v2.8.2, peewee will not create model objects with all null
fields when an FK reference is null.  We have to check the model
instances for None.  See:

  https://github.com/coleifer/peewee/issues/1012
This commit is contained in:
Brad Ison 2018-03-09 14:19:20 -05:00
parent a0d0e42d7a
commit c2ad6c5060
No known key found for this signature in database
GPG key ID: 972D14B0BE6DE287
2 changed files with 6 additions and 4 deletions

View file

@ -193,12 +193,13 @@ class BuildJobNotifier(object):
def send_notification(self, kind, error_message=None, image_id=None, manifest_digests=None): def send_notification(self, kind, error_message=None, image_id=None, manifest_digests=None):
with UseThenDisconnect(app.config): with UseThenDisconnect(app.config):
tags = self.build_config.get('docker_tags', ['latest']) tags = self.build_config.get('docker_tags', ['latest'])
trigger = self.repo_build.trigger
event_data = { event_data = {
'build_id': self.repo_build.uuid, 'build_id': self.repo_build.uuid,
'build_name': self.repo_build.display_name, 'build_name': self.repo_build.display_name,
'docker_tags': tags, 'docker_tags': tags,
'trigger_id': self.repo_build.trigger.uuid, 'trigger_id': trigger.uuid if trigger is not None else None,
'trigger_kind': self.repo_build.trigger.service.name, 'trigger_kind': trigger.service.name if trigger is not None else None,
'trigger_metadata': self.build_config.get('trigger_metadata', {}) 'trigger_metadata': self.build_config.get('trigger_metadata', {})
} }

View file

@ -221,6 +221,7 @@ class ImplementedSecurityScannerAPI(SecurityScannerAPIInterface):
'Authorization': auth_header, 'Authorization': auth_header,
} }
if layer.parent is not None:
if layer.parent.docker_image_id and layer.parent.storage.uuid: if layer.parent.docker_image_id and layer.parent.storage.uuid:
layer_request['ParentName'] = compute_layer_id(layer.parent) layer_request['ParentName'] = compute_layer_id(layer.parent)