Skip to content

Commit

Permalink
Fix publish hostname in china and gov clouds (#3005)
Browse files Browse the repository at this point in the history
* Fix regex to parse china/gov domain names

* Improve regex

* Improve regex
  • Loading branch information
maddieford authored Jan 2, 2024
1 parent 0c03cb1 commit 6b70af5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests_e2e/tests/publish_hostname/publish_hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def add_vm_password(self):

def check_and_install_dns_tools(self):
lookup_cmd = "dig -x {0}".format(self._private_ip)
dns_regex = r"[\S\s]*;; ANSWER SECTION:\s.*PTR\s*(?P<hostname>.*).internal.cloudapp.net.[\S\s]*"
dns_regex = r"[\S\s]*;; ANSWER SECTION:\s.*PTR\s*(?P<hostname>.*)\.internal\.(cloudapp\.net|chinacloudapp\.cn|usgovcloudapp\.net).*[\S\s]*"

# Not all distros come with dig. Install dig if not on machine
try:
Expand All @@ -66,7 +66,7 @@ def check_and_install_dns_tools(self):
if "debian_9" in distro:
# Debian 9 hostname look up needs to be done with "host" instead of dig
lookup_cmd = "host {0}".format(self._private_ip)
dns_regex = r".*pointer\s(?P<hostname>.*).internal.cloudapp.net."
dns_regex = r".*pointer\s(?P<hostname>.*)\.internal\.(cloudapp\.net|chinacloudapp\.cn|usgovcloudapp\.net).*"
elif "debian" in distro:
self._ssh_client.run_command("apt install -y dnsutils", use_sudo=True)
elif "alma" in distro or "rocky" in distro:
Expand Down

0 comments on commit 6b70af5

Please sign in to comment.