Preview all parameters for all hosts (for testing)
 @param [Array<Hash>] hosts Host parameters (read from host list file).
 @param [Array<String>] commands Commands (read from command list file).
11050
def previewed_data(hosts, commands)
      @commands = commands
      hosts.map do |each|
        @host_param = each
        # [for a host] operation
        ready_to_open_host_session do |spawn_cmd|
          whole_previewed_parameters(spawn_cmd)
        end
      end
    end
810020
def alias_command(alias_name, name, *args)
      @commands[alias_name.to_s] = command name
      @aliases[alias_name.to_s] = args
    end
799911
def list(options)
      file = File.open(FILE_PATH, 'a+')
      servers = all_hosts_in(file)
      file.close
      if servers.empty?
        PRINTER.print 'No aliases added'
      else
        PRINTER.print 'Listing aliases:'
        servers.each{|x| PRINTER.print "\t- #{x}"}
      end
      finish_exec
    end
176913
def on(hosts, options={}, &block)
      subset_copy = Marshal.dump(Configuration.env.filter(hosts))
      SSHKit::Coordinator.new(Marshal.load(subset_copy)).each(options, &block)
    end
714310
def execute_with(host_list, options = {}, &block)
      host_list.each { |host| @connections[host] ||= LazyConnection.new(host, @net_ssh_options) }
      args = options[:args] || []
      num_threads = options[:num_threads] || DEFAULT_THREAD_POOL_SIZE
      if options[:serial]
        host_list.each { |host| @connections[host].self_eval args, &block }
      elsif options[:batch_by]
        num_threads = options[:batch_by] if num_threads == :unlimited
        host_list.each_slice(options[:batch_by]) do |batch|
          Weave.with_thread_pool(batch, num_threads) do |host, mutex|
            @connections[host].self_eval args, mutex, &block
          end
        end
      else
        num_threads = host_list.size if num_threads == :unlimited
        Weave.with_thread_pool(host_list, num_threads) do |host, mutex|
          @connections[host].self_eval args, mutex, &block
        end
      end
    end
814430
@Override
	public List<String> listCommands( String app ) {

		this.logger.fine("Request: list all the commands in the " + app + " application.");
		List<String> result;
		Application application = this.manager.applicationMngr().findApplicationByName( app );
		if( application == null )
			result = new ArrayList<>( 0 );
		else
			result = this.manager.commandsMngr().listCommands( application );

		return result;
	}
339365
function CommandLine(commands) {
  this.keys = Object.keys(commands);
  this.commands = commands;
  this.args = process.argv.slice(2);
  this.context = this.args[0] || null;
  this.help = {
    before: '',
    after: ''
  }
}
1076061
def host
      @env[Merb::Const::HTTP_X_FORWARDED_HOST] || @env[Merb::Const::HTTP_HOST] ||
        @env[Merb::Const::SERVER_NAME]
    end
1029460
def commands
      validate_arguments!

      ruby_cmd = Heroku::Command.commands.inject({}) {|h, (cmd, command)| h[cmd] = command_to_hash('ruby', cmd, command) ; h}
      commands = Heroku::JSPlugin.commands_info['commands']
      node_cmd = command_list_to_hash(commands.select {|command| command['plugin'] != ''}, 'node')
      go_cmd   = command_list_to_hash(commands.select {|command| command['plugin'] == ''}, 'go')

      all_cmd = {}
      all_cmd.merge!(ruby_cmd)
      all_cmd.merge!(node_cmd)
      all_cmd.merge!(go_cmd)

      sorted_cmd = all_cmd.sort { |a,b| a[0] <=> b[0] }.map{|cmd| cmd[1]}

      attrs  = [:command, :type, :plugin]
      header = attrs.map{|attr| attr.to_s.capitalize}

      count_attrs  = [:type, :count]
      count_header = count_attrs.map{|attr| attr.to_s.capitalize}

      counts = all_cmd.inject(Hash.new(0)) {|h, (_, cmd)| h[cmd[:type]] += 1; h}
      type_and_percentage = counts.keys.sort.map{|type| {:type => type, :count => counts[type]}}

      if options[:csv]
        csv_str = CSV.generate do |csv|
          csv << header
          sorted_cmd.each {|cmd| csv << attrs.map{|attr| cmd[attr]}}

          csv << []
          csv << count_header
          type_and_percentage.each {|type| csv << count_attrs.map{|attr| type[attr]}}
        end
        display(csv_str)
      else
        display_table(sorted_cmd, attrs, header)
        display("")
        display_table(type_and_percentage, count_attrs, count_header)
      end
    end
383373
def RunPlaybookOnHosts(playbook_path, hosts, private_key, extra_vars=None):
  
  inventory = ansible_inventory.Inventory(hosts)
  if not inventory.list_hosts():
    raise RuntimeError("Host list is empty.")
  stats = callbacks.AggregateStats()
  verbose = 0
  playbook_cb = ansible.callbacks.PlaybookCallbacks(verbose=verbose)
  runner_cb = ansible.callbacks.PlaybookRunnerCallbacks(stats, verbose=verbose)
  pb = playbook.PlayBook(playbook=playbook_path,
                                  host_list=hosts,
                                  remote_user='ubuntu',
                                  private_key_file=None,
                                  private_key=private_key,
                                  stats=stats,
                                  callbacks=playbook_cb,
                                  runner_callbacks=runner_cb,
                                  extra_vars=extra_vars)
  results = pb.run()
  # Check if all hosts completed playbook without error
  success = True
  if 'dark' in results:
    if len(results['dark']) > 0:
      print "Contact failures:"
      for host, reason in results['dark'].iteritems():
        print "  %s (%s)" % (host, reason['msg'])
      success = False
  for host, status in results.iteritems():
      if host == 'dark':
        continue
      failures = status['failures']
      if failures:
        logging.info( '%s %s' % (host, status))
        success = False
  return success
1149868
function cmd(handlers)
{
  this.fieldindex = 0;
  this.state = "start";
  this.stmt = ""
  this.params = []

  // mixin all handlers
  for (var h in handlers)
  {
    this[h] = handlers[h];
  }
  // save command name to display in debug output
  this.command_name = cmd.caller.command_name;
  this.args = Array.prototype.slice.call(cmd.caller.arguments);
}
21304
public void logLocalCommands(final List<Command> commands) {
        if (singleValue == null) {
            return;
        }
        for (final Command command : commands) {
            if (command instanceof SetPropertyValue) {
                singleValue.logLocalCommand((SetPropertyValue) command);
            } else if (command instanceof ListCommand) {
                lists.logLocalCommand((ListCommand) command);
            }
        }
    }
313530
def command(state, host, hostname, command, ssh_user=None):
    '''
    
    '''

    connection_target = hostname
    if ssh_user:
        connection_target = '@'.join((ssh_user, hostname))

    yield 'ssh {0} "{1}"'.format(connection_target, command)
380295
public synchronized void insert_cmd(String cmd,String host)
	{

//
// Insert elt in the box
//

		box[insert_elt].req_type = Req_Operation;
		box[insert_elt].attr_type = Attr_Unknown;
		box[insert_elt].op_type = Op_Command_inout;
		box[insert_elt].cmd_name = cmd;
		box[insert_elt].host = host;
		box[insert_elt].when = new Date();
	
//
// manage insert and read indexes
//

		inc_indexes();
	}
423904
def RunCommandOnHosts(cmd, hostnames, ssh_key):
  
  if not hostnames:
    return
  p = multiprocessing.Pool(1)
  remote_command_args = [(cmd, hostname, ssh_key) for hostname in hostnames]
  #print remote_command_args
  result = None
  while not result:
    try:    
      result = p.map_async(__RemoteExecuteHelper, remote_command_args).get(999999) # allows for keyboard interrupt
    except paramiko.SSHException as e:      
      logging.info( 'failure in RunCommandOnHosts: %s' % (e))
      time.sleep(5)
    
  p.close()
  p.join()
  return result
1327954
def cmd(commands, opts={})
      results = {}
      threads = clouds.collect do |name, c|
        Thread.new{ results[ name ] = c.cmd(commands, opts) }
      end
      threads.each{ |aThread| aThread.join }
      results
    end
42638
def cmd(name, *params)
      @mutex.synchronize do
        connect unless connected?
        @conn.write "#{name} #{params.join(' ').gsub('\\', '\\\\\\')}\n"
        status, length = conn_gets.split # <status> <content_length>\n
        content = conn_read(length.to_i + 1) # +1 = \n
        content.chomp!
        raise CommandFailed, "Command #{name} returned with status #{status}: #{content}" if status.to_i != 200
        content
      end
    end