Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] az cli raised InvalidConfigurationTargetCondition error when target condition contains "IN" operator #347

Closed
spinosae opened this issue May 21, 2021 · 3 comments

Comments

@spinosae
Copy link

Describe the bug
I was trying to set target condition for an edge deployment. In this case it contained a "IN" operator.

az iot edge deployment update -n my-hub --deployment-id my-deployment --set targetCondition="tags.my_tag in ['true', true]"

Above command failed with error {'Message': 'ErrorCode:InvalidConfigurationTargetCondition;BadRequest',...}

I could apply same target condition from Azure Portal without issue.

Actually I couldn't find a definitive schema for target condition. "IN" operator was not mentioned in Microsoft documentation. I guessed it. Similar issue was reported here, Azure/azure-iot-sdk-csharp#908

To Reproduce

try this command against a valid iot hub and edge deployment:

az iot edge deployment update -n my-hub --deployment-id my-deployment --set targetCondition="tags.my_tag in ['true', true]"

Expected behavior
The command should succeed.

Environment (please complete the following information):

  • OS: WSL 2 ubuntu 18.04
  • Shell: WSL 2 bash
  • Az CLI version: 2.23.0
  • IoT extension version: 0.10.11
@digimaun
Copy link
Member

Hey @spinosae , thanks for submitting this issue.

When you say:

I could apply same target condition from Azure Portal without issue.

Are you sure it worked? I tried to repro the success in portal and while the initial indication appears it worked (via green check mark etc)

image

Upon a closer look (with the browser dev tools) shows the same service error is thrown:

image

@digimaun
Copy link
Member

To support your scenario now, you could try writing the target condition like: "tags.my_tag='true' OR tags.my_tag=true"

@digimaun
Copy link
Member

Closing due to inactivity. You can comment here and we can re-open if needed.

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

No branches or pull requests

2 participants