Skip to content

Instantly share code, notes, and snippets.

@makewhatis
Created October 18, 2012 02:27
Show Gist options
  • Save makewhatis/3909534 to your computer and use it in GitHub Desktop.
Save makewhatis/3909534 to your computer and use it in GitHub Desktop.
osad.py patch for hosts using custom ports
--- /usr/share/rhn/osad/osad.py 2012-10-18 09:52:01.000000000 -0700
+++ osad.py.new 2012-10-18 09:47:35.000000000 -0700
@@ -206,6 +206,17 @@
# No schema - trying to patch it up ourselves?
url = scheme + "://" + url
sch, netloc, path, params, query, fragment = urlparse.urlparse(url)
+
+ ipv6re = "^(([0-9a-zA-Z]{0,4}:){7})([0-9a-zA-Z]{0,4}):([0-9]{1,5})$"
+ ipv6_match = re.match(ipv6re, netloc)
+ if ipv6_match:
+ netloc = ipv6_match.group(1)
+
+ domain_re = "(^[0-9a-zA-Z.-]*):[0-9]{0,5}"
+ domain_match = re.match(domain_re, netloc)
+ if domain_match:
+ netloc = domain_match.group(1)
+
return sch, netloc, path, params, query, fragment
def fix_connection(self, c):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment