diff options
author | Jesse Andrews <anotherjesse@gmail.com> | 2010-05-30 15:21:34 -0700 |
---|---|---|
committer | Jesse Andrews <anotherjesse@gmail.com> | 2010-05-30 15:21:34 -0700 |
commit | 94518726fbb850ad5e81a7f937e197052f26bef2 (patch) | |
tree | 8cf585bb3f83db07ad2f5585c6bc37bad4602533 /nova/fakerabbit.py | |
parent | fd278ade0bf19ba9deba65976ce6af7c59c4443a (diff) | |
download | nova-94518726fbb850ad5e81a7f937e197052f26bef2.tar.gz nova-94518726fbb850ad5e81a7f937e197052f26bef2.tar.xz nova-94518726fbb850ad5e81a7f937e197052f26bef2.zip |
Merged Vish's work on adding projects to nova
Diffstat (limited to 'nova/fakerabbit.py')
-rw-r--r-- | nova/fakerabbit.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/nova/fakerabbit.py b/nova/fakerabbit.py index ec2e50791..13d432b45 100644 --- a/nova/fakerabbit.py +++ b/nova/fakerabbit.py @@ -1,12 +1,12 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright [2010] [Anso Labs, LLC] -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,7 +39,7 @@ class Exchange(object): for f in self._routes[routing_key]: logging.debug('Publishing to route %s', f) f(message, routing_key=routing_key) - + def bind(self, callback, routing_key): self._routes.setdefault(routing_key, []) self._routes[routing_key].append(callback) @@ -52,7 +52,7 @@ class Queue(object): def __repr__(self): return '<Queue: %s>' % self.name - + def push(self, message, routing_key=None): self._queue.put(message) @@ -70,7 +70,7 @@ class Backend(object): #super(__impl, self).__init__(*args, **kwargs) self._exchanges = {} self._queues = {} - + def _reset_all(self): self._exchanges = {} self._queues = {} @@ -78,7 +78,7 @@ class Backend(object): def queue_declare(self, queue, **kwargs): if queue not in self._queues: logging.debug('Declaring queue %s', queue) - self._queues[queue] = Queue(queue) + self._queues[queue] = Queue(queue) def exchange_declare(self, exchange, type, *args, **kwargs): if exchange not in self._exchanges: @@ -92,7 +92,7 @@ class Backend(object): routing_key) def get(self, queue, no_ack=False): - if not self._queues[queue].size(): + if not queue in self._queues or not self._queues[queue].size(): return None (message_data, content_type, content_encoding) = \ self._queues[queue].pop() @@ -122,7 +122,7 @@ class Backend(object): def __getattr__(self, attr): return getattr(self.__instance, attr) - + def __setattr__(self, attr, value): return setattr(self.__instance, attr, value) |