Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 0305113317f9e80328b139dce3f45533 > files > 22

python-quantumclient-2.1-1.fc18.src.rpm

From 0feeaaaa300277d3755c80bc8fc5d6b2bcf12559 Mon Sep 17 00:00:00 2001
From: gongysh <gongysh@linux.vnet.ibm.com>
Date: Sun, 27 Jan 2013 22:51:17 +0800
Subject: [PATCH] Delete network with id in sample code using API.

Bug #1106936

Change-Id: I6a7ee694a916af3f0268884ce28ca12e5efdc025
---
 doc/source/index.rst | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/doc/source/index.rst b/doc/source/index.rst
index 85ca400..1dd7cae 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -3,13 +3,17 @@ Python bindings to the OpenStack Network API
 
 In order to use the python quantum client directly, you must first obtain an auth token and identify which endpoint you wish to speak to. Once you have done so, you can use the API like so::
 
+    >>> import logging
     >>> from quantumclient.quantum import client
+    >>> logging.basicConfig(level=logging.DEBUG)
     >>> quantum = client.Client('2.0', endpoint_url=OS_URL, token=OS_TOKEN)
+    >>> quantum.format = 'json'
     >>> network = {'name': 'mynetwork', 'admin_state_up': True}
     >>> quantum.create_network({'network':network})
     >>> networks = quantum.list_networks(name='mynetwork')
     >>> print networks
-    >>> quantum.delete_network(name='mynetwork')
+    >>> network_id = networks['networks'][0]['id']
+    >>> quantum.delete_network(network_id)
 
 
 Command-line Tool