1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """
18 Contains product event handler classes.
19 """
20
21 from pulp.server.event.dispatcher import *
22 from pulp.server.api.repo import RepoApi
23 from pulp.messaging.producer import EventProducer
24 from logging import getLogger
25
26 log = getLogger(__name__)
27
28
29 @handler(entity='product')
30 -class ProductEvent(EventHandler):
31 """
32 The I{product} event handler.
33 @ivar rapi: The product API object.
34 @type rapi: L{productApi}
35 """
36
39
40
41 @outbound(action='created')
42 - def create(self, *args, **kwargs):
43 """
44 Raise events when a product is created.
45 Called when productApi.create() is called.
46 @param args: The arguments passed to productApi.create()
47 @type args: list
48 @param kwargs: The keyword arguments passed to productApi.create()
49 @type kwargs: list
50 """
51 pass
52
53 @outbound(action='updated')
54 - def update(self, *args, **kwargs):
55 """
56 Raise events when a product is updated.
57 Called when productApi.update() is called.
58 @param args: The arguments passed to productApi.update()
59 @type args: list
60 @param kwargs: The keyword arguments passed to productApi.update()
61 @type kwargs: list
62 """
63 pass
64
65 @outbound(action='deleted')
66 - def delete(self, *args, **kwargs):
67 """
68 Raise events when a product is deleted.
69 Called when productApi.delete() is called.
70 @param args: The arguments passed to productApi.delete()
71 @type args: list
72 @param kwargs: The keyword arguments passed to productApi.delete()
73 @type kwargs: list
74 """
75 pass
76
77 @inbound(action='created')
79 """
80 The I{inbound} event handler for product.created AMQP events.
81 Called when an AMQP event is received notifying that
82 a product has been created. When received, the API is used
83 to create the specified product in pulp.
84 @param event: The event payload.
85 @type event: dict.
86 """
87 log.error("Repo event create processing %s" % event)
88 productid = event['id']
89 content_set = event['content_set']
90 cert_data = event['cert_data']
91 log.error("Repo event data %s %s %s" % (productid, content_set, cert_data))
92 self.rapi.create_product_repo(content_set, cert_data, productid)
93
94 @inbound(action='updated')
96 """
97 The I{inbound} event handler for product.updated AMQP events.
98 Called when an AMQP event is received notifying that
99 a product has been created. When received, the API is used
100 to update the specified product in pulp.
101 @param event: The event payload.
102 @type event: dict.
103 """
104 pass
105
106 @inbound(action='deleted')
108 """
109 The I{inbound} event handler for product.deleted AMQP events.
110 Called when an AMQP event is received notifying that
111 a product has been deleted. When received, the API is used
112 to delete the specified product in pulp.
113 @param event: The event payload.
114 @type event: dict.
115 """
116 pass
117