~cprov/uci-engine/boottest-probe

« back to all changes in this revision

Viewing changes to image-watcher/imagewatcher/queues.py

  • Committer: Ubuntu CI Bot
  • Author(s): Parameswaran Sivatharman
  • Date: 2015-01-17 11:17:34 UTC
  • mfrom: (920.2.11 uci-engine)
  • Revision ID: ubuntu_ci_bot-20150117111734-lkf7x2f0cb7ujlsb
Image watcher to trigger the workflow for when a new image available in http://cloud-images.ubuntu.com/ [r=Paul Larson, Celso Providelo]

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Ubuntu CI Engine
 
2
# Copyright 2014 Canonical Ltd.
 
3
 
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU Affero General Public License version 3, as
 
6
# published by the Free Software Foundation.
 
7
 
 
8
# This program is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
# PURPOSE.  See the GNU Affero General Public License for more details.
 
12
 
 
13
# You should have received a copy of the GNU Affero General Public License
 
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 
 
16
import json
 
17
 
 
18
 
 
19
from ci_utils import amqp_utils
 
20
 
 
21
 
 
22
class PublisherQueue(object):
 
23
    """A proxy to the queue library.
 
24
 
 
25
    This implementation targets ci_utils/amqp_utils but can be replaced for
 
26
    tests.
 
27
    """
 
28
 
 
29
    def __init__(self, queue_name):
 
30
        self.queue_name = queue_name
 
31
 
 
32
    def publish(self, msg):
 
33
        amqp_utils.send(self.queue_name, json.dumps(msg),
 
34
                        raise_errors=True)