Skip to content

Conversation

@FlorianBracq
Copy link
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
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 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