Permalink
Browse files

add exception handling if the channels cannot be bound.

  • Loading branch information...
1 parent 4a223d7 commit f9c46c8a794f20adcf3fe6885eae830bd5218632 @codehelp codehelp committed Nov 9, 2012
View
@@ -1,6 +1,6 @@
include buildd-test.py
include pybitclient/dput.cf pybitclient/sbuild-cross.sh pybitclient/sbuild-orig.sh
-include configs/* test/* configs/client/*
+include configs/* test/* configs/client/* configs/watcher/*
include hook/* db/*
include pybitweb/static/*
include pybitweb/static/bootstrap/*
@@ -13,3 +13,4 @@ include pybit_web.py
include pybitclient/README
include apache_config.txt
include application.wsgi
+include pybit-watcher
View
@@ -65,12 +65,11 @@ Description: Common objects for pybit
Contains object definitions to common
Python objects between Pybit services
and the Postgres database schema for PyBit.
-
+
Package: pybit-watcher
Architecture: all
-Depends: python-inotify, python-daemon, pybit-common,
+Depends: python-inotify, python-daemon, pybit-common, reprepro,
${python:Depends}, ${misc:Depends}
-Description: pybit-watcher can watch incomming directories for reprepro
+Description: watches incomming directories for reprepro
This package provides a watcher which runs as a daemon and monitors a
directory for changes files then runs the appropriate reprepro rule.
-
@@ -1 +0,0 @@
-/etc/pybit/watcher/watcher.conf
@@ -1,12 +0,0 @@
-Package: pybit-watcher
-Source: pybit
-Version: 0.1.1-1
-Architecture: all
-Maintainer: Neil Williams <codehelp@debian.org>
-Installed-Size: 80
-Depends: python-inotify, python-daemon, pybit-common, python2.6, python (>= 2.6), python (<< 2.7)
-Section: devel
-Priority: extra
-Description: pybit-watcher can watch incomming directories for reprepro
- This package provides a watcher which runs as a daemon and monitors a
- directory for changes files then runs the appropriate reprepro rule.
@@ -1,3 +0,0 @@
-6e9afdfbc050656524caf09bf95d1ade usr/bin/pybit-watcher
-6e3c0e18efb151ff27548225edab228a usr/share/doc/pybit-watcher/changelog.Debian.gz
-390e144828f7e982597cb50a0de50039 usr/share/doc/pybit-watcher/copyright
@@ -1,6 +0,0 @@
-{
- "repobase": "/srv/tcl/distros/debian",
- "path" : "/srv/tcl/distros/debian/incomming",
- "dryrun" : true,
- "rule" : "lightwriters"
-}
@@ -1,60 +0,0 @@
-Files: debian/*
-Copyright: 2012 Neil Williams <codehelp@debian.org>
-Licence: GPL-2+
-
-Files: pybitclient/daemonlogger.py
-Copyright: 2010 Bud P. Bruegger <bud@sistema.it>
- 2012 Neil Williams <linux@codehelp.co.uk>
-Licence: BSD
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following disclaimer
- in the documentation and/or other materials provided with the
- distribution.
- * Neither the name of the author nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Files: *
-Copyright: 2012 Neil Williams <linux@codehelp.co.uk>
- 2012 Nick Davidson <nickd@toby-churchill.com>,
- 2012 Simon Haswell <simonh@toby-churchill.com>,
- 2012 Neil Williams <neilw@toby-churchill.com>,
- 2012 Nick Bane <nick@cecomputing.co.uk>,
- 2012 James Bennet <James.Bennet@toby-churchill.com>
-License: GPL-2+
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA.
-
-On Debian systems, the complete text of the GNU General
-Public License version 3 can be found in `/usr/share/common-licenses/GPL-2'.
@@ -76,11 +76,13 @@ def get_status(self, request = None):
def wait(self):
time.sleep(5)
if self.state == "IDLE" :
- msg = self.message_chan.basic_get()
+ if self.message_chan is not None:
+ msg = self.message_chan.basic_get()
if msg is not None :
self.message_handler(msg)
- cmd = self.command_chan.basic_get()
+ if self.command_chan is not None :
+ cmd = self.command_chan.basic_get()
if cmd is not None:
self.command_handler(cmd)
@@ -283,16 +285,24 @@ def connect(self):
return
logging.debug("Creating queue with name:" + self.queue_name)
- self.message_chan.queue_declare(queue=self.queue_name, durable=True,
- exclusive=False, auto_delete=False)
- self.message_chan.queue_bind(queue=self.queue_name,
- exchange=pybit.exchange_name, routing_key=self.routing_key)
+ try:
+ self.message_chan.queue_declare(queue=self.queue_name, durable=True,
+ exclusive=False, auto_delete=False)
+ self.message_chan.queue_bind(queue=self.queue_name,
+ exchange=pybit.exchange_name, routing_key=self.routing_key)
+ except amqp.exceptions.AMQPChannelException :
+ logging.debug ("Unable to declare or bind to message channel.")
+ pass
logging.debug ("Creating private command queue with name:" + self.conn_info.client_name)
- self.command_chan.queue_declare(queue=self.conn_info.client_name,
- durable=False, exclusive=True, auto_delete=False)
- self.command_chan.queue_bind(queue=self.conn_info.client_name,
- exchange=pybit.exchange_name, routing_key=self.conn_info.client_name)
+ try:
+ self.command_chan.queue_declare(queue=self.conn_info.client_name,
+ durable=False, exclusive=True, auto_delete=False)
+ self.command_chan.queue_bind(queue=self.conn_info.client_name,
+ exchange=pybit.exchange_name, routing_key=self.conn_info.client_name)
+ except amqp.exceptions.AMQPChannelException :
+ logging.debug ("Unable to declare or bind to command channel.")
+ pass
def disconnect(self):

0 comments on commit f9c46c8

Please sign in to comment.