本文整理汇总了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))
示例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)
示例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()
示例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))
示例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)
示例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
示例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)
示例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)
示例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)
示例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))
示例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()
示例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))
示例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))
示例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()
示例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' +