rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
column = gtk.TreeViewColumn(_(name), text_renderer, text=column_number)
column = gtk.TreeViewColumn(name, renderer, text=column_number)
def add_text_column(name): column_number = len(self.subscription_view.get_columns()) column = gtk.TreeViewColumn(_(name), text_renderer, text=column_number)
add_text_column("Subscription") add_text_column("Installed Products") add_text_column("Contract") add_text_column("Start Date") add_text_column("Expiration Date") add_text_column("Available Renewals")
add_column(_("Subscription")) add_column(_("Installed Products")) add_column(_("Contract")) add_column(_("Start Date")) add_column(_("Expiration Date")) add_column(_("Available Renewals"))
def add_text_column(name): column_number = len(self.subscription_view.get_columns()) column = gtk.TreeViewColumn(_(name), text_renderer, text=column_number)
renew_renderer = gtk.CellRendererToggle() renew_renderer.set_property('activatable', True) renew_renderer.connect('toggled', self.on_renew_click, None) add_column(_("Actions"), renderer=renew_renderer) self.update_subscriptions() def on_renew_click(self, cell, path, model): pass def update_subscriptions(self): if ...
def add_text_column(name): column_number = len(self.subscription_view.get_columns()) column = gtk.TreeViewColumn(_(name), text_renderer, text=column_number)
if prod['productId'] not in compatible_pids:
if prod['productId'] not in compatible_pids + matched_pids:
def __init__(self): global UEP self.selected = {} self.addxml = gtk.glade.XML(gladexml, "dialog_add", domain="subscription-manager") self.csstatus = self.addxml.get_widget("select_status") self.total = 0 self.consumer = consumer available_ent = 0 if consumer.has_key('uuid'): self.availableList = gtk.TreeStore(gobject.T...
"Accept-Language": locale.getdefaultlocale()[0]}
"Accept-Language": locale.getdefaultlocale()[0].lower().replace('_', '-')}
def __init__(self, host, port, ssl_port, apihandler, cert_file=None, key_file=None,): self.host = host self.port = port self.ssl_port = ssl_port self.apihandler = apihandler self.headers = {"Content-type":"application/json", "Accept": "application/json", "Accept-Language": locale.getdefaultlocale()[0]} self.cert_file =...
print self.add_subscription_screen
def onUnsubscribeAction(self, button): global UEP if not self.psubs_selected: return log.info("Product %s selected for unsubscribe" % self.pname_selected) dlg = messageWindow.YesNoDialog(constants.CONFIRM_UNSUBSCRIBE % xml.sax.saxutils.escape(self.pname_selected), self.mainWin) if not dlg.getrc(): return
updated_pool = UEP.getPool(ent_ret[0]['pool']['id']) updated_count = str(int(updated_pool['quantity']) - int(updated_pool['consumed']))
def onSubscribeAction(self, button): slabel = rhsm_xml.get_widget("available_subscriptions_label") subscribed_count = 0 pwin = progress.Progress() pwin.setLabel(_("Performing Subscribe. Please wait.")) busted_subs = [] count = 0
my_model.set_value(state[2], 2, updated_count)
def onSubscribeAction(self, button): slabel = rhsm_xml.get_widget("available_subscriptions_label") subscribed_count = 0 pwin = progress.Progress() pwin.setLabel(_("Performing Subscribe. Please wait.")) busted_subs = [] count = 0
port = cfg['port'] ssl_port = cfg['ssl_port']
ssl_port = cfg['port']
def __init__(self): cfg = initConfig() host = cfg['hostname'] or "localhost" port = cfg['port'] ssl_port = cfg['ssl_port'] cert_file = ConsumerIdentity.certpath() key_file = ConsumerIdentity.keypath() UEPConnection.__init__(self, host, port, ssl_port, cert_file=cert_file, key_file=key_file) self.uuid = self.consumerId(...
UEPConnection.__init__(self, host, port, ssl_port, cert_file=cert_file, key_file=key_file)
UEPConnection.__init__(self, host, ssl_port, cert_file=cert_file, key_file=key_file)
def __init__(self): cfg = initConfig() host = cfg['hostname'] or "localhost" port = cfg['port'] ssl_port = cfg['ssl_port'] cert_file = ConsumerIdentity.certpath() key_file = ConsumerIdentity.keypath() UEPConnection.__init__(self, host, port, ssl_port, cert_file=cert_file, key_file=key_file) self.uuid = self.consumerId(...
pools = model.get_value(tree_iter, MERGED_POOLS_INDEX)
pools = model.get_value(tree_iter, self.subs_store['merged_pools'])
def subscribe_button_clicked(self, button): model, tree_iter = self.subs_treeview.get_selection().get_selected() pools = model.get_value(tree_iter, MERGED_POOLS_INDEX) # Decide if we need to show the contract selection dialog or not. # if there's just one pool, shortcut right to the callback that the # dialog would ha...
print order.getStart()
def validRange(self): """ Get the I{valid} date range.
subscription.append(float(len(installed)) / len(products))
subscription.append(self._calculate_percentage(installed, products))
def update_subscriptions(self): entcerts = EntitlementDirectory().list()
print "writing to ", self.config_file
def save(self, config_file=None): fo = open(self.config_file, "wb") print "writing to ", self.config_file self.write(fo)
add_subscription_screen = None
def fetch_certificates(): # Force fetch all certs try: certlib.update() except Exception, e: log.error("Certificate sync failed") log.error(e) return False return True
def show_add_subscription_screen(): global add_subscription_screen
def show_regtoken_screen(): global regtoken_screen if regtoken_screen: regtoken_screen.show() else: regtoken_screen = RegistrationTokenScreen()
if add_subscription_screen: add_subscription_screen.show() else: add_subscription_screen = AddSubscriptionScreen()
def show_add_subscription_screen(): global add_subscription_screen if add_subscription_screen: add_subscription_screen.show() else: add_subscription_screen = AddSubscriptionScreen()
self.add_subscription_screen = None
def create_gui(self): global UEP
print "addSubButtonAction"
print 'ManageSubscriptionPage.addSubButtonAction() -> show_add_subscription_screen()'
def addSubButtonAction(self, button): print "addSubButtonAction" if consumer.has_key('uuid'): show_add_subscription_screen() else: show_import_certificate_screen()
show_add_subscription_screen()
self.show_add_subscription_screen()
def addSubButtonAction(self, button): print "addSubButtonAction" if consumer.has_key('uuid'): show_add_subscription_screen() else: show_import_certificate_screen()
self.gui_reload()
def addSubButtonAction(self, button): print "addSubButtonAction" if consumer.has_key('uuid'): show_add_subscription_screen() else: show_import_certificate_screen()
print "updateProductDialog"
print "[%s] updateProductDialog called" % time.time()
def updateProductDialog(self): print "updateProductDialog" self.warn_count = 0 self.productList.clear() for product in managerlib.getInstalledProductStatus(): markup_status = product[1] if product[1] in ["Expired", "Not Subscribed", "Not Installed"]: self.warn_count += 1 markup_status = '<span foreground="red"><b>%s</b...
print "gui_reload"
def gui_reload(self, widget=None): print "gui_reload" print logutil.trace_me_more() self.setRegistrationStatus() self.updateProductDialog()
print "[%s] in AddSubscriptinScreen.__init__" % time.time()
def __init__(self): global UEP self.selected = {} self.csstatus = rhsm_xml.get_widget("select_status") self.total = 0 self.consumer = consumer self.available_ent = 0
self.addWin.connect("hide", self.cancel)
def __init__(self): global UEP self.selected = {} self.csstatus = rhsm_xml.get_widget("select_status") self.total = 0 self.consumer = consumer self.available_ent = 0
self.addWin.run()
def __init__(self): global UEP self.selected = {} self.csstatus = rhsm_xml.get_widget("select_status") self.total = 0 self.consumer = consumer self.available_ent = 0
print 'subscribe window hiding'
def cancel(self, button): self.addWin.hide()
'fact2': 'two' }
'fact2': 'two', 'system': '', 'system.uuid': 'MOCKUUID'}
def setUp(self):
def check_facts(fact): found_facts[fact[0]] = fact[1]
def check_facts(parent, facts): found_facts[facts[0]] = facts[1]
def check_facts(fact): found_facts[fact[0]] = fact[1]
self.write(facts)
self.write(self.facts)
def get_facts(self): if self.facts: # see bz #627707 # there is a little bit of a race between when we load the facts, and when # we decide to save them, so delete facts out from under a Fact object means # it wasn't detecting it missing in that case and not writing a new one self.write(facts) return self.facts self.fa...
self.conn.headers['Authorization'] = basic return self.conn.headers
self.basic_auth_conn.headers['Authorization'] = basic return self.basic_auth_conn.headers
def __authenticate(self, username, password): encoded = base64.encodestring(':'.join((username,password))) basic = 'Basic %s' % encoded[:-1] self.conn.headers['Authorization'] = basic return self.conn.headers
return self.conn.request_post('/consumers/', params)
return self.basic_auth_conn.request_post('/consumers/', params)
def registerConsumer(self, username, password, name="unknown", type="system", facts={}): """ Creates a consumer on candlepin server """ params = { "type": type, "name": name, "facts": facts } self.__authenticate(username, password) return self.conn.request_post('/consumers/', params)
config_insecure = config.get('server', 'insecure')
config_insecure = int(config.get('server', 'insecure'))
def __init__(self, host=config.get('server', 'hostname', 'localhost'), ssl_port=int(config.get('server', 'port', 8443)), handler=config.get('server', 'prefix', '/candlepin'), cert_file=None, key_file=None):
return date.today()
return datetime.now(certificate.GMT())
def get_date(sub): return sub.validRange().end()
def update(self): repod = RepoFile() repod.read() valid = set() updates = 0 bundles = self.bundles() for cont in self.content(bundles): name = cont.id valid.add(name) existing = repod[name] if existing is None: updates += 1 repod[name] = cont continue updates += existing.update(cont) delete = [] for name in repod.secti...
requires_api_version = '2.3' plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)
def update(self): repod = RepoFile() repod.read() valid = set() updates = 0 bundles = self.bundles() for cont in self.content(bundles): name = cont.id valid.add(name) existing = repod[name] if existing is None: updates += 1 repod[name] = cont continue updates += existing.update(cont) delete = [] for name in repod.secti...
def bundles(self): bundles = [] for b in CertDirectory().bundles(): bundles.append(b) return bundles def content(self, bundles): unique = set() bundles.sort() bundles.reverse() for bundle in bundles: for repo in bundle.content(): unique.add(repo) return unique class Reader: def __init__(self): self.section = {} sel...
def config_hook(conduit): try: rl = RepoLib() rl.update() except Exception, ex: conduit.error(0, str(ex))
def bundles(self): bundles = [] for b in CertDirectory().bundles(): bundles.append(b) return bundles
dic = { "on_button_close_clicked" : gtk.main_quit,
dic = { "on_update_close_clicked" : gtk.main_quit,
def create_gui(self): global UEP
AddSubscriptionScreen()
show_add_subscription_screen()
def addSubButtonAction(self, button): AddSubscriptionScreen() self.gui_reload()
dic = { "on_close_clicked" : self.cancel,
dic = { "on_register_close_clicked" : self.cancel,
def __init__(self): create_and_set_basic_connection() dic = { "on_close_clicked" : self.cancel, "on_register_button_clicked" : self.onRegisterAction, } rhsm_xml.signal_autoconnect(dic) self.registerWin = rhsm_xml.get_widget("register_dialog") self.registerWin.connect("hide", self.cancel) self.initializeConsumerName()
dic = { "on_close_clicked" : self.finish,
dic = { "on_register_token_close_clicked" : self.finish,
def __init__(self): dic = { "on_close_clicked" : self.finish, "on_change_account_button" : self.reRegisterAction, "on_facts_update_button_clicked" : self.factsUpdateAction, "on_submit_button_clicked" : self.submitToken, "on_unregister_button_click" : self.unregisterAction} self.setAccountMsg() rhsm_xml.signal_autoconne...
dic = { "on_close_clicked" : self.cancel,
dic = { "on_add_subscribe_close_clicked" : self.cancel,
def __init__(self): global UEP self.selected = {} self.csstatus = rhsm_xml.get_widget("select_status") self.total = 0 self.consumer = consumer available_ent = 0 if consumer.has_key('uuid'): self.availableList = gtk.TreeStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, \ gobject.TYPE_STRING, gobject....
self.addWin.destroy()
def finish(self): self.addWin.hide() self.addWin.destroy() gtk.main_iteration()
self.addWin.destroy() gtk.main_iteration()
self.addWin.hide() def show(self): self.addWin.present()
def cancel(self, button): self.addWin.destroy() gtk.main_iteration()
print "gh 2000"
def onSubscribeAction(self, button): slabel = rhsm_xml.get_widget("label_status1") #consumer = get_consumer() subscribed_count = 0 #my_model = self.tv_products.get_model() #my_model = self.other_tv.get_model() my_model = self.match_tv.get_model() pwin = progress.Progress() pwin.setLabel(_("Performing Subscribe. Please ...
print self.total
def col_matched_selected(self, cell, path, model): items, iter = self.match_tv.get_selection().get_selected() model[path][0] = not model[path][0] self.model = model state = model.get_value(iter, 0) self.selected[model.get_value(iter, 4)] = (state, model.get_value(iter, 1), iter) if state: self.total += 1 else: self.tot...
dic = { "on_close_clicked" : self.cancel,
dic = { "on_update_subscriptions_close_clicked" : self.cancel,
def __init__(self, product_selection): global UEP
dic = { "on_close_import" : self.cancel,
dic = { "on_close_import_clicked" : self.cancel,
def __init__(self): self.add_vbox = rhsm_xml.get_widget("import_vbox")
errorWindow(constants.REGISTER_ERROR)
errorWindow(constants.REGISTER_ERROR % e)
def onRegisterAction(self, button): self.uname = self.registerxml.get_widget("account_login") self.passwd = self.registerxml.get_widget("account_password")
self.cp.bindByProduct(self.consumer['uuid'], phash)
self.cp.bindByProduct(consumer['uuid'], phash)
def _do_command(self): """ Executes the command. """ self._validate_options()
handle_exception(_("Error: Unable to Re-register the system", e))
handle_exception(_("Error: Unable to Re-register the system"), e)
def _do_command(self):
if not ConsumerIdentity.exists() and not (self.options.username and self.options.password): print (_("Error: username and password are required to re-register, try re-register --help.\n"))
if not ConsumerIdentity.existsAndValid() and not (self.options.username and self.options.password): print (_("""Error: username and password are required to re-register. \nConsumer identity either does not exists or is corrupted. Try re-register --help."""))
def _validate_options(self): if not ConsumerIdentity.exists() and not (self.options.username and self.options.password): print (_("Error: username and password are required to re-register, try re-register --help.\n")) sys.exit(-1)
if not ConsumerIdentity.exists() and not self.options.consumerid:
if not ConsumerIdentity.existsAndValid() and not self.options.consumerid: log.info("consumer identity is not valid and consumer id was not passed. Deleting old ones and calling register") shutil.rmtree("/etc/pki/consumer", ignore_errors=True)
def _do_command(self):
consumerid = check_registration()['uuid']
def _do_command(self): """ Executes the command. """ self._validate_options()
try: self.cp.unregisterConsumer(consumerid) log.info("--force specified. Successfully unsubscribed the old consumer.") except: log.error("Unable to unregister with consumer %s" % consumerid)
if ConsumerIdentity.existsAndValid(): consumerid = ConsumerIdentity.read().getConsumerId() try: self.cp.unregisterConsumer(consumerid) log.info("--force specified. Successfully unsubscribed the old consumer.") except: log.error("Unable to unregister with consumer %s" % consumerid)
def _do_command(self): """ Executes the command. """ self._validate_options()
if value != cached_facts[key]:
if value != cached_facts[key] and key not in self.graylist:
def delta(self): """ return a dict of any key/values that have changed including new keys or deleted keys """ cached_facts = self.read(self.fact_cache) diff = {} self.facts = self.get_facts() # compare the dicts to see if there is a diff
self.dialog.set_markup(text)
self.dialog.set_markup(xml.sax.saxutils.escape(text))
def __init__ (self, title, text, type="ok", default=None, parent=None): self.rc = None if type == 'ok': buttons = gtk.BUTTONS_OK style = gtk.MESSAGE_INFO elif type == 'warning': buttons = gtk.BUTTONS_OK style = gtk.MESSAGE_WARNING elif type == 'okcancel': buttons = gtk.BUTTONS_OK_CANCEL style = gtk.MESSAGE_WARNING elif...
systemExit(-1, msgs=e.msg)
systemExit(-1, msgs=e)
def _do_command(self): """ Executes the command. """ self._validate_options() consumer = check_registration()['uuid'] try: if self.options.product: for product in self.options.product: bundles = self.cp.bindByProduct(consumer, product) log.info("Info: Successfully subscribed the machine to product %s" % product)
"on_first_noncompliant_radiobutton_toggled": self._reload_screen, "on_noncompliant_date_radiobutton_toggled": self._reload_screen,
"on_first_noncompliant_radiobutton_toggled": self._check_for_date_change, "on_noncompliant_date_radiobutton_toggled": self._check_for_date_change,
def __init__(self, backend, consumer, facts): self.backend = backend self.consumer = consumer self.facts = facts self.pool_stash = managerlib.PoolStash(self.backend, self.consumer, self.facts)
self._reload_screen()
self._check_for_date_change(widget)
def _compliance_date_selected(self, widget): """ Callback for the date selector to execute when the date has been chosen. """ log.debug("Compliance date selected.") self.noncompliant_date_radiobutton.set_active(True) self._reload_screen()
def show(self): """ Called by the main window when this page is to be displayed. """ try: self._reload_screen() self.window.show() except RestlibException, e: handle_gui_exception(e, _("Error fetching subscriptions from server: %s")) except Exception, e: handle_gui_exception(e, _("Error displaying Compliance Assistant....
def _on_uncompliant_active_toggled(self, cell, path): treeiter = self.uncompliant_store.get_iter_from_string(path) item = self.uncompliant_store.get_value(treeiter, self.uncompliant_store['active']) self.uncompliant_store.set_value(treeiter, self.uncompliant_store['active'], not item)
self.contract_selection.destroy()
if self.contract_selection: self.contract_selection.destroy()
def _contract_selection_cancelled(self): self.contract_selection.destroy() self.contract_selection = None
self._contract_selected(pools.pools[1])
self._contract_selected(pools.pools[0]) return
def subscribe_button_clicked(self, button): model, tree_iter = self.subs_treeview.get_selection().get_selected() pools = model.get_value(tree_iter, self.subs_store['merged_pools']) # Decide if we need to show the contract selection dialog or not. # if there's just one pool, shortcut right to the callback that the # di...
def __init__(self, username=None, password=None, cert_file=None, key_file=None):
def __init__(self, username=None, password=None, proxy_hostname=None, proxy_port=None, cert_file=None, key_file=None):
def __init__(self, username=None, password=None, cert_file=None, key_file=None): pass
'product_name': ent_cert.getName(),
'product_name': ent_cert.getProduct().getName(),
def _display_uncompliant(self): sorter = CertSorter(self.product_dir, self.entitlement_dir, on_date=self._get_noncompliant_date())
'entitlement': entitlement,
'entitlement': ent_cert,
def _display_uncompliant(self): sorter = CertSorter(self.product_dir, self.entitlement_dir, on_date=self._get_noncompliant_date())
'expires' : cert.validRange().end(),
'expires' : formatDate(cert.validRange().end().isoformat()),
def getInstalledProductStatus(): """ Returns the Installed products and their subscription states """ products = ProductDirectory().list() entcerts = EntitlementDirectory().list() entdict = {} for cert in entcerts: ents = cert.getEntitlements() eproducts = cert.getProducts() for product in eproducts: entdict[product.ge...
data = (product.getName(), cert.valid(), cert.validRange().begin(), cert.validRange().end())
data = (product.getName(), cert.valid(), formatDate(cert.validRange().begin().isoformat()), \ formatDate(cert.validRange().end().isoformat()))
def getConsumedProductEntitlements(): """ Gets the list of available products with entitlements based on its subscription cert """ entdir = EntitlementDirectory() consumed_products = [] for cert in entdir.listValid(): eproducts = cert.getProducts() for product in eproducts: data = (product.getName(), cert.valid(), cert...
self.parser.add_option("--consumerid", dest="consumerid", help=_("register to an existing consumer"))
def __init__(self): usage = "usage: %prog register [OPTIONS]" shortdesc = _("register the client to a Unified Entitlement Platform.") desc = "register"
if self.options.consumerid: consumer = self.cp.getConsumerById(self.options.consumerid, self.options.username, self.options.password) elif ConsumerIdentity.exists() and self.options.force:
if ConsumerIdentity.exists() and self.options.force:
def _do_command(self): """ Executes the command. """ self._validate_options()
print consumer, cpserver
print consumer
def getAvailableEntitlementsCLI(cpserver, consumer): columns = ['id', 'quantity', 'unlimited', 'consumed', 'endDate', 'productName', 'productId'] # update facts if we need it print consumer, cpserver facts = getFacts()
log.exception(e) log.error("Error: Unable to ReRegister the system") systemExit(-1, e)
handle_exception("Error: Unable to ReRegister the system", e)
def _do_command(self):
log.exception(e) log.error("Error: Unable to UnRegister the system") systemExit(-1, e)
handle_exception("Error: Unable to UnRegister the system", e)
def _do_command(self): self.add_user_identity() if not ConsumerIdentity.exists(): print(_("This system is currently not registered.")) sys.exit(1)
log.error("Unable to subscribe: %s" % e) log.exception(e) systemExit(-1, msgs=e)
handle_exception("Unable to subscribe: %s" % e, e)
def _do_command(self): """ Executes the command. """ self._validate_options() consumer = check_registration()['uuid'] try: # update facts first, if we need to facts = getFacts()
log.exception(e) log.error("Unable to perform unsubscribe due to the following exception \n Error: %s" % e) systemExit(-1, msgs=e)
handle_exception("Unable to perform unsubscribe due to the following exception \n Error: %s" % e, e)
def _do_command(self): """ Executes the command. """ self.add_user_identity() consumer = check_registration()['uuid'] try: if self.options.serial: self.cp.unBindBySerialNumber(consumer, self.options.serial) log.info("This machine has been Unsubscribed from subcription with Serial number %s" % (self.options.serial)) els...
register_button.hide() regtoken_button.show() unregister_button.show()
def setRegistrationStatus(self): """ Updates portions of the main window to reflect current registration status. """ exists = ConsumerIdentity.existsAndValid() log.debug("updating registration status.. consumer exists?: %s", exists)
register_button.show() regtoken_button.hide() unregister_button.hide()
set_visible(register_button, not exists) set_visible(regtoken_button, exists) set_visible(unregister_button, exists)
def setRegistrationStatus(self): """ Updates portions of the main window to reflect current registration status. """ exists = ConsumerIdentity.existsAndValid() log.debug("updating registration status.. consumer exists?: %s", exists)
def __init__(self, host='localhost', ssl_port=8443, handler=cfg['prefix'] or "/candlepin",
def __init__(self, host='localhost', ssl_port=8443, handler=config['prefix'] or "/candlepin",
def __init__(self, host='localhost', ssl_port=8443, handler=cfg['prefix'] or "/candlepin", cert_file=None, key_file=None): self.host = host self.ssl_port = ssl_port self.handler = handler self.conn = None self.basic_auth_conn = None self.cert_file = cert_file self.key_file = key_file config = initConfig() self.candlepi...
config = initConfig()
def __init__(self, host='localhost', ssl_port=8443, handler=cfg['prefix'] or "/candlepin", cert_file=None, key_file=None): self.host = host self.ssl_port = ssl_port self.handler = handler self.conn = None self.basic_auth_conn = None self.cert_file = cert_file self.key_file = key_file config = initConfig() self.candlepi...
except connection.RestlibException, re: log.exception(re) errorWindow(constants.UNSUBSCRIBE_ERROR)
def onUnsubscribeAction(self, button): global UEP if not self.psubs_selected: return log.info("Product %s selected for unsubscribe" % self.pname_selected) dlg = messageWindow.YesNoDialog(constants.CONFIRM_UNSUBSCRIBE % xml.sax.saxutils.escape(self.pname_selected), self.mainWin) if not dlg.getrc(): return
log.error("Unable to perform unsubscribe due to the following exception:") log.exception(e) errorWindow(constants.UNSUBSCRIBE_ERROR)
handle_gui_exception(re, constants.UNSUBSCRIBE_ERROR)
def onUnsubscribeAction(self, button): global UEP if not self.psubs_selected: return log.info("Product %s selected for unsubscribe" % self.pname_selected) dlg = messageWindow.YesNoDialog(constants.CONFIRM_UNSUBSCRIBE % xml.sax.saxutils.escape(self.pname_selected), self.mainWin) if not dlg.getrc(): return
managerlib.unregister(UEP, consumer['uuid']) except connection.RestlibException, e:
managerlib.unregister(UEP, consumer['uuid'], False) consumer = get_consumer() self.mainWin.emit(CONSUMER_SIGNAL) except Exception, e:
def showUnregisterDialog(self, button): global UEP, consumer log.info("Unregister called in gui. Asking for confirmation") prompt = messageWindow.YesNoDialog(constants.CONFIRM_UNREGISTER) if not prompt.getrc(): log.info("unregistrater not confirmed. cancelling") return log.info("Proceeding with un-registration: %s", co...
log.error("Consumer may need to be manually cleaned up: %s" % consumer) log.exception(e) errorWindow(constants.UNREGISTER_ERROR) consumer = get_consumer() self.mainWin.emit(CONSUMER_SIGNAL)
handle_gui_exception(e, constants.UNREGISTER_ERROR, "Consumer may need to be manually cleaned up: %s" % consumer)
def showUnregisterDialog(self, button): global UEP, consumer log.info("Unregister called in gui. Asking for confirmation") prompt = messageWindow.YesNoDialog(constants.CONFIRM_UNREGISTER) if not prompt.getrc(): log.info("unregistrater not confirmed. cancelling") return log.info("Proceeding with un-registration: %s", co...
log.error("Unable to unregister existing user credentials.") log.exception(e)
handle_gui_exception(e=e, logMsg="Unable to unregister existing user credentials.", showMsg=False)
def register(self, testing=None): self.uname = registration_xml.get_widget("account_login") self.passwd = registration_xml.get_widget("account_password") self.consumer_name = registration_xml.get_widget("consumer_name")
except connection.RestlibException, e: log.error(failed_msg % e.msg) errorWindow(constants.REGISTER_ERROR % linkify(e.msg)) self.close_window() return False
def register(self, testing=None): self.uname = registration_xml.get_widget("account_login") self.passwd = registration_xml.get_widget("account_password") self.consumer_name = registration_xml.get_widget("consumer_name")
log.error(failed_msg % e) errorWindow(constants.REGISTER_ERROR % e) self.close_window() return False
return handle_gui_exception(e, constants.REGISTER_ERROR)
def register(self, testing=None): self.uname = registration_xml.get_widget("account_login") self.passwd = registration_xml.get_widget("account_password") self.consumer_name = registration_xml.get_widget("consumer_name")
except connection.RestlibException, e: log.error("Could not update system facts: error %s" % (e)) errorWindow(linkify(e.msg))
def factsUpdateAction(self, button): facts = getFacts() try: UEP.updateConsumerFacts(consumer['uuid'], facts.get_facts()) except connection.RestlibException, e: log.error("Could not update system facts: error %s" % (e)) errorWindow(linkify(e.msg)) except Exception, e: log.error("Could not update system facts \nError: ...
log.error("Could not update system facts \nError: %s" % (e)) errorWindow(linkify(e.msg))
handle_gui_exception(e, "Could not update facts.\nError: %s" % e)
def factsUpdateAction(self, button): facts = getFacts() try: UEP.updateConsumerFacts(consumer['uuid'], facts.get_facts()) except connection.RestlibException, e: log.error("Could not update system facts: error %s" % (e)) errorWindow(linkify(e.msg)) except Exception, e: log.error("Could not update system facts \nError: ...
except connection.RestlibException, e: log.error("Could not subscribe registration token %s error %s" % (reg_token, e)) errorWindow(linkify(e.msg))
def submitToken(self, button): rlabel = regtoken_xml.get_widget("regtoken_entry") reg_token = rlabel.get_text() elabel = regtoken_xml.get_widget("email_entry") email = elabel.get_text() if email == "": email = None try: UEP.bindByRegNumber(consumer['uuid'], reg_token, email) infoWindow(constants.SUBSCRIBE_REGTOKEN_SUCC...
log.error("Could not subscribe registration token [%s] \nError: %s" % (reg_token, e)) errorWindow(constants.SUBSCRIBE_REGTOKEN_ERROR % reg_token)
handle_gui_exception(e, constants.SUBSCRIBE_REGTOKEN_ERROR % reg_token, "Could not subscribe registration token %s.\nError: %s" % (reg_token, e))
def submitToken(self, button): rlabel = regtoken_xml.get_widget("regtoken_entry") reg_token = rlabel.get_text() elabel = regtoken_xml.get_widget("email_entry") email = elabel.get_text() if email == "": email = None try: UEP.bindByRegNumber(consumer['uuid'], reg_token, email) infoWindow(constants.SUBSCRIBE_REGTOKEN_SUCC...
log.error("Failed to subscribe to product %s Error: %s" % (state[1], e)) errorWindow(constants.SUBSCRIBE_ERROR % state[1])
handle_gui_exception(e, constants.SUBSCRIBE_ERROR % state[1], "Failed to subscribe to product %s Error: %s" % (state[1], e))
def onSubscribeAction(self, button): subscribed_count = 0 my_model = self.tv_products.get_model() for pool, state in self.selected.items(): # state = (bool, iter) if state[0]: try: ent_ret = UEP.bindByEntitlementPool(consumer['uuid'], pool) entitled_data = ent_ret[0]['pool'] updated_count = str(int(entitled_data['quant...
errorWindow(_(callback(e)))
errorWindow(callback(e))
def handle_gui_exception(e, callback, logMsg = None, showMsg = True): if logMsg: log.error(logMsg) log.exception(e) if showMsg: if isinstance(e, socket_error): errorWindow(_('network error, unable to connect to server')) elif isinstance(e, SSL.SSLError): errorWindow(_('Unable to verify server\'s identity: %s' % str(e)...
errorWindow(_(callback))
errorWindow(callback)
def handle_gui_exception(e, callback, logMsg = None, showMsg = True): if logMsg: log.error(logMsg) log.exception(e) if showMsg: if isinstance(e, socket_error): errorWindow(_('network error, unable to connect to server')) elif isinstance(e, SSL.SSLError): errorWindow(_('Unable to verify server\'s identity: %s' % str(e)...
systemExit(-1, e)
systemExit(-1, ex)
def handle_exception(msg, ex): log.error(msg) log.exception(ex) if isinstance(ex, socket_error): print 'network error, unable to connect to server' sys.exit(-1) else: systemExit(-1, e)
pacparser_module_path = glob.glob(os.path.join(tests_dir, '..', 'pymod', 'build', 'lib*'))[0] except: print 'Tests failed. Could not determine pacparser path.\n%s' % str(e)
pacparser_module_path = glob.glob(os.path.join( tests_dir, '..', 'pymod', 'build', 'lib*%s' % py_ver))[0] except Exception: print 'Tests failed. Could not determine pacparser path.'
def runtests(pacfile, testdata, tests_dir): try: pacparser_module_path = glob.glob(os.path.join(tests_dir, '..', 'pymod', 'build', 'lib*'))[0] except: print 'Tests failed. Could not determine pacparser path.\n%s' % str(e) return 1 sys.path.insert(0, pacparser_module_path) try: import pacparser except ImportError, e: ...
except ImportError, e: print 'Tests failed. Could not import pacparser.\n%s' % str(e)
except ImportError: print 'Tests failed. Could not import pacparser.'
def runtests(pacfile, testdata, tests_dir): try: pacparser_module_path = glob.glob(os.path.join(tests_dir, '..', 'pymod', 'build', 'lib*'))[0] except: print 'Tests failed. Could not determine pacparser path.\n%s' % str(e) return 1 sys.path.insert(0, pacparser_module_path) try: import pacparser except ImportError, e: ...
if target == 'install':
if len(sys.argv) > 1 and sys.argv[1] == 'install':
def main(): if sys.platform == 'win32': #install target is used to just install compiled files. if target == 'install': import shutil install_path = '%s\Lib\site-packages\pacparser' % sys.prefix if os.path.isdir(install_path): shutil.rmtree(install_path) shutil.copytree('.', install_path) else: pydll = 'C:\windows\syst...
install_path = '%s\Lib\site-packages\pacparser' % sys.prefix if os.path.isdir(install_path): shutil.rmtree(install_path) shutil.copytree('.', install_path)
if os.path.isdir('dist'): install_path = '%s\pacparser' % sysconfig.get_python_lib() if os.path.isdir(install_path): shutil.rmtree(install_path) shutil.copytree('dist', install_path) else: print ('"dist" dir not found. You should run "python setup.py dist"' ' first.')
def main(): if sys.platform == 'win32': #install target is used to just install compiled files. if target == 'install': import shutil install_path = '%s\Lib\site-packages\pacparser' % sys.prefix if os.path.isdir(install_path): shutil.rmtree(install_path) shutil.copytree('.', install_path) else: pydll = 'C:\windows\syst...
pydll = 'C:\windows\system32\python%s.dll' % ver.replace('.', '')
pydll = ('C:\windows\system32\python%s.dll' % sysconfig.get_config_vars('VERSION')[0])
def main(): if sys.platform == 'win32': #install target is used to just install compiled files. if target == 'install': import shutil install_path = '%s\Lib\site-packages\pacparser' % sys.prefix if os.path.isdir(install_path): shutil.rmtree(install_path) shutil.copytree('.', install_path) else: pydll = 'C:\windows\syst...
(target, sys.prefix, pydll))
(' '.join(sys.argv[1:]), sys.prefix, pydll))
def main(): if sys.platform == 'win32': #install target is used to just install compiled files. if target == 'install': import shutil install_path = '%s\Lib\site-packages\pacparser' % sys.prefix if os.path.isdir(install_path): shutil.rmtree(install_path) shutil.copytree('.', install_path) else: pydll = 'C:\windows\syst...
if len(sys.argv) < 2: target = '' else: target = sys.argv[1]
def main(): if sys.platform == 'win32': #install target is used to just install compiled files. if target == 'install': import shutil install_path = '%s\Lib\site-packages\pacparser' % sys.prefix if os.path.isdir(install_path): shutil.rmtree(install_path) shutil.copytree('.', install_path) else: pydll = 'C:\windows\syst...