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

Fix broken lookup in salt/utils/dns.py #51250

Merged
merged 9 commits into from Jan 27, 2019

Conversation

@yosnoop
Copy link
Contributor

commented Jan 19, 2019

What does this PR do?

Fix lookup function in salt/utils/dns.py.

What issues does this PR fix or reference?

#51249

Previous Behavior

  1. the _multi_srvr recursively called since resolver in the function points to _multi_srvr and causes the following error.
    Passed invalid arguments: _multi_srvr() got multiple values for keyword argument 'server'.
  2. method host fails to query the resolver when the servers argument specified.

New Behavior

  1. instead of pointing the resolver to _multi_srvr, it now generates wrapper functions and assign that to resolver.
  2. host properly specifies the resolver to query.

Tests written?

Work in progress.

Commits signed with GPG?

Yes.

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@yosnoop yosnoop force-pushed the yosnoop:fix-salt-utils-dns-lookup branch 2 times, most recently from 1be54cb to c414c6f Jan 19, 2019
Copy link
Contributor

left a comment

@yosnoop Would you mind writing a regression test for salt.utils.dns.lookup?

@yosnoop

This comment has been minimized.

Copy link
Contributor Author

commented Jan 22, 2019

@dwoz Let me try! :)

@yosnoop yosnoop force-pushed the yosnoop:fix-salt-utils-dns-lookup branch from 26096fa to f5b0d56 Jan 23, 2019
yosnoop added 6 commits Jan 19, 2019
Fixes #51249

The _multi_srvr recursively called since resolver in the function points
to _multi_srvr.
Looking at _host_ source code, split with two new lines is proper.

From https://ftp.isc.org/isc/bind9/9.13.5/bind-9.13.5.tar.gz

$ grep -A10 listed_server.*printed_server bin/dig/host.c
        if (listed_server && !printed_server) {
                char sockstr[ISC_SOCKADDR_FORMATSIZE];

                printf("Using domain server:\n");
                printf("Name: %s\n", query->userarg);
                isc_sockaddr_format(&query->sockaddr, sockstr,
                                    sizeof(sockstr));
                printf("Address: %s\n", sockstr);
                printf("Aliases: \n\n");
                printed_server = true;
        }
@yosnoop yosnoop force-pushed the yosnoop:fix-salt-utils-dns-lookup branch from 3805399 to 9a34bcd Jan 24, 2019
@yosnoop

This comment has been minimized.

Copy link
Contributor Author

commented Jan 24, 2019

@dwoz I wrote a test for salt.utils.dns.lookup. Could you take a look?

yosnoop added 3 commits Jan 24, 2019
@dwoz

This comment has been minimized.

Copy link
Contributor

commented Jan 27, 2019

@yosnoop Looks good, thanks!

@dwoz dwoz merged commit fdf2cf4 into saltstack:2018.3 Jan 27, 2019
10 checks passed
10 checks passed
WIP Ready for review
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint Python lint test has passed
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py2-windows-2016 The py2-windows-2016 job has passed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
jenkins/pr/py3-windows-2016 The py3-windows-2016 job has passed
Details
@yosnoop yosnoop deleted the yosnoop:fix-salt-utils-dns-lookup branch Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.