def warnExpired(conduit): """ display warning for expired entitlements """ entdir = EntitlementDirectory() products = set() for cert in entdir.listExpired(): for p in cert.products: m = ' - %s' % p.name products.add(m) if products: msg = expired_warning % '\n'.join(sorted(products)) conduit.info(2, msg)
def warnOrGiveUsageMessage(conduit): """ either output a warning, or a usage message """ msg = "" # TODO: refactor so there are not two checks for this if os.getuid() != 0: return try: try: ConsumerIdentity.read().getConsumerId() entdir = EntitlementDirectory() if len(entdir.listValid()) == 0: msg = no_subs_warning else: msg = repo_usage_message except: msg = not_registered_warning finally: conduit.info(2, msg)
def warnOrGiveUsageMessage(conduit): # XXX: Importing inline as you must be root to read the config file from subscription_manager.certlib import ConsumerIdentity """ either output a warning, or a usage message """ msg = "" # TODO: refactor so there are not two checks for this if os.getuid() != 0: return try: try: ConsumerIdentity.read().getConsumerId() entdir = EntitlementDirectory() if len(entdir.listValid()) == 0: msg = no_subs_warning else: msg = registered_message except: msg = not_registered_warning finally: conduit.info(2, msg)