azure-devops-python-api
azure-devops-python-api copied to clipboard
Client Returns undefined while checking get_feature_state_for_scope for new project
Hello Team,
I am using python API to check if there are some features enabled/disbaled at Project level e.g Repo's and Pipeline's.
Issue is that when a Private Project is created, everything is enabled by default. When I check the state for such projects it returns undefined
Below is the sample code and results:
feature_client = connection.clients_v7_0.get_feature_management_client()
repo: ContributedFeatureState = feature_client.get_feature_state_for_scope(feature_id='ms.vss-code.version-control', user_scope='host', scope_name='project', scope_value='<PROJECT_ID/NAME>')
pipeline: ContributedFeatureState = feature_client.get_feature_state_for_scope(feature_id='ms.vss-build.pipelines', user_scope='host', scope_name='project', scope_value='<PROJECT_ID/NAME>')
print(repo)
print(pipeline)
Results:
{
'additional_properties': {},
'feature_id': 'ms.vss-code.version-control',
'overridden': None,
'reason': None,
'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x10f2c2580>,
'state': 'undefined'
}
{
'additional_properties': {},
'feature_id': 'ms.vss-build.pipelines',
'overridden': None,
'reason': None,
'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x10f2c2af0>,
'state': 'undefined'
}
When I manually disable these features at Project level then it is able to identify them:
Disabled:
{
'additional_properties': {},
'feature_id': 'ms.vss-code.version-control',
'overridden': None,
'reason': None,
'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1019d4580>,
'state': 'disabled'
}
{
'additional_properties': {},
'feature_id': 'ms.vss-build.pipelines',
'overridden': None,
'reason': None,
'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1019d4af0>,
'state': 'disabled'
}
enabled back again:
{
'additional_properties': {},
'feature_id': 'ms.vss-code.version-control',
'overridden': None,
'reason': None,
'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1050d4580>,
'state': 'enabled'
}
{
'additional_properties': {},
'feature_id': 'ms.vss-build.pipelines',
'overridden': None,
'reason': None,
'scope': <azure.devops.v7_0.feature_management.models.ContributedFeatureSettingScope object at 0x1050d4af0>,
'state': 'enabled'
}
Can you please guide on this, shall we assume that if it is undefined it is enabled
Best Jashan