Azure / azure-iot-hub-python

Azure IoT Hub Data Plane Python SDK
MIT License
15 stars 11 forks source link

Deployment configuration updates fail when using IoTHubConfigurationManager.update_configuration #2

Open debugaftercoffee opened 2 years ago

debugaftercoffee commented 2 years ago

Context

It is not possible to update a device configuration using IoTHubConfigurationManager.update_configuration. All requests result in Operation returned an invalid status code 'Conflict'. In the code example below, I retrieve an existing configuration, change the target_condition and then attempt to update it.

Code sample exhibiting the issue

from msrest.exceptions import HttpOperationError
from azure.iot.hub import IoTHubConfigurationManager

config_service = IoTHubConfigurationManager(iothub_conn_str)

# retrieve an existing deployment
current_config = config_service.get_configuration("my_deployment")
print(current_config)

# change the target condition
current_config.target_condition = "tags.environment='test'"

try:
    config_service.update_configuration(current_config, current_config.etag)
except HttpOperationError as ex:
    print(ex)