Class: AvstCloud::WaitUntilReady

Inherits:
SshTask show all
Defined in:
lib/avst-cloud/task.rb

Instance Method Summary collapse

Methods inherited from SshTask

#execute

Methods inherited from Task

#execute, #initialize

Methods included from Logging

included, logger, #logger, logger=, mask_message, show_passwords=

Constructor Details

This class inherits a constructor from AvstCloud::Task

Instance Method Details

#ssh_command(session) ⇒ Object



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/avst-cloud/task.rb', line 153

def ssh_command(session)
    session.open_channel do |channel|
        channel.request_pty do |ch, success|
            raise 'Error requesting pty' unless success

            ch.send_channel_request("shell") do |ch, success|
                raise 'Error opening shell' unless success
            end
        end
        channel.on_data do |ch, data|
            if @debug
                STDOUT.print data
            end
        end
        channel.on_extended_data do |ch, type, data|
            STDOUT.print "Error: #{data}\n"
        end
        channel.send_data("echo \"ready\"\n")
        channel.send_data("exit\n")
        session.loop
    end
end