<s> import argparse <EOL> import os <EOL> import pprint <EOL> from st2common . util . monkey_patch import monkey_patch <EOL> from st2common . ssh . parallel_ssh import ParallelSSHClient <EOL> monkey_patch ( ) <EOL> def main ( user , pkey , password , hosts_str , cmd , file_path , dir_path , delete_dir ) : <EOL> hosts = hosts_str . split ( "<STR_LIT:U+002C>" ) <EOL> client = ParallelSSHClient ( user = user , pkey = pkey , password = password , hosts = hosts ) <EOL> pp = pprint . PrettyPrinter ( indent = <NUM_LIT:4> ) <EOL> if file_path : <EOL> if not os . path . exists ( file_path ) : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> results = client . put ( file_path , '<STR_LIT>' , mode = "<STR_LIT>" ) <EOL> pp . pprint ( '<STR_LIT>' % results ) <EOL> results = client . run ( '<STR_LIT>' ) <EOL> pp . pprint ( '<STR_LIT>' % results ) <EOL> if dir_path : <EOL> if not os . path . exists ( dir_path ) : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> results = client . put ( dir_path , '<STR_LIT>' , mode = "<STR_LIT>" ) <EOL> pp . pprint ( '<STR_LIT>' % results ) <EOL> results = client . run ( '<STR_LIT>' ) <EOL> pp . pprint ( '<STR_LIT>' % results ) <EOL> if cmd : <EOL> results = client . run ( cmd ) <EOL> pp . pprint ( '<STR_LIT>' % results ) <EOL> if delete_dir : <EOL> results = client . delete_dir ( delete_dir , force = True ) <EOL> pp . pprint ( '<STR_LIT>' % results ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = True , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = False , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = False , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = True , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = False , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = False , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = False , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = False , <EOL> help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> main ( user = args . user , pkey = args . private_key , password = args . password , <EOL> hosts_str = args . hosts , cmd = args . cmd , <EOL> file_path = args . file , dir_path = args . dir , delete_dir = args . delete_dir ) </s>
