if arg.bzurl: if not arg.bzurl.endswith("xmlrpc.cgi"): arg.bzurl = "%s/xmlrpc.cgi" % arg.bzurl LOG.info("Querying bugzilla at: %s", arg.pkgdburl) utils.BZCLIENT.url = arg.bzurl utils.BZCLIENT._sslverify = not arg.insecure if arg.fasurl: LOG.info("Querying FAS at: %s", arg.pkgdburl) utils.FASCLIENT.base_url = arg.fasurl utils.FASCLIENT.insecure = arg.insecure return_code = 0 if arg.password: PKGDBCLIENT.password = arg.password if arg.username: PKGDBCLIENT.username = arg.username try: arg.func(arg) except KeyboardInterrupt: print "\nInterrupted by user." return_code = 1 except ServerError, err: LOG.debug("ServerError") print "{0}".format(err) return_code = 3 except ActionError, err: LOG.debug("ActionError") print "{0}".format(err.message)
LOG.setLevel(logging.DEBUG) PKGDBLOG.setLevel(logging.DEBUG) elif arg.verbose: LOG.setLevel(logging.INFO) if arg.test: global pkgdbclient print "Testing environment" pkgdbclient = PkgDB('https://admin.stg.fedoraproject.org/pkgdb', login_callback=pkgdb2client.ask_password, insecure=True) return_code = 0 if arg.password: pkgdbclient.password = arg.password if arg.username: pkgdbclient.username = arg.username try: arg.func(arg) except KeyboardInterrupt: print "\nInterrupted by user." return_code = 1 except ServerError, err: LOG.debug('ServerError') print '{0}'.format(err) return_code = 3 except ActionError, err: LOG.debug('ActionError') print '{0}'.format(err.message)
if arg.bzurl: if not arg.bzurl.endswith('xmlrpc.cgi'): arg.bzurl = '%s/xmlrpc.cgi' % arg.bzurl print "Querying bugzilla at: %s" % arg.pkgdburl utils.BZCLIENT.url = arg.bzurl utils.BZCLIENT._sslverify = not arg.insecure if arg.fasurl: print "Querying FAS at: %s" % arg.pkgdburl utils.FASCLIENT.base_url = arg.fasurl utils.FASCLIENT.insecure = arg.insecure return_code = 0 if arg.password: pkgdbclient.password = arg.password if arg.username: pkgdbclient.username = arg.username try: arg.func(arg) except KeyboardInterrupt: print "\nInterrupted by user." return_code = 1 except ServerError, err: LOG.debug('ServerError') print '{0}'.format(err) return_code = 3 except ActionError, err: LOG.debug('ActionError') print '{0}'.format(err.message)
def main(): ''' Main function ''' # Set up parser for global args parser = setup_parser() # Parse the commandline try: arg = parser.parse_args() except argparse.ArgumentTypeError as err: print("\nError: {0}".format(err)) return 2 if arg.nocolor: global RED, BOLD, RESET RED = "" BOLD = "" RESET = "" logging.basicConfig() if arg.debug: LOG.setLevel(logging.DEBUG) PKGDBLOG.setLevel(logging.DEBUG) elif arg.verbose: LOG.setLevel(logging.INFO) global pkgdbclient if arg.pkgdburl != pkgdb2client.PKGDB_URL: print("Querying pkgdb at: %s" % arg.pkgdburl) pkgdbclient = PkgDB( arg.pkgdburl, login_callback=pkgdb2client.ask_password) pkgdbclient.insecure = arg.insecure if arg.bzurl != pkgdb2client.BZ_URL: if not arg.bzurl.endswith('xmlrpc.cgi'): arg.bzurl = '%s/xmlrpc.cgi' % arg.bzurl print("Querying bugzilla at: %s" % arg.bzurl) utils._get_bz(arg.bzurl, insecure=arg.insecure) if arg.fasurl != pkgdb2client.FAS_URL: print("Querying FAS at: %s" % arg.fasurl) utils._get_fas(arg.fasurl, insecure=arg.insecure) if arg.kojihuburl != pkgdb2client.KOJI_HUB: print("Querying koji at: %s" % arg.kojihuburl) global KOJI_HUB KOJI_HUB = arg.kojihuburl return_code = 0 if arg.password: pkgdbclient.password = arg.password if arg.username: pkgdbclient.username = arg.username try: arg.func(arg) except KeyboardInterrupt: print("\nInterrupted by user.") return_code = 1 except ServerError as err: LOG.debug('ServerError') print('{0}'.format(err)) return_code = 3 except ActionError as err: LOG.debug('ActionError') print('{0}'.format(err.message)) return_code = 7 except argparse.ArgumentError as err: LOG.debug('ArgparseError') print('{0}'.format(err.message)) return_code = 9 except AppError as err: LOG.debug('AppError') print('{0}: {1}'.format(err.name, err.message)) return_code = 4 except PkgDBException as err: LOG.debug('PkgDBException') print('{0}'.format(err)) return_code = 8 except ValueError as err: print('Error: {0}'.format(err)) print('Did you log in?') return_code = 6 except Exception as err: print('Error: {0}'.format(err)) logging.exception("Generic error catched:") return_code = 5 return return_code
if arg.bzurl: if not arg.bzurl.endswith('xmlrpc.cgi'): arg.bzurl = '%s/xmlrpc.cgi' % arg.bzurl LOG.info("Querying bugzilla at: %s", arg.pkgdburl) utils.BZCLIENT.url = arg.bzurl utils.BZCLIENT._sslverify = not arg.insecure if arg.fasurl: LOG.info("Querying FAS at: %s", arg.pkgdburl) utils.FASCLIENT.base_url = arg.fasurl utils.FASCLIENT.insecure = arg.insecure return_code = 0 if arg.password: PKGDBCLIENT.password = arg.password if arg.username: PKGDBCLIENT.username = arg.username try: arg.func(arg) except KeyboardInterrupt: print "\nInterrupted by user." return_code = 1 except ServerError, err: LOG.debug('ServerError') print '{0}'.format(err) return_code = 3 except ActionError, err: LOG.debug('ActionError') print '{0}'.format(err.message)
def main(): ''' Main function ''' # Set up parser for global args parser = setup_parser() # Parse the commandline try: arg = parser.parse_args() except argparse.ArgumentTypeError as err: print("\nError: {0}".format(err)) return 2 logging.basicConfig() if arg.debug: LOG.setLevel(logging.DEBUG) PKGDBLOG.setLevel(logging.DEBUG) elif arg.verbose: LOG.setLevel(logging.INFO) global PKGDBCLIENT if arg.pkgdburl: LOG.info("Querying pkgdb at: %s", arg.pkgdburl) PKGDBCLIENT = PkgDB( arg.pkgdburl, login_callback=pkgdb2client.ask_password) PKGDBCLIENT.insecure = arg.insecure if arg.bzurl: if not arg.bzurl.endswith('xmlrpc.cgi'): arg.bzurl = '%s/xmlrpc.cgi' % arg.bzurl LOG.info("Querying bugzilla at: %s", arg.pkgdburl) utils._get_bz(arg.bzurl, insecure=arg.insecure) if arg.fasurl: LOG.info("Querying FAS at: %s", arg.pkgdburl) utils.FASCLIENT.base_url = arg.fasurl utils.FASCLIENT.insecure = arg.insecure return_code = 0 if arg.password: PKGDBCLIENT.password = arg.password if arg.username: PKGDBCLIENT.username = arg.username try: arg.func(arg) except KeyboardInterrupt: print("\nInterrupted by user.") return_code = 1 except ServerError as err: LOG.debug('ServerError') print('{0}'.format(err)) return_code = 3 except ActionError as err: LOG.debug('ActionError') print('{0}'.format(err.message)) return_code = 7 except AppError as err: LOG.debug('AppError') print('{0}: {1}'.format(err.name, err.message)) return_code = 4 except PkgDBException as err: LOG.debug('PkgDBException') print('{0}'.format(err)) return_code = 8 except ValueError as err: print('Error: {0}'.format(err)) print('Did you log in?') return_code = 6 except Exception as err: print('Error: {0}'.format(err)) logging.exception("Generic error catched:") return_code = 5 return return_code
def main(): ''' Main function ''' # Set up parser for global args parser = setup_parser() # Parse the commandline try: arg = parser.parse_args() except argparse.ArgumentTypeError as err: print("\nError: {0}".format(err)) return 2 logging.basicConfig() if arg.debug: LOG.setLevel(logging.DEBUG) PKGDBLOG.setLevel(logging.DEBUG) elif arg.verbose: LOG.setLevel(logging.INFO) global PKGDBCLIENT if arg.pkgdburl: LOG.info("Querying pkgdb at: %s", arg.pkgdburl) PKGDBCLIENT = PkgDB(arg.pkgdburl, login_callback=pkgdb2client.ask_password) PKGDBCLIENT.insecure = arg.insecure if arg.bzurl: if not arg.bzurl.endswith('xmlrpc.cgi'): arg.bzurl = '%s/xmlrpc.cgi' % arg.bzurl LOG.info("Querying bugzilla at: %s", arg.pkgdburl) utils._get_bz(arg.bzurl, insecure=arg.insecure) if arg.fasurl: LOG.info("Querying FAS at: %s", arg.pkgdburl) utils.FASCLIENT.base_url = arg.fasurl utils.FASCLIENT.insecure = arg.insecure return_code = 0 if arg.password: PKGDBCLIENT.password = arg.password if arg.username: PKGDBCLIENT.username = arg.username try: arg.func(arg) except KeyboardInterrupt: print("\nInterrupted by user.") return_code = 1 except ServerError as err: LOG.debug('ServerError') print('{0}'.format(err)) return_code = 3 except ActionError as err: LOG.debug('ActionError') print('{0}'.format(err.message)) return_code = 7 except AppError as err: LOG.debug('AppError') print('{0}: {1}'.format(err.name, err.message)) return_code = 4 except PkgDBException as err: LOG.debug('PkgDBException') print('{0}'.format(err)) return_code = 8 except ValueError as err: print('Error: {0}'.format(err)) print('Did you log in?') return_code = 6 except Exception as err: print('Error: {0}'.format(err)) logging.exception("Generic error catched:") return_code = 5 return return_code