サーバーを管理するために使用する 2 つのユーザー名と対応するパスワードがあります。fab スクリプト/モジュールを使用する方法はありますか?各ホストまたはそれらのグループ。
run() などの周りで try/except を実行する方法がドキュメントにありません...
run
およびその他のコマンドは SystemExit を発生させます
from fabric.api import run,cd,put,sudo,settings
def do_stuff():
run('ls derp')
try:
with(settings(host_string='%s@localhost' % first_user,password = first_password)):
do_stuff()
except SystemExit:
with(settings(host_string='%s@localhost' % second_user,password = second_password)):
do_stuff()