Package pulp :: Package server :: Module agent
[hide private]
[frames] | no frames]

Source Code for Module pulp.server.agent

 1  #! /usr/bin/env python 
 2  # 
 3  # Copyright (c) 2010 Red Hat, Inc. 
 4  # 
 5  # This software is licensed to you under the GNU General Public License, 
 6  # version 2 (GPLv2). There is NO WARRANTY for this software, express or 
 7  # implied, including the implied warranties of MERCHANTABILITY or FITNESS 
 8  # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 
 9  # along with this software; if not, see 
10  # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 
11  # 
12  # Red Hat trademarks are not licensed under GPLv2. No permission is 
13  # granted to use or replicate Red Hat trademarks that are incorporated 
14  # in this software or its documentation. 
15  # 
16   
17  """ 
18  Contains (proxy) classes that represent the pulp agent. 
19  The proxy classes must match the names of classes that are exposed 
20  on the agent. 
21  """ 
22   
23  from pulp.messaging.broker import Broker 
24  from pulp.messaging.stub import Stub 
25  from pulp.messaging.decorators import stub 
26  from pulp.messaging.base import Container 
27  from pulp.messaging.producer import Producer 
28  from pulp.server import config 
29 30 31 @stub('admin') 32 -class AgentAdmin(Stub):
33 pass
34
35 @stub('repo') 36 -class Repo(Stub):
37 pass
38
39 @stub('packages') 40 -class Packages(Stub):
41 pass
42
43 @stub('packagegroups') 44 -class PackageGroups(Stub):
45 pass
46
47 @stub('shell') 48 -class Shell(Stub):
49 pass
50
51 52 -class Agent(Container):
53 """ 54 A collection of stubs that represent the agent. 55 """ 56
57 - def __init__(self, uuid, **options):
58 """ 59 @param uuid: The consumer uuid. 60 @type uuid: str|list 61 @param options: Messaging L{pulp.messaging.Options} 62 """ 63 url = config.config.get('messaging', 'url') 64 broker = Broker.get(url) 65 broker.cacert = config.config.get('messaging', 'cacert') 66 broker.clientcert = config.config.get('messaging', 'clientcert') 67 self.__producer = Producer(url=url) 68 Container.__init__(self, uuid, self.__producer, **options)
69
70 - def delete(self):
71 """ 72 Delete all messaging resources. 73 """ 74 queue = self._Container__destination() 75 if isinstance(queue, (list, tuple)): 76 raise Exception, 'group delete, not permitted' 77 session = self.__producer.session() 78 queue.delete(session)
79