libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1209968 - in /libcloud/branches/py3k: demos/compute_demo.py example_compute.py example_loadbalancer.py
Date Sat, 03 Dec 2011 18:31:45 GMT
Author: tomaz
Date: Sat Dec  3 18:31:45 2011
New Revision: 1209968

URL: http://svn.apache.org/viewvc?rev=1209968&view=rev
Log:
Update examples and demo.

Modified:
    libcloud/branches/py3k/demos/compute_demo.py
    libcloud/branches/py3k/example_compute.py
    libcloud/branches/py3k/example_loadbalancer.py

Modified: libcloud/branches/py3k/demos/compute_demo.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/demos/compute_demo.py?rev=1209968&r1=1209967&r2=1209968&view=diff
==============================================================================
--- libcloud/branches/py3k/demos/compute_demo.py (original)
+++ libcloud/branches/py3k/demos/compute_demo.py Sat Dec  3 18:31:45 2011
@@ -55,7 +55,7 @@ def get_demo_driver(provider_name='RACKS
     >>> driver.load_nodes()
     >>> images = driver.load_images()
     >>> sizes = driver.load_sizes()
-    
+
     # And maybe do more than that:
     >>> node = driver.create_node(
             name='my_first_node',

Modified: libcloud/branches/py3k/example_compute.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/example_compute.py?rev=1209968&r1=1209967&r2=1209968&view=diff
==============================================================================
--- libcloud/branches/py3k/example_compute.py (original)
+++ libcloud/branches/py3k/example_compute.py Sat Dec  3 18:31:45 2011
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 from libcloud.compute.types import Provider
 from libcloud.compute.providers import get_driver
 
@@ -19,18 +20,18 @@ EC2 = get_driver(Provider.EC2_US_EAST)
 Slicehost = get_driver(Provider.SLICEHOST)
 Rackspace = get_driver(Provider.RACKSPACE)
 
-drivers = [ EC2('access key id', 'secret key'), 
-            Slicehost('api key'), 
+drivers = [ EC2('access key id', 'secret key'),
+            Slicehost('api key'),
             Rackspace('username', 'api key') ]
 
 nodes = [ driver.list_nodes() for driver in drivers ]
 
-print nodes
+print(nodes)
 # [ <Node: provider=Amazon, status=RUNNING, name=bob, ip=1.2.3.4.5>,
 # <Node: provider=Slicehost, status=REBOOT, name=korine, ip=6.7.8.9.10>, ... ]
 
 # grab the node named "test"
-node = filter(lambda x: x.name == 'test', nodes)[0]
+node = [n for n in nodes if n.name == 'test'][0]
 
 # reboot "test"
 node.reboot()

Modified: libcloud/branches/py3k/example_loadbalancer.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/example_loadbalancer.py?rev=1209968&r1=1209967&r2=1209968&view=diff
==============================================================================
--- libcloud/branches/py3k/example_loadbalancer.py (original)
+++ libcloud/branches/py3k/example_loadbalancer.py Sat Dec  3 18:31:45 2011
@@ -29,7 +29,7 @@ def main():
 
     balancers = driver.list_balancers()
 
-    print balancers
+    print(balancers)
 
     # creating a balancer which balances traffic across two
     # nodes: 192.168.86.1:80 and 192.168.86.2:8080. Balancer
@@ -43,7 +43,7 @@ def main():
                      Member(None, '192.168.86.2', 8080))
             )
 
-    print new_balancer
+    print(new_balancer)
 
     # wait for balancer to become ready
     # NOTE: in real life code add timeout to not end up in
@@ -54,12 +54,12 @@ def main():
         if balancer.state == State.RUNNING:
             break
 
-        print "sleeping for 30 seconds for balancers to become ready"
+        print('sleeping for 30 seconds for balancers to become ready')
         time.sleep(30)
 
     # fetch list of members
     members = balancer.list_members()
-    print members
+    print(members)
 
     # remove first member
     balancer.detach_member(members[0])



Mime
View raw message