From ba5b547652b34820288e124412c735ace02ee078 Mon Sep 17 00:00:00 2001
From: Chris Dent <chdent@redhat.com>
Date: Mon, 21 Jul 2014 16:43:51 +0100
Subject: [PATCH] Fix error in example of an RPC server

Sample code in the documentation for rpc.server has an error which
prevents the code from being run. Replacing the `self` with `None`
results in code that runs. Whether it does anything useful is
an open question.

Change-Id: I81391fa3efdc65d54ca3aa155d63584f2b6f98c2
---
 oslo/messaging/rpc/server.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/oslo/messaging/rpc/server.py b/oslo/messaging/rpc/server.py
index 9a0783a44..b4d1315ff 100644
--- a/oslo/messaging/rpc/server.py
+++ b/oslo/messaging/rpc/server.py
@@ -54,7 +54,8 @@ A simple example of an RPC server with multiple endpoints might be::
             self.server = server
 
         def stop(self, ctx):
-            self.server.stop()
+            if server:
+                self.server.stop()
 
     class TestEndpoint(object):
 
@@ -64,7 +65,7 @@ A simple example of an RPC server with multiple endpoints might be::
     transport = messaging.get_transport(cfg.CONF)
     target = messaging.Target(topic='test', server='server1')
     endpoints = [
-        ServerControlEndpoint(self),
+        ServerControlEndpoint(None),
         TestEndpoint(),
     ]
     server = messaging.get_rpc_server(transport, target, endpoints,