ambethia-backup 0.0.11 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ module Backup
25
25
  @channels.each do |ch|
26
26
  next if ch[:closed]
27
27
  active += 1
28
- ch.connection.process(true)
28
+ ch.connection.process(0)
29
29
  end
30
30
 
31
31
  break if active == 0
@@ -47,28 +47,24 @@ module Backup
47
47
 
48
48
  def open_channels
49
49
  channel = actor.session.open_channel do |channel|
50
- channel.request_pty( :want_reply => true )
51
- channel[:actor] = @actor
52
-
53
- channel.on_success do |ch|
54
- #logger.trace "executing command", ch[:host]
55
- ch.exec command
56
- ch.send_data options[:data] if options[:data]
50
+ channel.request_pty do |ch, success|
51
+ if success
52
+ ch.exec command
53
+ ch.send_data options[:data] if options[:data]
54
+ else
55
+ ch.close
56
+ end
57
57
  end
58
58
 
59
+ channel[:actor] = @actor
60
+
59
61
  channel.on_data do |ch, data|
60
62
  puts data
61
63
  @callback[ch, :out, data] if @callback
62
64
  end
63
65
 
64
- channel.on_failure do |ch|
65
- #logger.important "could not open channel", ch[:host]
66
- # puts "we got a faulure"
67
- ch.close
68
- end
69
-
70
- channel.on_request do |ch, request, reply, data|
71
- ch[:status] = data.read_long if request == "exit-status"
66
+ channel.on_request "exit-status" do |ch, data|
67
+ ch[:status] = data.read_long
72
68
  end
73
69
 
74
70
  channel.on_close do |ch|
@@ -1,4 +1,3 @@
1
- #!/usr/bin/ruby
2
1
  require File.dirname(__FILE__) + "/tests_helper"
3
2
 
4
3
  class ActorTest < Test::Unit::TestCase
@@ -1,4 +1,3 @@
1
- #!/usr/bin/ruby
2
1
  require File.dirname(__FILE__) + "/tests_helper"
3
2
  require 'runt'
4
3
  require 'date'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ambethia-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Murray
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-28 00:00:00 -07:00
12
+ date: 2009-07-29 00:00:00 -07:00
13
13
  default_executable: backup
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency