anaconda/modify-network-hostname-dot-illegal.patch
2020-06-29 15:28:10 +08:00

40 lines
1.7 KiB
Diff

From 343751258b3a4b3e21cf52add5a9ddf600065835 Mon Sep 17 00:00:00 2001
From: t_feng <fengtao40@huawei.com>
Date: Fri, 19 Jun 2020 11:48:25 +0800
Subject: [PATCH] modify network hostname dot illegal
---
pyanaconda/core/regexes.py | 2 +-
pyanaconda/network.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/core/regexes.py b/pyanaconda/core/regexes.py
index 63ab668..f86e403 100644
--- a/pyanaconda/core/regexes.py
+++ b/pyanaconda/core/regexes.py
@@ -103,7 +103,7 @@ IPV4_NETMASK_WITH_ANCHORS = re.compile("^" + IPV4_NETMASK_WITHOUT_ANCHORS + "$")
# with a period, but it can end with one.
# This regex uses negative lookahead and lookback assertions to enforce the
# hyphen rules and make it way more confusing
-HOSTNAME_PATTERN_WITHOUT_ANCHORS = r'(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)(?:\.(?!-)[A-Za-z0-9-]{1,63}(?<!-))*\.?)'
+HOSTNAME_PATTERN_WITHOUT_ANCHORS = r'(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)(?:\.(?!-)[A-Za-z0-9-]{1,63}(?<!-))*)'
# URL Hostname
# This matches any hostname, IPv4 literal or properly encased IPv6 literal
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 127a1bd..30cf2af 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -119,7 +119,7 @@ def is_valid_hostname(hostname, local=False):
return (False, _("Host names can only contain the characters 'a-z', "
"'A-Z', '0-9', '-', or '.', parts between periods "
"must contain something being 63 or fewer "
- "characters and cannot start or end with '-'."))
+ "characters and cannot start or end with '.' and '-'."))
return (True, "")
--
2.23.0