def posttrans_hook(conduit): """ Update product ID certificates. """ # register rpm name for yum history recording # yum on 5.7 doesn't have this method, so check for it if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") try: init_dep_injection() except ImportError as e: conduit.error(3, str(e)) return logutil.init_logger_for_yum() # If a tool (it's, e.g., Anaconda and Mock) manages a chroot via # 'yum --installroot', we must update certificates in that directory. chroot(conduit.getConf().installroot) try: pm = YumProductManager(conduit._base) pm.update_all() conduit.info(3, 'Installed products updated.') except Exception as e: conduit.error(3, str(e))
def postconfig_hook(conduit): """ update """ # register rpm name for yum history recording" # yum on 5.7 doesn't have this method, so check for it from subscription_manager import logutil logutil.init_logger_for_yum() from subscription_manager.injectioninit import init_dep_injection init_dep_injection() # If a tool (it's, e.g., Mock) manages a chroot via 'yum --installroot', # we must update entitlements in that directory. chroot(conduit.getConf().installroot) cfg = config.initConfig() cache_only = not bool(cfg.get_int('rhsm', 'full_refresh_on_yum')) if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") try: update(conduit, cache_only) warnOrGiveUsageMessage(conduit) warnExpired(conduit) except Exception, e: conduit.error(2, str(e))
def config_hook(conduit): """ update """ # register rpm name for yum history recording" # yum on 5.7 doesn't have this method, so check for it if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") logutil.init_logger_for_yum() try: update(conduit) warnOrGiveUsageMessage(conduit) warnExpired(conduit) except Exception, e: conduit.error(2, str(e))
def config_hook(conduit): """ update """ # register rpm name for yum history recording" # yum on 5.7 doesn't have this method, so check for it if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") logutil.init_logger_for_yum() try: update(conduit) if not ClassicCheck().is_registered_with_classic() and not RhicCertificate.existsAndValid(): warnOrGiveUsageMessage(conduit) warnExpired(conduit) except Exception, e: conduit.error(2, str(e))
def posttrans_hook(conduit): """ Update product ID certificates. """ # register rpm name for yum history recording # yum on 5.7 doesn't have this method, so check for it if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") logutil.init_logger_for_yum() chroot() try: pm = ProductManager() pm.update(conduit._base) conduit.info(3, 'Installed products updated.') except Exception, e: conduit.error(3, str(e))
def config(self): """ update """ logutil.init_logger_for_yum() init_dep_injection() chroot(self.base.conf.installroot) cfg = config.initConfig() cache_only = not bool(cfg.get_int('rhsm', 'full_refresh_on_yum')) try: if os.getuid() == 0: self._update(cache_only) self._warnOrGiveUsageMessage() else: logger.info(_('Not root, Subscription Management repositories not updated')) self._warnExpired() except Exception as e: logger.error(str(e))
def transaction(self): """ Update product ID certificates. """ if len(self.base.transaction) == 0: # nothing to update after empty transaction return try: init_dep_injection() except ImportError as e: logger.error(str(e)) return logutil.init_logger_for_yum() chroot(self.base.conf.installroot) try: pm = DnfProductManager(self.base) pm.update_all() logger.info(_('Installed products updated.')) except Exception as e: logger.error(str(e))
def config_hook(conduit): """ update """ # register rpm name for yum history recording" # yum on 5.7 doesn't have this method, so check for it from subscription_manager import logutil logutil.init_logger_for_yum() from subscription_manager.injectioninit import init_dep_injection init_dep_injection() cfg = config.initConfig() cache_only = not bool(cfg.get_int('rhsm', 'full_refresh_on_yum')) if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") try: update(conduit, cache_only) warnOrGiveUsageMessage(conduit) warnExpired(conduit) except Exception, e: conduit.error(2, str(e))
def config(self): """ update """ logutil.init_logger_for_yum() init_dep_injection() chroot(self.base.conf.installroot) cfg = config.initConfig() cache_only = not bool(cfg.get_int('rhsm', 'full_refresh_on_yum')) try: if os.getuid() == 0: self._update(cache_only) self._warnOrGiveUsageMessage() else: logger.info( _('Not root, Subscription Management repositories not updated' )) self._warnExpired() except Exception as e: logger.error(str(e))
def postconfig_hook(conduit): """ update """ # register rpm name for yum history recording" # yum on 5.7 doesn't have this method, so check for it logutil.init_logger_for_yum() init_dep_injection() # If a tool (it's, e.g., Mock) manages a chroot via 'yum --installroot', # we must update entitlements in that directory. chroot(conduit.getConf().installroot) cfg = config.initConfig() cache_only = not bool(cfg.get_int('rhsm', 'full_refresh_on_yum')) if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") try: update(conduit, cache_only) warnOrGiveUsageMessage(conduit) warnExpired(conduit) except Exception, e: conduit.error(2, str(e))
def test_init_logger_for_yum(self): logutil.init_logger_for_yum() sm_logger = logging.getLogger("subscription_manager") rhsm_logger = logging.getLogger("rhsm-app") self.assertFalse(sm_logger.propagate) self.assertFalse(rhsm_logger.propagate)
anaconda_pid = "/var/run/anaconda.pid" if os.path.exists(sysimage) and os.path.exists(anaconda_pid): Path.ROOT = sysimage def posttrans_hook(conduit): """ Update product ID certificates. """ # register rpm name for yum history recording # yum on 5.7 doesn't have this method, so check for it if hasattr(conduit, "registerPackageName"): conduit.registerPackageName("subscription-manager") try: from subscription_manager.injectioninit import init_dep_injection init_dep_injection() except ImportError, e: conduit.error(3, str(e)) return logutil.init_logger_for_yum() chroot() try: pm = ProductManager() pm.update(conduit._base) conduit.info(3, "Installed products updated.") except Exception, e: conduit.error(3, str(e))
requires_api_version = '2.6' plugin_type = (TYPE_CORE, ) def posttrans_hook(conduit): """ Update product ID certificates. """ # register rpm name for yum history recording # yum on 5.7 doesn't have this method, so check for it if hasattr(conduit, 'registerPackageName'): conduit.registerPackageName("subscription-manager") try: from subscription_manager.injectioninit import init_dep_injection init_dep_injection() except ImportError, e: conduit.error(3, str(e)) return logutil.init_logger_for_yum() # If a tool (it's, e.g., Anaconda and Mock) manages a chroot via # 'yum --installroot', we must update certificates in that directory. chroot(conduit.getConf().installroot) try: pm = ProductManager() pm.update(conduit._base) conduit.info(3, 'Installed products updated.') except Exception, e: conduit.error(3, str(e))