Print this page
305 http_proxy value needs more checking for valid url syntax
2341 Client should be more conservative about closing sockets
4235 Misleading "node name" unknown messages when http_proxy set incorrectly
4495 Want ability to cancel individual file downloads
8902 Need a transport that downloads files by GET
9508 Captive portal test only run during catalog refresh
9613 Implicit refresh should raise InvalidDepotResponseException
9615 EOL clientside search v0
9629 EOL clientside support for filelist
9630 Hostile depot should live with other depot code
9631 HTTPS transport should be more rigorous in verification
9670 More specific error exceptions requested from search
9686 network operations should use accept-encoding when appropriate
9715 The info() operation should use the activity_lock

*** 73,85 **** from pkg.client import global_settings from pkg.client.debugvalues import DebugValues from pkg.client.history import (RESULT_CANCELED, RESULT_FAILED_BAD_REQUEST, RESULT_FAILED_CONFIGURATION, RESULT_FAILED_TRANSPORT, RESULT_FAILED_UNKNOWN, RESULT_FAILED_OUTOFMEMORY) - from pkg.client.filelist import FileListRetrievalError - from pkg.client.retrieve import (CatalogRetrievalError, - DatastreamRetrievalError, ManifestRetrievalError) from pkg.misc import EmptyI, msg, emsg, PipeError CLIENT_API_VERSION = 15 PKG_CLIENT_NAME = "pkg" --- 73,82 ----
*** 572,582 **** except api_errors.BEException, e: error(_(e)) return 1 except (api_errors.CertificateError, api_errors.PlanCreationException, - api_errors.NetworkUnavailableException, api_errors.PermissionsException), e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner. error("\n" + str(e)) return 1 --- 569,578 ----
*** 597,610 **** # Exceptions which happen here are printed in the above level, with # or without some extra decoration done here. # XXX would be nice to kick the progress tracker. try: api_inst.prepare() ! except misc.TransportException: # move past the progress tracker line. msg("\n") ! raise except KeyboardInterrupt: raise except api_errors.PermissionsException, e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner. --- 593,608 ---- # Exceptions which happen here are printed in the above level, with # or without some extra decoration done here. # XXX would be nice to kick the progress tracker. try: api_inst.prepare() ! except api_errors.TransportError, e: # move past the progress tracker line. msg("\n") ! if verbose: ! e.verbose = True ! raise e except KeyboardInterrupt: raise except api_errors.PermissionsException, e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner.
*** 734,744 **** error(_("Catalog refresh failed during install."), cmd="install") return 1 except (api_errors.CertificateError, api_errors.PlanCreationException, - api_errors.NetworkUnavailableException, api_errors.PermissionsException), e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner. error("\n" + str(e), cmd="install") return 1 --- 732,741 ----
*** 756,769 **** # Exceptions which happen here are printed in the above level, with # or without some extra decoration done here. # XXX would be nice to kick the progress tracker. try: api_inst.prepare() ! except misc.TransportException: # move past the progress tracker line. msg("\n") ! raise except KeyboardInterrupt: raise except api_errors.PermissionsException, e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner. --- 753,768 ---- # Exceptions which happen here are printed in the above level, with # or without some extra decoration done here. # XXX would be nice to kick the progress tracker. try: api_inst.prepare() ! except api_errors.TransportError, e: # move past the progress tracker line. msg("\n") ! if verbose: ! e.verbose = True ! raise e except KeyboardInterrupt: raise except api_errors.PermissionsException, e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner.
*** 877,890 **** # Exceptions which happen here are printed in the above level, with # or without some extra decoration done here. # XXX would be nice to kick the progress tracker. try: api_inst.prepare() ! except misc.TransportException: # move past the progress tracker line. msg("\n") ! raise except api_errors.FileInUseException, e: error("\n" + str(e)) return 1 except KeyboardInterrupt: raise --- 876,891 ---- # Exceptions which happen here are printed in the above level, with # or without some extra decoration done here. # XXX would be nice to kick the progress tracker. try: api_inst.prepare() ! except api_errors.TransportError, e: # move past the progress tracker line. msg("\n") ! if verbose: ! e.verbose = True ! raise e except api_errors.FileInUseException, e: error("\n" + str(e)) return 1 except KeyboardInterrupt: raise
*** 931,964 **** def unfreeze(img, args): """Attempt to return package specified to INSTALLED state from FROZEN state.""" return 0 - def process_v_0_search(tup, first): - """Transforms the tuples returned by search v1 into the four column - output format. - - The "tup" parameter is a four tuple with the each entry corresponding - to a column of the output. - - The "first" parameter is a boolean stating whether this is the first - time this function has been called. This controls the printing of the - header information.""" - - try: - index, mfmri, action, value = tup - except ValueError: - error(_("The server returned a malformed result.\n" - "The problematic structure: %r") % (tup,)) - return False - if first: - msg("%-10s %-9s %-25s %s" % - ("INDEX", "ACTION", "VALUE", "PACKAGE")) - msg("%-10s %-9s %-25s %s" % (index, action, value, - fmri.PkgFmri(str(mfmri)).get_short_fmri())) - return True - def __convert_output(a_str, match): """Converts a string to a three tuple with the information to fill the INDEX, ACTION, and VALUE columns. The "a_str" parameter is the string representation of an action. --- 932,941 ----
*** 1018,1029 **** else: pfmri = tup if first: msg("%s" % ("PACKAGE")) pub_name = '' ! if pub is not None and "prefix" in pub: pub_name = " (%s)" % pub.prefix msg("%s%s" % (fmri.PkgFmri(str(pfmri)).get_short_fmri(), pub_name)) return True def search(img_dir, args): --- 995,1011 ---- else: pfmri = tup if first: msg("%s" % ("PACKAGE")) pub_name = '' ! # If pub is not None, it's either a RepositoryURI or a Publisher ! # object. If it's a Publisher, it has a prefix. Otherwise, ! # use the uri. ! if pub is not None and hasattr(pub, "prefix"): pub_name = " (%s)" % pub.prefix + elif pub is not None and hasattr(pub, "uri"): + pub_name = " (%s)" % pub.uri msg("%s%s" % (fmri.PkgFmri(str(pfmri)).get_short_fmri(), pub_name)) return True def search(img_dir, args):
*** 1098,1110 **** except ValueError, e: error(_("The server returned a malformed " "result:%r") % (raw_value,)) bad_res = True continue - if v == 0: - ret = process_v_0_search(tmp, first) - else: ret = process_v_1_search(tmp, first, return_type, pub) good_res |= ret bad_res |= not ret first = False --- 1080,1089 ----
*** 1611,1635 **** emsg(" %s: %s" % \ (pub["origin"], "timeout")) else: emsg(" %s: %s" % \ (pub["origin"], err.args[0][1])) - elif isinstance(err, CatalogRetrievalError) and \ - isinstance(err.exc, EnvironmentError) and \ - err.exc.errno == errno.EACCES: - if err.prefix: - emsg(" ", _("Could not update catalog " - "for '%s' due to insufficient " - "permissions.") % err.prefix) else: - emsg(" ", _("Could not update a catalog " - "due to insufficient permissions.")) - - emsg(" ", _("Please try the command again " - "using pfexec, or otherwise increase \n your " - "permissions.")) - else: emsg(" ", err) if cre.message: emsg(cre.message) --- 1590,1600 ----
*** 1659,1670 **** pubs=pargs) except api_errors.PublisherError, e: error(e) error(_("'pkg publisher' will show a list of publishers.")) return 1 ! except (api_errors.PermissionsException, ! api_errors.NetworkUnavailableException), e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner. error("\n" + str(e)) return 1 except api_errors.CatalogRefreshException, e: --- 1624,1634 ---- pubs=pargs) except api_errors.PublisherError, e: error(e) error(_("'pkg publisher' will show a list of publishers.")) return 1 ! except (api_errors.PermissionsException), e: # Prepend a newline because otherwise the exception will # be printed on the same line as the spinner. error("\n" + str(e)) return 1 except api_errors.CatalogRefreshException, e:
*** 2287,2296 **** --- 2251,2261 ---- "valid pkg server.\nPlease check the server's " "address and client's network configuration." "\nAdditional details:\n\n%(error)s") % { "pub_url": pub_url, "error": e }, cmd="image-create") + print_proxy_config() return 1 except api_errors.CatalogRefreshException, cre: # Ensure messages are displayed after the spinner. error("", cmd="image-create") if display_catalog_failures(cre) == 0:
*** 2426,2435 **** --- 2391,2419 ---- msg("%-19s %-25s %-15s %s" % (start_time, he.operation_name, he.client_name, outcome)) return 0 + def print_proxy_config(): + """If the user has configured http_proxy or https_proxy in the + environment, print out the values. Some transport errors are + not debuggable without this information handy.""" + + http_proxy = os.environ.get("http_proxy", None) + https_proxy = os.environ.get("https_proxy", None) + + if not http_proxy and not https_proxy: + return + + emsg(_("\nThe following proxy configuration is set in the" + " environment:\n")) + if http_proxy: + emsg(_("http_proxy: %s\n") % http_proxy) + if https_proxy: + emsg(_("https_proxy: %s\n") % https_proxy) + + # To allow exception handler access to the image. __img = None def main_func(): global_settings.client_name = PKG_CLIENT_NAME
*** 2470,2487 **** if show_usage: usage(retcode=0) elif not subcommand: usage() ! socket.setdefaulttimeout( ! int(os.environ.get("PKG_CLIENT_TIMEOUT", "30"))) # in seconds ! ! # Override default PKG_TIMEOUT_MAX if a value has been specified ! # in the environment. global_settings.PKG_TIMEOUT_MAX = int(os.environ.get("PKG_TIMEOUT_MAX", global_settings.PKG_TIMEOUT_MAX)) if subcommand == "image-create": if "mydir" in locals(): usage(_("-R not allowed for %s subcommand") % subcommand) try: --- 2454,2475 ---- if show_usage: usage(retcode=0) elif not subcommand: usage() ! # Override default PKG_TIMEOUT_MAX and PKG_CLIENT_TIMEOUT ! # if a value has been specified in the environment. global_settings.PKG_TIMEOUT_MAX = int(os.environ.get("PKG_TIMEOUT_MAX", global_settings.PKG_TIMEOUT_MAX)) + global_settings.PKG_CLIENT_TIMEOUT = int(os.environ.get( + "PKG_CLIENT_TIMEOUT", global_settings.PKG_CLIENT_TIMEOUT)) + + # This call only affects sockets created by Python. The transport + # framework must set the timeout value internally. + socket.setdefaulttimeout(global_settings.PKG_TIMEOUT_MAX) # in seconds + if subcommand == "image-create": if "mydir" in locals(): usage(_("-R not allowed for %s subcommand") % subcommand) try:
*** 2635,2667 **** except api_errors.PublisherError, __e: if __img: __img.history.abort(RESULT_FAILED_BAD_REQUEST) error(__e) __ret = 1 ! except misc.TransportException, __e: if __img: __img.history.abort(RESULT_FAILED_TRANSPORT) ! error(_("\nMaximum number of network retries exceeded during " ! "download. Details follow:\n%s") % __e) __ret = 1 - except (ManifestRetrievalError, - DatastreamRetrievalError, FileListRetrievalError), __e: - if __img: - __img.history.abort(RESULT_FAILED_TRANSPORT) - error(_("An error was encountered while attempting to retrieve" - " package or file data for the requested operation.")) - error(__e) - __ret = 1 except api_errors.InvalidDepotResponseException, __e: if __img: __img.history.abort(RESULT_FAILED_TRANSPORT) ! error(_("\nUnable to contact a valid package depot. " "This may be due to a problem with the server, " "network misconfiguration, or an incorrect pkg client " "configuration. Please check your network settings and " "attempt to contact the server using a web browser.")) ! error(_("\nAdditional details:\n\n%s") % __e) __ret = 1 except history.HistoryLoadException, __e: # Since a history related error occurred, discard all # information about the current operation(s) in progress. if __img: --- 2623,2650 ---- except api_errors.PublisherError, __e: if __img: __img.history.abort(RESULT_FAILED_BAD_REQUEST) error(__e) __ret = 1 ! except api_errors.TransportError, __e: if __img: __img.history.abort(RESULT_FAILED_TRANSPORT) ! emsg(_("\nErrors were encountered while attempting to retrieve" ! " package or file data for\nthe requested operation.")) ! emsg(_("Details follow:\n\n%s") % __e) ! print_proxy_config() __ret = 1 except api_errors.InvalidDepotResponseException, __e: if __img: __img.history.abort(RESULT_FAILED_TRANSPORT) ! emsg(_("\nUnable to contact a valid package depot. " "This may be due to a problem with the server, " "network misconfiguration, or an incorrect pkg client " "configuration. Please check your network settings and " "attempt to contact the server using a web browser.")) ! emsg(_("\nAdditional details:\n\n%s") % __e) ! print_proxy_config() __ret = 1 except history.HistoryLoadException, __e: # Since a history related error occurred, discard all # information about the current operation(s) in progress. if __img: