I misunderstood

parent aa254b5b
......@@ -114,24 +114,15 @@ class DockerPackaging(BasePackagePlugin): # pylint: disable=too-many-instance-a
"""Save a layer from a node into db"""
try:
layer_ = DockerLayer.get(DockerLayer.diff_id == layer.diff_id)
layer_.set_available_at(node.uuid.hex)
self.save_local_paths(layer_)
# 'available_at' field is set if the node has the layer in cache directory
# fix this code if we can create traball from docker storage
if layer_.cache_path:
layer_.set_available_at(node.uuid.hex)
layer_.save()
self.log.debug("update existing layer %s, now available on new node: %s",
layer.digest, node.uuid.hex)
except DockerLayer.DoesNotExist:
layer.available_at = [node.uuid.hex] # type: ignore
layer.local_image_refs = [] # type: ignore
self.save_local_paths(layer)
# 'available_at' field is set if the node has the layer in cache directory
# fix this code if we can create traball from docker storage
if layer_.cache_path:
layer.available_at = [node.uuid.hex] # type: ignore
layer.save(force_insert=True)
self.log.debug("new layer from remote %s", str(layer))
......@@ -394,7 +385,10 @@ class DockerPackaging(BasePackagePlugin): # pylint: disable=too-many-instance-a
# skip verbose updates of records
if not skip_updating_layer:
for layer in layers:
# layer.set_available_at(self.node.uuid.hex)
# 'available_at' field is set if the node has the layer in cache directory
# fix this code if we can create traball from docker storage
if layer.cache_path:
layer.set_available_at(self.node.uuid.hex)
layer.save()
self.log.debug("image layers updated, record updated.. %s \n\n", layer.to_dict())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment