Ejemplo n.º 1
0
 def changed(cls, path):
     """
     A change in the pulp certificate has been detected.
     When the certificate has been deleted: the connection to the broker is
     terminated by setting the UUID to None.
     When the certificate has been added/updated: the plugin's configuration is
     updated using the pulp configuration; the uuid is updated and the connection
     to the broker is re-established.
     :param path: The changed file (ignored).
     :type path: str
     """
     log.info('changed: %s', path)
     plugin = Plugin.find(__name__)
     bundle = ConsumerX509Bundle()
     consumer_id = bundle.cn()
     if consumer_id:
         scheme = cfg.messaging.scheme
         host = cfg.messaging.host or cfg.server.host
         port = cfg.messaging.port
         url = '%s://%s:%s' % (scheme, host, port)
         plugin_conf = plugin.cfg()
         plugin_conf.messaging.url = url
         plugin_conf.messaging.cacert = cfg.messaging.cacert
         plugin_conf.messaging.clientcert = cfg.messaging.clientcert or \
             os.path.join(cfg.filesystem.id_cert_dir, cfg.filesystem.id_cert_filename)
     plugin.setuuid(consumer_id)
Ejemplo n.º 2
0
from gofer.agent.plugin import Plugin
from gofer.pmon import PathMonitor
from gofer.config import Config

try:
    from subscription_manager.identity import ConsumerIdentity
except ImportError:
    from subscription_manager.certlib import ConsumerIdentity

from rhsm.connection import UEPConnection, RemoteServerException, GoneException

from katello.agent.pulp import Dispatcher


# This plugin
plugin = Plugin.find(__name__)

# Path monitoring
path_monitor = None

# Track registration status
registered = False


log = getLogger(__name__)


RHSM_CONFIG_PATH = '/etc/rhsm/rhsm.conf'


@load
Ejemplo n.º 3
0
import sys
sys.path.append('/usr/share/rhsm')

import os
from yum import YumBase
from gofer.decorators import *
from gofer.agent.plugin import Plugin
from gofer.pmon import PathMonitor
from subscription_manager.certlib import ConsumerIdentity
from rhsm.connection import UEPConnection
from logging import getLogger, Logger


log = getLogger(__name__)
plugin = Plugin.find(__name__)
cfg = plugin.cfg()

# plugin exports
package = Plugin.find('package')
Package = package.export('Package')
PackageGroup = package.export('PackageGroup')


def getbool(v):
    """
    Get string bool value.
    @param v: A string.
    @type v: str
    @return: True if v in (TRUE|YES|1)
    @rtype: bool
Ejemplo n.º 4
0
 def hello(self):
     plugin = Plugin.find(__name__)
     log.info('Hello:\n%s', plugin.cfg)
Ejemplo n.º 5
0
 def hello(self):
     plugin = Plugin.find(__name__)
     log.info('Hello:\n%s', plugin.cfg)