Skip to content

Fix provider name in lookup objects - #862

Merged
Ian Hellen (ianhelle) merged 5 commits into
microsoft:mainfrom
FlorianBracq:florian/provider-name-lookup-file
Dec 8, 2025
Merged

Fix provider name in lookup objects#862
Ian Hellen (ianhelle) merged 5 commits into
microsoft:mainfrom
FlorianBracq:florian/provider-name-lookup-file

Conversation

@FlorianBracq

Copy link
Copy Markdown
Collaborator

With the current implementation, the ChainMap of providers for a lookup will use the "settings.Provider" value, which means that if you define 2 providers with the same type but different names (for instance when using 2 instances of the same provider), only one provider would be available in lookup._all_providers

This can be tested with:

ContextProviders:
  Instance1:
    Args:
      Instance: instance1
      ApiID: valueA1
      AuthKey: valueA2
    Primary: True
    Provider: ServiceNow
  Instance2:
    Args:
      Instance: instance2
      ApiID: valueB1
      AuthKey: valueB2
    Primary: True
    Provider: ServiceNow

the chainmap is:
ChainMap({}, {'ServiceNow': <msticpy.context.contextproviders.servicenow.ServiceNow object at 0x7f737c4156d0>})

while it should be:

ChainMap({}, {'Instance1': <msticpy.context.contextproviders.servicenow.ServiceNow object at 0x7f737c4156d0>, 'Instance2': <msticpy.context.contextproviders.servicenow.ServiceNow object at 0x7f737c4156d1>}

@ianhelle

Copy link
Copy Markdown
Contributor

This is awesome Florian! I've known that this was a problem for ages and always wanted to get to fix it.

@FlorianBracq
FlorianBracq marked this pull request as ready for review November 3, 2025 13:29
@ianhelle
Ian Hellen (ianhelle) merged commit c2a0366 into microsoft:main Dec 8, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants