Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Connect to the legcy system
- Net::SSH.start( legacyIp, legacyUsername,
- :password => legacyPassword,
- :port => legacyPort
- ) do |session|
- # Show we're connected
- puts "....Connected!\n"
- session.open_channel do |channel|
- legacyHostname = (session.exec! findHostNameCmd).delete("\n")
- currentTimestamp = Time.now.strftime("%d%m%Y%H%M%S")
- puts session.exec! findHostNameCmd
- blueprintName = legacyHostname + "-" + currentTimestamp
- # puts "" + legacyHostname + "-" + currentTimestamp
- blueprintCmd = createBlueprintCmd + " " + blueprintName
- print blueprintCmd + "\n"
- channel.exec(blueprintCmd) do |ch, success|
- abort "could not execute command" unless success
- channel.on_data do |ch, data|
- puts "got stdout: #{data}"
- channel.send_data "something for stdin\n"
- end
- channel.on_extended_data do |ch, type, data|
- puts "got stderr: #{data}"
- end
- channel.on_close do |ch|
- puts "channel is closing!"
- end
- end
- # print "Create blueprint repo" + "\n"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement