fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] simple test loop.


From: Jeff Honey
Subject: [Fab-user] simple test loop.
Date: Tue, 19 Oct 2010 10:54:57 -0400

In an effort to do a rudimentary test before moving onto the next host, I've 
nested one function inside another. I put a file on the host, reboot it, and 
then test if I can pull it back down. When I can, move to the next host in the 
loop.

...in fabfile.py:
<snip>
def is_ready():
 with settings(warn_only=True):
  get('/tmp/ready.txt','~/')

def reboot():
 for host in env.roledefs['test']:
  with settings(host_string=host):
   put('ready.txt','/tmp/')
   run('shutdown -r now')
   while not is_ready():
    time.sleep(60)
   return True
</snip>

...the resultant error:
<snip>
Traceback (most recent call last):
  File "c:\python26\lib\site-packages\fabric\main.py", line 537, in main 
commands[name](*args, **kwargs)
  File "C:\Users\foo\Desktop\fabfile.py", line 41, in reboot while not 
is_ready():
  File "C:\Users\foo\Desktop\fabfile.py", line 30, in is_ready 
get('/tmp/ready.txt','~/')
  File "C:\Python26\lib\contextlib.py", line 34, in __exit__ 
self.gen.throw(type, value, traceback)
  File "C:\Python26\lib\contextlib.py", line 113, in nested yield vars
  File "C:\Users\foo\Desktop\fabfile.py", line 30, in is_ready 
get('/tmp/ready.txt','~/')
  File "c:\python26\lib\site-packages\fabric\network.py", line 391, in 
host_prompting_wrapper return func(*args, **kwargs)
  File "c:\python26\lib\site-packages\fabric\operations.py", line 372, in get 
_handle_failure(message=msg % remote_path, exception=e)
  File "C:\Python26\lib\contextlib.py", line 153, in __exit__ self.thing.close()
AttributeError: 'NoneType' object has no attribute 'close'
Disconnecting from host... done.
</snip>

Am I even on the right track?
--
 ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤ kyoboku kazeoshi ¤
 ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤


reply via email to

[Prev in Thread] Current Thread [Next in Thread]