Pull request #15: fix endpoint regex

Merge in RR/pyinfra from fix_endpoint_regex to master

* commit '344c92c4d2e46d5adbfa385e4516322df86406e3':
  fix endpoint regex
This commit is contained in:
Clarissa Dietrich 2022-03-02 16:25:28 +01:00
commit 2a1d6c4973

View File

@ -9,7 +9,7 @@ from pyinfra.exceptions import InvalidEndpoint
def parse_endpoint(endpoint):
# FIXME Greedy matching (.+) since we get random storage names on kubernetes (eg http://red-research-headless:9000)
endpoint_pattern = r"(?P<protocol>https?)://(?P<address>(?:(?:(?:\d{1,3}\.){3}\d{1,3})|.+)(?:\:\d+)?)"
endpoint_pattern = r"(?P<protocol>https?)*(?:://)*(?P<address>(?:(?:(?:\d{1,3}\.){3}\d{1,3})|.+)(?:\:\d+)?)"
match = re.match(endpoint_pattern, endpoint)