Project

General

Profile

« Previous | Next » 

Revision 8fc79619

Added by Jeff Ortel almost 6 years ago

fixes #24006 - support plugin reload when queue not found.

View differences:

src/katello/agent/goferd/legacy_plugin.py
from katello.repos import upload_enabled_repos_report
from katello.enabled_report import EnabledReport
from gofer.decorators import initializer, remote, action
from gofer.decorators import load, unload, remote, action
from gofer.agent.plugin import Plugin
from gofer.pmon import PathMonitor
from gofer.agent.rmi import Context
......
except ImportError:
from subscription_manager.certlib import ConsumerIdentity
from rhsm.connection import UEPConnection, RemoteServerException
from rhsm.connection import UEPConnection, RemoteServerException, GoneException
from pulp.agent.lib.dispatcher import Dispatcher
from pulp.agent.lib.conduit import Conduit as HandlerConduit
......
RHSM_CONFIG_PATH = '/etc/rhsm/rhsm.conf'
@initializer
def init_plugin():
@load
def plugin_loaded():
"""
Initialize the plugin.
Called (once) immediately after the plugin is loaded.
......
- validate registration. If registered:
- setup plugin configuration.
"""
global path_monitor
path = ConsumerIdentity.certpath()
path_monitor = PathMonitor()
path_monitor.add(path, certificate_changed)
path_monitor.add(REPOSITORY_PATH, send_enabled_report)
path_monitor.start()
......
sleep(60)
@unload
def plugin_unloaded():
"""
The plugin has been uploaded.
"""
path_monitor.abort()
def bundle(certificate):
"""
Bundle the key and cert and write to a file.
......
uep = UEP()
consumer = uep.getConsumer(consumer_id)
registered = (consumer is not None)
except GoneException:
registered = False
except RemoteServerException, e:
if e.code != httplib.NOT_FOUND:
if e.code not in (httplib.NOT_FOUND, httplib.GONE):
log.warn(str(e))
raise
except Exception, e:

Also available in: Unified diff