python-provy/provy — pull request #102 by jbzdak (2013-01-27 18:32:06+00:00)
Title: Base role changes

There are following changes in base role:

1. added cwd argument to `execute`, it is used in two my other roles (one of which will be merged) and is IMO gerally usefull.
1.a. as a consequence `__cd` method is also introduced. It basicalliy checks if cwd is not None and then it used fabric.api.cd.
2. added two functions that create randomized temporaty file and directory on remote server. It is usefull to push some file to remote server, do something with it (for example unpack) and then move it to remote destination. Only drawback is that testing can be harder --- since output of these methods is random.
2.a. As a consequesnce I added `Roleself._paths_to_remove = set()` that holds all these temporary random files that will be removed during `cleanup`. I'm not enitrely sure we shouldn't put this into context, on the other hand in that case cleanup would have to be taken out of `Role.cleanup` to some other place.
2.b. As a consequence `remove_file` now takes stdout argument that suppresses logging --- it is to suppres logging of removal of these random files.
3. I added `execute_python_script` that executes python script on remote server, one gain over `execute_python` is that python code is stored on remote system as a temporary file and so we dont need to think about shell escapes of "" and ''.
4. I added `remote_list_directory` that lists remote directory. It is used in java role.