changed function from dig.X to dig.PTR

This commit is contained in:
Matthew Saum 2022-07-14 22:27:02 +02:00 committed by Megan Wilhite
parent 59802f83fb
commit e0230e355e
2 changed files with 5 additions and 5 deletions

View file

@ -99,7 +99,7 @@ def A(host, nameserver=None):
return [x for x in cmd["stdout"].split("\n") if check_ip(x)]
def X(host, nameserver=None):
def PTR(host, nameserver=None):
"""
.. versionadded:: 3006.0
Return the PTR record for ``host``.
@ -110,7 +110,7 @@ def X(host, nameserver=None):
.. code-block:: bash
salt ns1 dig.X 1.2.3.4
salt ns1 dig.PTR 1.2.3.4
"""
dig = ["dig", "+short", "-x", str(host)]
@ -349,7 +349,7 @@ def TXT(host, nameserver=None):
# Let lowercase work, since that is the convention for Salt functions
a = A
x = X
ptr = PTR
aaaa = AAAA
cname = CNAME
ns = NS

View file

@ -96,7 +96,7 @@ class DigTestCase(TestCase, LoaderModuleMockMixin):
],
)
def test_x(self):
def test_ptr(self):
dig_mock = MagicMock(
return_value={
"pid": 3657,
@ -107,7 +107,7 @@ class DigTestCase(TestCase, LoaderModuleMockMixin):
)
with patch.dict(dig.__salt__, {"cmd.run_all": dig_mock}):
self.assertEqual(
dig.X("8.8.8.8"),
dig.ptr("8.8.8.8"),
[
"dns.google.",
],