File fix-koan-port-guessing.dif of Package cobbler.3314

Index: cobbler-2.4.2/koan/utils.py
===================================================================
--- cobbler-2.4.2.orig/koan/utils.py
+++ cobbler-2.4.2/koan/utils.py
@@ -450,15 +450,20 @@ def connect_to_server(server=None,port=N
     if server == "":
         raise InfoException("--server must be specified")
 
-    if port is None: 
-        port = 80
-        
+    try_urls = []
+    if port is None:
+        try_urls = [
+            "https://%s:443/cobbler_api" % (server),
+            "http://%s:80/cobbler_api" % (server),
+        ]
+    else:
+        try_urls = [
+            "https://%s:%s/cobbler_api" % (server,port),
+            "http://%s:%s/cobbler_api" % (server,port),
+        ]
+
     connect_ok = 0
 
-    try_urls = [
-        "https://%s:%s/cobbler_api" % (server,port),
-        "http://%s:%s/cobbler_api" % (server,port),
-    ]
     for url in try_urls:
         print "- looking for Cobbler at %s" % url
         server = __try_connect(url)
openSUSE Build Service is sponsored by