commit a50c0c58a33337ee169e478188703114caea02e8 Author: Jorge Vargas Date: Thu May 28 22:48:08 2009 -0400 - Adding a dryrun option diff --git a/fabric/operations.py b/fabric/operations.py index 7fb18f4..13afcfb 100644 --- a/fabric/operations.py +++ b/fabric/operations.py @@ -360,6 +360,10 @@ def run(command, shell=True): print("[%s] run: %s" % (env.host_string, real_command)) elif output.running: print("[%s] run: %s" % (env.host_string, command)) + + if env.dryrun: + return + channel = connections[env.host_string]._transport.open_session() channel.exec_command(real_command) capture = [] @@ -449,6 +453,10 @@ def sudo(command, shell=True, user=None, pty=False): print("[%s] sudo: %s" % (env.host_string, real_command)) elif output.running: print("[%s] sudo: %s" % (env.host_string, command)) + + if env.dryrun: + return + channel = connections[env.host_string]._transport.open_session() # Create pty if necessary (using Paramiko default options, which as of # 1.7.4 is vt100 $TERM @ 80x24 characters) diff --git a/fabric/state.py b/fabric/state.py index 822e3ae..24b2f9a 100644 --- a/fabric/state.py +++ b/fabric/state.py @@ -187,6 +187,21 @@ env_options = [ help="specify a new shell, defaults to '/bin/bash -l -c'" ), + # Debug output + # TODO: tie into global output controls better (this is just a stopgap) + make_option('--debug', + action='store_true', + default=False, + help="display debug output" + ), + + make_option('--dryrun', + action='store_true', + default=False, + help="don't actually do anything" + ), + + # Config file location make_option('-c', '--config', dest='rcfile',