generated from IBM/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
In ELM Python Client, the method set_local_config incorrectly selects the last matching contribution
from get_gc_contributions instead of the first one.
For GCM-enabled projects, this can result in returning the wrong local_config_uri.
Steps to Reproduce
- Have a project with a Global Configuration (GCM) and multiple contributions for the same project/component.
- Call:
set_local_config(name_or_uri, global_config_uri=...)
- Observe that the returned
local_config_uricorresponds to the last contribution in the flatList, not the first.
Expected Behavior
According to the official GC SDK documentation, the flatList returned by
flatListOfContributionsForGcHierarchy is depth-first ordered.
The first matching contribution should be used as it respects the "child overwrites parent" rule.
Actual Behavior
The last matching contribution is selected, which may be incorrect.
Proposed Fix
In set_local_config, break immediately after the first match:
for config in gc_contribs['configurations']:
if config['componentUri'] == self.project_uri:
config_uri = config['configurationUri']
break # first match is correct according to GC SDK
This ensures the local_config_uri is correctly selected according to the official ordering.
References
Metadata
Metadata
Assignees
Labels
No labels