Package pulp :: Package server :: Package event :: Package handler :: Module product
[hide private]
[frames] | no frames]

Source Code for Module pulp.server.event.handler.product

  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 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
37 - def __init__(self):
38 self.rapi = RepoApi()
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')
78 - def created(self, event):
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')
95 - def updated(self, event):
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')
107 - def deleted(self, event):
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