Method: Pantry::CLI#request

Defined in:
lib/pantry/cli.rb

#request(filter, command, options) ⇒ Object

Fire off the requested Command.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/pantry/cli.rb', line 85

def request(filter, command, options)
  @command = command
  @command.client = self

  # We don't use send_request here because we don't want to deal with the
  # wait-list future system. This lets command objects handle responses
  # as they come back to the CLI as the command sees fit.
  # If the command isn't meant directly for the Server, the Server will always
  # respond first with the list of clients who will be executing the command
  # and responding with the results. See Pantry::Commands::Echo for an example of how
  # to work with this flow.
  begin
    message = @command.prepare_message(options)
    message.to = filter.stream
    message.requires_response!

    send_message(message)

    @command.wait_for_finish

    copy_full_keys_back_to_curve_key_file
  rescue Exception => ex
    Pantry.ui.say("Error: #{ex.message}")
    Pantry.logger.debug(ex.backtrace.join("\n"))
  end
end