Skip to content

Commit 5ad2758

Browse files
authored
Merge pull request #286 from jakub-nt/ENT-13318
ENT-13318: Fixed 'added by' information getting wrongly overwritten during update
2 parents 5c5046a + 9549b68 commit 5ad2758

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cfbs/cfbs_json.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
from collections import OrderedDict
1414
from copy import deepcopy
1515
import logging as log
16+
from typing import Optional
1617

1718
from cfbs.index import Index
1819
from cfbs.pretty import pretty, TOP_LEVEL_KEYS, MODULE_KEYS
1920
from cfbs.utils import CFBSValidationError, read_json, CFBSExitError
2021

2122

22-
def _construct_provided_module(name, data, url, commit, added_by="cfbs add"):
23+
def _construct_provided_module(name, data, url, commit, added_by):
2324
# At this point the @commit part should be removed from url so:
2425
# either url should not have an @,
2526
# or the @ should be for [email protected]
@@ -47,7 +48,8 @@ def _construct_provided_module(name, data, url, commit, added_by="cfbs add"):
4748
"missing required key 'steps' in module definition: %s" % pretty(data)
4849
)
4950
module["steps"] = data["steps"]
50-
module["added_by"] = added_by
51+
if added_by is not None:
52+
module["added_by"] = added_by
5153
return module
5254

5355

@@ -172,7 +174,7 @@ def __getitem__(self, key):
172174
def __contains__(self, key):
173175
return key in self._data
174176

175-
def get_provides(self, added_by="cfbs add"):
177+
def get_provides(self, added_by: Optional[str]):
176178
modules = OrderedDict()
177179
assert self._data is not None
178180
if "provides" not in self._data:

cfbs/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def update_command(to_update):
631631
)
632632

633633
module_name = old_module["name"]
634-
provides = remote_config.get_provides()
634+
provides = remote_config.get_provides(old_module.get("added_by"))
635635

636636
if not module_name or module_name not in provides:
637637
continue

0 commit comments

Comments
 (0)