From b3bfbd1479261edf842c7ae8b01bed0ee05cfe06 Mon Sep 17 00:00:00 2001 From: Tim Orling Date: Thu, 9 Nov 2023 12:11:54 -0800 Subject: [PATCH] update.py: fix updates_enabled for newbranch When a new release is run for the first time, no LayerBranch exists yet and the update_enabled cannot be queried. The unintended result is that all layers are skipped. Move the update_enabled check into the code path where the layerbranch already exists. Signed-off-by: Tim Orling --- layerindex/update.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/layerindex/update.py b/layerindex/update.py index e7e5c63..3da74e3 100755 --- a/layerindex/update.py +++ b/layerindex/update.py @@ -361,6 +361,12 @@ def main(): if layerbranch.actual_branch: branchname = layerbranch.actual_branch branchdesc = "%s (%s)" % (branch, branchname) + + layerbranch_updates_enabled = LayerBranch.objects.filter(layer=layer, + branch=branchobj.id, updates_enabled=True) + if not layerbranch_updates_enabled: + logger.info("Skipping update of layer %s branch %s - updates disabled" % (layer.name, branchname)) + continue else: # LayerBranch doesn't exist for this branch, create it temporarily # (we won't save this - update_layer.py will do the actual creation @@ -375,11 +381,6 @@ def main(): if layerbranch_source: layerbranch.vcs_subdir = layerbranch_source.vcs_subdir - layerbranch_updates_enabled = LayerBranch.objects.filter(layer=layer, branch=branchobj.id, updates_enabled=True) - if not layerbranch_updates_enabled: - logger.info("Skipping update of layer %s branch %s - updates disabled" % (layer.name, branchname)) - continue - # Collect repo info urldir = layer.get_fetch_dir() repodir = os.path.join(fetchdir, urldir)