Skip to content

Commit 9b6ee91

Browse files
committed
Made possible to update modules added by url
Ticket: CFE-3847 Signed-off-by: Victor Moene <victor.moene@northern.tech>
1 parent dd4e39a commit 9b6ee91

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

cfbs/commands.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from cfbs.cfbs_config import CFBSConfig, CFBSReturnWithoutCommit
4747
from cfbs.validate import validate_config
4848
from cfbs.internal_file_management import (
49+
clone_url_repo,
4950
fetch_archive,
5051
get_download_path,
5152
local_module_copy,
@@ -660,6 +661,16 @@ def _update_variable(input_def, input_data):
660661
return changes_made
661662

662663

664+
def update_module_from_url(module):
665+
_, latest_commit = clone_url_repo(module.get("url"))
666+
667+
changes_made = module["commit"] != latest_commit
668+
if changes_made:
669+
module["commit"] = latest_commit
670+
671+
return changes_made
672+
673+
663674
@cfbs_command("update")
664675
@commit_after_command("Updated module%s", [PLURAL_S])
665676
def update_command(to_update):
@@ -707,10 +718,11 @@ def update_command(to_update):
707718
continue
708719

709720
if "version" not in module:
710-
log.warning(
711-
"Module '%s' not updatable. Skipping its update." % module["name"]
712-
)
713721
log.debug("Module '%s' has no version attribute." % module["name"])
722+
723+
changes_made = update_module_from_url(module)
724+
if not changes_made:
725+
print("Module '%s' already up to date" % module["name"])
714726
continue
715727
old_version = module["version"]
716728

0 commit comments

Comments
 (0)