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

TXT records set through SDK calls results in improper string value #1376

Closed
h-hwang opened this issue Aug 17, 2017 · 4 comments
Closed

TXT records set through SDK calls results in improper string value #1376

h-hwang opened this issue Aug 17, 2017 · 4 comments
Labels
ARM question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.

Comments

@h-hwang
Copy link

h-hwang commented Aug 17, 2017

I am using the DNSManagementClient to make record changes to zones in Azure. It seems there is a bug when creating TXT records. When making a TXT record with this SDK, the value of a TXT record is not stored as a string, but as a list of characters. This behavior shows up elsewhere and is almost definitely unintended.

Example SDK construction call in python function in a placeholder domain:

dns_client = DnsManagementClient(…)
dns_client.record_sets.create_or_update('TestResource1', 'banana.com', 'test_txt_SDK', 'TXT', {'ttl': 100, 'txt_records':[TxtRecord('sample string')]})

I also made this same record in the Azure online portal. Here are the results:
image.

This is not just a cosmetic bug. We can retrieve this inconsistency when making calls to the zone. For example, here is what happens when we call the record using the SDK, as well as using dig:
image
(this is to a different record)
image

Furthermore, this bug also occurs when using the Azure CLI 2.0 to create the record. Making a TXT record through the Azure portal is the only method that has not returned this error.

@lmazuel
Copy link
Member

lmazuel commented Aug 18, 2017

Hi @h-hwang
At the SDK level, TxtRecord is taking a list of strings as parameter, not a string as you do:
https://docs.microsoft.com/en-us/python/api/azure.mgmt.dns.models.txtrecord?view=azure-python

just change to TxtRecord(['sample string']) and your problem is solved :)

About CLI 2.0, I can't tell, but I guess the inline parameters should be a list as well. If you think the CLI is broken, can you open an issue here https://github.com/Azure/azure-cli/issues mentionning this one here? Thanks!

@lmazuel lmazuel added ARM question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 18, 2017
@tjprescott
Copy link
Member

I have verified that the CLI's record-set txt add-record is working correctly. The bizarre behavior is that if you supply a list of strings -v a b c they will be concatenated together, but from the DNS team, this is the intended behavior.

@h-hwang
Copy link
Author

h-hwang commented Aug 18, 2017

Great, thanks! Just for future safety and redundancy, is it worth considering adding a check that the input is indeed a list instead of a string? I'm guessing it's currently iterating through x for the input of TXTRecord(x) without checking if it's a list and so iterates through the characters in this case. Regardless, thanks for the help!

@lmazuel
Copy link
Member

lmazuel commented Aug 21, 2017

Hi @h-hwang
I created an issue in the core serializer about that. Thank you for the feeback!

@lmazuel lmazuel closed this as completed Aug 21, 2017
@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ARM question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants