Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / lib / python2.7 / dist-packages / landscape / manager / | server ip : 172.67.156.115 your ip : 172.70.80.236 H O M E |
Filename | /usr/lib/python2.7/dist-packages/landscape/manager/service.py |
Size | 2.2 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 20-Feb-2014 23:01 |
Last accessed | 06-Jul-2025 20:05 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
from twisted.python.reflect import namedClass
from landscape.service import LandscapeService, run_landscape_service
from landscape.manager.config import ManagerConfiguration
from landscape.broker.amp import RemoteBrokerConnector
from landscape.amp import ComponentPublisher
from landscape.manager.manager import Manager
class ManagerService(LandscapeService):
"""
The core Twisted Service which creates and runs all necessary managing
components when started.
"""
service_name = Manager.name
def __init__(self, config):
super(ManagerService, self).__init__(config)
self.plugins = self.get_plugins()
self.manager = Manager(self.reactor, self.config)
self.publisher = ComponentPublisher(self.manager, self.reactor,
self.config)
def get_plugins(self):
"""Return instances of all the plugins enabled in the configuration."""
return [namedClass("landscape.manager.%s.%s"
% (plugin_name.lower(), plugin_name))()
for plugin_name in self.config.plugin_factories]
def startService(self):
"""Start the manager service.
This method does 3 things, in this order:
- Start listening for connections on the manager socket.
- Connect to the broker.
- Add all configured plugins, that will in turn register themselves.
"""
super(ManagerService, self).startService()
self.publisher.start()
def start_plugins(broker):
self.broker = broker
self.manager.broker = broker
for plugin in self.plugins:
self.manager.add(plugin)
return self.broker.register_client(self.service_name)
self.connector = RemoteBrokerConnector(self.reactor, self.config)
connected = self.connector.connect()
return connected.addCallback(start_plugins)
def stopService(self):
"""Stop the manager and close the connection with the broker."""
self.connector.disconnect()
self.publisher.stop()
super(ManagerService, self).stopService()
def run(args):
run_landscape_service(ManagerConfiguration, ManagerService, args)
from landscape.service import LandscapeService, run_landscape_service
from landscape.manager.config import ManagerConfiguration
from landscape.broker.amp import RemoteBrokerConnector
from landscape.amp import ComponentPublisher
from landscape.manager.manager import Manager
class ManagerService(LandscapeService):
"""
The core Twisted Service which creates and runs all necessary managing
components when started.
"""
service_name = Manager.name
def __init__(self, config):
super(ManagerService, self).__init__(config)
self.plugins = self.get_plugins()
self.manager = Manager(self.reactor, self.config)
self.publisher = ComponentPublisher(self.manager, self.reactor,
self.config)
def get_plugins(self):
"""Return instances of all the plugins enabled in the configuration."""
return [namedClass("landscape.manager.%s.%s"
% (plugin_name.lower(), plugin_name))()
for plugin_name in self.config.plugin_factories]
def startService(self):
"""Start the manager service.
This method does 3 things, in this order:
- Start listening for connections on the manager socket.
- Connect to the broker.
- Add all configured plugins, that will in turn register themselves.
"""
super(ManagerService, self).startService()
self.publisher.start()
def start_plugins(broker):
self.broker = broker
self.manager.broker = broker
for plugin in self.plugins:
self.manager.add(plugin)
return self.broker.register_client(self.service_name)
self.connector = RemoteBrokerConnector(self.reactor, self.config)
connected = self.connector.connect()
return connected.addCallback(start_plugins)
def stopService(self):
"""Stop the manager and close the connection with the broker."""
self.connector.disconnect()
self.publisher.stop()
super(ManagerService, self).stopService()
def run(args):
run_landscape_service(ManagerConfiguration, ManagerService, args)