[Bug 1032732] [NEW] Network connectivity check pings network location, not hostname

2012-08-03 Thread Bjorn Swift
Public bug reported:

The Ubuntu Software Center attempts to ping the repository host on
startup to check for internet connectivity (when NetworkManager is not
present). However, the software-center uses the complete network
location (urlparse's netloc) as the ping destination - which causes
problems if the location contains a port component (or basic
authentication).

For example, our repository url is http://apt.mr.lan:3142/ubuntu. When
we start software-center, it attempts to ping apt.mr.lan:3142, which
fails, and so the Install button is grayed out.

Log output:
INFO - Attempting one time ping of apt.mr.lan:3142 to test if internet 
connectivity exists.


The following patch uses urlparse's hostname instead of netloc (also attached):

--- netstatus.py.org2012-08-03 05:27:37.913582505 +
+++ netstatus.py2012-08-03 05:44:54.645406601 +
@@ -145,7 +145,7 @@
 NETWORK_STATE = NetState.NM_STATE_DISCONNECTED
 else:
 # get a host to ping
-host = urlparse(source_list.list[0].uri)[1]
+host = urlparse(source_list.list[0].uri).hostname
 msg = (Attempting one time ping of %s to test if internet 
connectivity exists. % host)
 logging.info(msg)


After applying patch:
INFO - Attempting one time ping of apt.mr.lan to test if internet connectivity 
exists.


== OS and package versions ==

# lsb_release -rd
Description:Ubuntu 12.04 LTS
Release:12.04


# apt-cache policy software-center
software-center:
  Installed: 5.2.4
  Candidate: 5.2.4

** Affects: software-center (Ubuntu)
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1032732

Title:
  Network connectivity check pings network location, not hostname

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/1032732/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 1032732] Re: Network connectivity check pings network location, not hostname

2012-08-03 Thread Bjorn Swift
** Patch added: Substitute netloc with hostname
   
https://bugs.launchpad.net/bugs/1032732/+attachment/3246887/+files/software-center-netloc-to-hostname.patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1032732

Title:
  Network connectivity check pings network location, not hostname

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/1032732/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs