• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python injectioninit.init_dep_injection函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中subscription_manager.injectioninit.init_dep_injection函数的典型用法代码示例。如果您正苦于以下问题:Python init_dep_injection函数的具体用法?Python init_dep_injection怎么用?Python init_dep_injection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了init_dep_injection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: posttrans_hook

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))
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:25,代码来源:product-id.py


示例2: ListInstalledProducts

    def ListInstalledProducts(self, filter_string, proxy_options, locale, sender=None):

        # We reinitialize dependency injection here for following reason. When new product
        # certificate is installed (or existing is removed), then this change is not propagated to
        # CertSorter and other caches. Calling installed_products.list(filter_string) without
        # reinitialization of dependency injection would return old (cached) list of installed
        # products.
        init_dep_injection()

        filter_string = dbus_utils.dbus_to_python(filter_string, expected_type=str)
        proxy_options = dbus_utils.dbus_to_python(proxy_options, expected_type=dict)
        locale = dbus_utils.dbus_to_python(locale, expected_type=str)

        Locale.set(locale)

        cp = self.build_uep(proxy_options, proxy_only=True)

        installed_products = InstalledProducts(cp)

        try:
            response = installed_products.list(filter_string)
        except Exception as err:
            raise dbus.DBusException(str(err))

        return json.dumps(response)
开发者ID:Januson,项目名称:subscription-manager,代码行数:25,代码来源:products.py


示例3: initialize

    def initialize(self):
        NormalSpoke.initialize(self)
        self._done = False
        init_dep_injection()

        facts = inj.require(inj.FACTS)
        backend = managergui.Backend()

        self._registergui = registergui.RegisterScreen(backend, facts,
                                                       callbacks=[self.finished])
        self._action_area = self.builder.get_object("RHSMSpokeWindow-action_area1")
        self._register_box = self._registergui.dialog_vbox6

        # FIXME: close_window handling is kind of a mess. Standlone subman gui,
        # the firstboot screens, and initial-setup need it to do different
        # things. Potentially a 'Im done with this window now' signal, with
        # each attaching different handlers.
        self._registergui.close_window_callback = self._close_window_callback

        # we have a ref to _register_box, but need to remove it from
        # the regustergui.window (a GtkDialog), and add it to the main
        # box in the action area of our initial-setup screen.
        self._registergui.window.remove(self._register_box)
        self._action_area.pack_end(self._register_box, True, True, 0)
        self._action_area.show()
        self._register_box.show_all()
        self._registergui.initialize()
开发者ID:vritant,项目名称:subscription-manager,代码行数:27,代码来源:rhsm_gui.py


示例4: postconfig_hook

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))
开发者ID:NehaRawat,项目名称:subscription-manager,代码行数:26,代码来源:subscription-manager.py


示例5: func_wrapper

    def func_wrapper(*args, **kwargs):
        global injected
        if not injected:
            logutil.init_logger()

            from subscription_manager.injectioninit import init_dep_injection
            init_dep_injection()
            injected = True
        return func(*args, **kwargs)
开发者ID:Januson,项目名称:subscription-manager,代码行数:9,代码来源:__init__.py


示例6: posttrans_hook

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, e:
        conduit.error(3, str(e))
        return
开发者ID:candlepin,项目名称:subscription-manager,代码行数:14,代码来源:product-id.py


示例7: run

    def run(self):
        try:
            init_dep_injection()
        except ImportError as e:
            logger.error(str(e))
            return

        command = packageprofilelib.PackageProfileActionCommand()
        report = command.perform(force_upload=self.opts.force_upload)

        if report._status == 0:
            print(_("No updates performed. See /var/log/rhsm/rhsm.log for more information."))
        else:
            print(report)
开发者ID:Januson,项目名称:subscription-manager,代码行数:14,代码来源:upload-profile.py


示例8: main

def main():
    from subscription_manager.plugins import PluginManager
    from subscription_manager import injectioninit
    from subscription_manager.plugins import UpdateContentConduit
    from subscription_manager.model.ent_cert import EntitlementDirEntitlementSource
    from subscription_manager.content_action_client import ContentPluginActionReport

    plugin_manager = PluginManager()
    plugin_class = plugin_manager.get_plugins()['container_content.ContainerContentPlugin']
    plugin = plugin_class()
    injectioninit.init_dep_injection()
    ent_source = EntitlementDirEntitlementSource()
    reports = ContentPluginActionReport()
    conduit = UpdateContentConduit(plugin_class, reports=reports, ent_source=ent_source)
    plugin.update_content_hook(conduit)
开发者ID:Januson,项目名称:subscription-manager,代码行数:15,代码来源:container_content.py


示例9: initialize

    def initialize(self):
        NormalSpoke.initialize(self)
        self._done = False

        init_dep_injection()

        backend = managergui.Backend()
        self.info = registergui.RegisterInfo()
        self.info.connect('notify::register-status', self._on_register_status_change)
        self._status = self.info.get_property('register-status')

        self.register_widget = registergui.RegisterWidget(
            backend,
            reg_info=self.info,
            parent_window=self.main_window
        )

        self.register_box = self.builder.get_object("register_box")
        self.button_box = self.builder.get_object('navigation_button_box')
        self.proceed_button = self.builder.get_object('proceed_button')
        self.back_button = self.builder.get_object('back_button')

        self.register_box.pack_start(self.register_widget.register_widget,
                                     True, True, 0)

        # Hook up the nav buttons in the gui
        # TODO: add a 'start over'?
        self.proceed_button.connect('clicked', self._on_register_button_clicked)
        self.back_button.connect('clicked', self._on_back_button_clicked)

        # initial-setup will likely
        self.register_widget.connect('finished', self._on_finished)
        self.register_widget.connect('register-finished', self._on_register_finished)
        self.register_widget.connect('register-error', self._on_register_error)
        self.register_widget.connect('register-message', self._on_register_message)

        # update the 'next/register button on page change'
        self.register_widget.connect('notify::register-button-label',
                                       self._on_register_button_label_change)

        self.register_widget.connect('notify::screen-ready',
                                     self._on_register_screen_ready_change)

        self.register_box.show_all()
        self.register_widget.initialize()
        self.back_button.set_sensitive(False)
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:46,代码来源:rhsm_gui.py


示例10: config

    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))
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:20,代码来源:subscription-manager.py


示例11: initialize

    def initialize(self):
        NormalSpoke.initialize(self)
        self._done = False

        init_dep_injection()

        facts = inj.require(inj.FACTS)

        backend = managergui.Backend()
        self.info = registergui.RegisterInfo()

        self.register_widget = registergui.RegisterWidget(
            backend, facts, reg_info=self.info, parent_window=self.main_window
        )

        self.register_box = self.builder.get_object("register_box")
        self.button_box = self.builder.get_object("navigation_button_box")
        self.proceed_button = self.builder.get_object("proceed_button")
        self.back_button = self.builder.get_object("back_button")

        self.register_box.pack_start(self.register_widget.register_widget, True, True, 0)

        # Hook up the nav buttons in the gui
        # TODO: add a 'start over'?
        self.proceed_button.connect("clicked", self._on_register_button_clicked)
        self.back_button.connect("clicked", self._on_back_button_clicked)

        # initial-setup will likely
        self.register_widget.connect("finished", self._on_finished)
        self.register_widget.connect("register-finished", self._on_register_finished)
        self.register_widget.connect("register-error", self._on_register_error)
        self.register_widget.connect("register-message", self._on_register_message)

        # update the 'next/register button on page change'
        self.register_widget.connect("notify::register-button-label", self._on_register_button_label_change)

        self.register_widget.connect("notify::screen-ready", self._on_register_screen_ready_change)

        self.register_box.show_all()
        self.register_widget.initialize()
开发者ID:kanarip,项目名称:subscription-manager,代码行数:40,代码来源:rhsm_gui.py


示例12: transaction

    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))
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:22,代码来源:product-id.py


示例13: config_hook

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))
开发者ID:jaredjennings,项目名称:subscription-manager,代码行数:22,代码来源:subscription-manager.py


示例14: initialize

    def initialize(self):
        NormalSpoke.initialize(self)
        self._done = False
        init_dep_injection()

        facts = inj.require(inj.FACTS)

        backend = managergui.Backend()

        self.register_widget = registergui.RegisterWidget(backend, facts,
                                                          parent_window=self.main_window)

        self.register_box = self.builder.get_object("register_box")
        self.button_box = self.builder.get_object('navigation_button_box')
        self.proceed_button = self.builder.get_object('proceed_button')
        self.cancel_button = self.builder.get_object('cancel_button')

        self.register_box.pack_start(self.register_widget.register_widget,
                                     True, True, 0)

        # Hook up the nav buttons in the gui
        # TODO: add a 'start over'?
        self.proceed_button.connect('clicked', self._on_register_button_clicked)
        self.cancel_button.connect('clicked', self.cancel)

        # initial-setup will likely
        self.register_widget.connect('finished', self.finished)
        self.register_widget.connect('register-finished', self.register_finished)
        self.register_widget.connect('register-error', self._on_register_error)

        # update the 'next/register button on page change'
        self.register_widget.connect('notify::register-button-label',
                                       self._on_register_button_label_change)

        self.register_box.show_all()
        self.register_widget.initialize()
开发者ID:alikins,项目名称:subscription-manager,代码行数:36,代码来源:rhsm_gui.py


示例15: init_dep_injection

# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#

import sys
sys.path.append("/usr/share/rhsm")

import logging

from rhsm import connection

from subscription_manager.injectioninit import init_dep_injection
init_dep_injection()

from subscription_manager import certmgr
from subscription_manager import logutil
from subscription_manager import managerlib
from subscription_manager.certlib import ConsumerIdentity
from subscription_manager.i18n_optparse import OptionParser, \
    WrappedIndentedHelpFormatter, USAGE

import gettext
_ = gettext.gettext


def main(options, log):
    if not ConsumerIdentity.existsAndValid():
        log.error('Either the consumer is not registered or the certificates' +
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:31,代码来源:rhsmcertd-worker.py



注:本文中的subscription_manager.injectioninit.init_dep_injection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python managercli.handle_exception函数代码示例发布时间:2022-05-27
下一篇:
Python injection.require函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap