[Bug 1735218] Re: Real connectivity error is hidden from a user when PPA is added: ERROR: '~anonymous' user or team does not exist.

Dmitrii Shcherbakov 1735218 at bugs.launchpad.net
Fri Apr 6 10:33:49 UTC 2018


** Description changed:

  This is common in an environment where a proxy server is not properly
  configured via HTTP_PROXY or HTTPS_PROXY and you need to add a PPA.
  
  The error is very cryptic unless you look at the code:
  
  sudo add-apt-repository ppa:anonymous/very-important-packages
  Cannot add PPA: 'ppa:~anonymous/ubuntu/very-important-packages'.
  ERROR: '~anonymous' user or team does not exist.
  
- 
  Code path:
  
  https://git.launchpad.net/~usd-import-team/ubuntu/+source/software-
- properties/tree/softwareproperties/ppa.py?h=applied/ubuntu/xenial-
- updates#n305
+ properties/tree/softwareproperties/ppa.py?h=ubuntu/xenial-updates#n305
  
  def _get_suggested_ppa_message(user, ppa_name):
-     try:
-         msg = []
-         try:
-             try:
-                 lp_user = get_info_from_lp(LAUNCHPAD_USER_API % user)
-             except PPAException:
-                 return _("ERROR: '{user}' user or team does not exist.").format(user=user) # <--- this is triggered
+     try:
+         msg = []
+         try:
+             try:
+                 lp_user = get_info_from_lp(LAUNCHPAD_USER_API % user)
+             except PPAException:
+                 return _("ERROR: '{user}' user or team does not exist.").format(user=user) # <--- this is triggered
  ....
  def get_info_from_lp(lp_url):
-     if NEED_PYCURL:
-         # python2 has no cert verification so we need pycurl
-         return _get_https_content_pycurl(lp_url)
-     else:
-         # python3 has cert verification so we can use the buildin urllib
-         return _get_https_content_py3(lp_url)
+     if NEED_PYCURL:
+         # python2 has no cert verification so we need pycurl
+         return _get_https_content_pycurl(lp_url)
+     else:
+         # python3 has cert verification so we can use the buildin urllib
+         return _get_https_content_py3(lp_url)
  
  ...
  
  def _get_https_content_pycurl(lp_url):
-     # this is the fallback code for python2
-     try:
-         callback = CurlCallback()
-         curl = pycurl.Curl()
-         curl.setopt(pycurl.SSL_VERIFYPEER, 1)
-         curl.setopt(pycurl.SSL_VERIFYHOST, 2)
-         curl.setopt(pycurl.WRITEFUNCTION, callback.body_callback)
-         if LAUNCHPAD_PPA_CERT:
-             curl.setopt(pycurl.CAINFO, LAUNCHPAD_PPA_CERT)
-         curl.setopt(pycurl.URL, str(lp_url))
-         curl.setopt(pycurl.HTTPHEADER, ["Accept: application/json"])
-         curl.perform()
-         curl.close()
-         json_data = callback.contents
-     except pycurl.error as e: # <--- if this errors out due to connectivity
-         raise PPAException("Error reading %s: %s" % (lp_url, e), e)
-     return json.loads(json_data)
+     # this is the fallback code for python2
+     try:
+         callback = CurlCallback()
+         curl = pycurl.Curl()
+         curl.setopt(pycurl.SSL_VERIFYPEER, 1)
+         curl.setopt(pycurl.SSL_VERIFYHOST, 2)
+         curl.setopt(pycurl.WRITEFUNCTION, callback.body_callback)
+         if LAUNCHPAD_PPA_CERT:
+             curl.setopt(pycurl.CAINFO, LAUNCHPAD_PPA_CERT)
+         curl.setopt(pycurl.URL, str(lp_url))
+         curl.setopt(pycurl.HTTPHEADER, ["Accept: application/json"])
+         curl.perform()
+         curl.close()
+         json_data = callback.contents
+     except pycurl.error as e: # <--- if this errors out due to connectivity
+         raise PPAException("Error reading %s: %s" % (lp_url, e), e)
+     return json.loads(json_data)

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

Title:
  Real connectivity error is hidden from a user when PPA is added:
  ERROR: '~anonymous' user or team does not exist.

Status in software-properties package in Ubuntu:
  Confirmed

Bug description:
  This is common in an environment where a proxy server is not properly
  configured via HTTP_PROXY or HTTPS_PROXY and you need to add a PPA.

  The error is very cryptic unless you look at the code:

  sudo add-apt-repository ppa:anonymous/very-important-packages
  Cannot add PPA: 'ppa:~anonymous/ubuntu/very-important-packages'.
  ERROR: '~anonymous' user or team does not exist.

  Code path:

  https://git.launchpad.net/~usd-import-team/ubuntu/+source/software-
  properties/tree/softwareproperties/ppa.py?h=ubuntu/xenial-updates#n305

  def _get_suggested_ppa_message(user, ppa_name):
      try:
          msg = []
          try:
              try:
                  lp_user = get_info_from_lp(LAUNCHPAD_USER_API % user)
              except PPAException:
                  return _("ERROR: '{user}' user or team does not exist.").format(user=user) # <--- this is triggered
  ....
  def get_info_from_lp(lp_url):
      if NEED_PYCURL:
          # python2 has no cert verification so we need pycurl
          return _get_https_content_pycurl(lp_url)
      else:
          # python3 has cert verification so we can use the buildin urllib
          return _get_https_content_py3(lp_url)

  ...

  def _get_https_content_pycurl(lp_url):
      # this is the fallback code for python2
      try:
          callback = CurlCallback()
          curl = pycurl.Curl()
          curl.setopt(pycurl.SSL_VERIFYPEER, 1)
          curl.setopt(pycurl.SSL_VERIFYHOST, 2)
          curl.setopt(pycurl.WRITEFUNCTION, callback.body_callback)
          if LAUNCHPAD_PPA_CERT:
              curl.setopt(pycurl.CAINFO, LAUNCHPAD_PPA_CERT)
          curl.setopt(pycurl.URL, str(lp_url))
          curl.setopt(pycurl.HTTPHEADER, ["Accept: application/json"])
          curl.perform()
          curl.close()
          json_data = callback.contents
      except pycurl.error as e: # <--- if this errors out due to connectivity
          raise PPAException("Error reading %s: %s" % (lp_url, e), e)
      return json.loads(json_data)

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



More information about the foundations-bugs mailing list