fog 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/Gemfile +2 -2
  2. data/Gemfile.lock +5 -5
  3. data/README.rdoc +29 -29
  4. data/fog.gemspec +24 -2
  5. data/lib/fog.rb +4 -15
  6. data/lib/fog/aws.rb +2 -2
  7. data/lib/fog/aws/ec2.rb +64 -101
  8. data/lib/fog/aws/elb.rb +19 -27
  9. data/lib/fog/aws/models/ec2/addresses.rb +1 -9
  10. data/lib/fog/aws/models/ec2/flavors.rb +1 -7
  11. data/lib/fog/aws/models/ec2/images.rb +1 -7
  12. data/lib/fog/aws/models/ec2/key_pairs.rb +1 -7
  13. data/lib/fog/aws/models/ec2/security_groups.rb +1 -7
  14. data/lib/fog/aws/models/ec2/servers.rb +1 -7
  15. data/lib/fog/aws/models/ec2/snapshots.rb +1 -9
  16. data/lib/fog/aws/models/ec2/volumes.rb +1 -9
  17. data/lib/fog/aws/models/s3/directories.rb +1 -7
  18. data/lib/fog/aws/models/s3/file.rb +5 -0
  19. data/lib/fog/aws/requests/ec2/allocate_address.rb +2 -0
  20. data/lib/fog/aws/requests/ec2/attach_volume.rb +2 -0
  21. data/lib/fog/aws/requests/ec2/create_key_pair.rb +2 -0
  22. data/lib/fog/aws/requests/ec2/create_snapshot.rb +2 -0
  23. data/lib/fog/aws/requests/ec2/create_volume.rb +2 -0
  24. data/lib/fog/aws/requests/ec2/describe_addresses.rb +2 -0
  25. data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +2 -0
  26. data/lib/fog/aws/requests/ec2/describe_images.rb +2 -0
  27. data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -0
  28. data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +2 -0
  29. data/lib/fog/aws/requests/ec2/describe_regions.rb +2 -0
  30. data/lib/fog/aws/requests/ec2/describe_reserved_instances.rb +2 -0
  31. data/lib/fog/aws/requests/ec2/describe_security_groups.rb +2 -0
  32. data/lib/fog/aws/requests/ec2/describe_snapshots.rb +2 -0
  33. data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -0
  34. data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -0
  35. data/lib/fog/aws/requests/ec2/get_console_output.rb +2 -0
  36. data/lib/fog/aws/requests/ec2/run_instances.rb +2 -0
  37. data/lib/fog/aws/requests/ec2/terminate_instances.rb +2 -0
  38. data/lib/fog/aws/requests/elb/create_load_balancer.rb +2 -0
  39. data/lib/fog/aws/requests/elb/delete_load_balancer.rb +2 -0
  40. data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +2 -0
  41. data/lib/fog/aws/requests/elb/describe_instance_health.rb +2 -0
  42. data/lib/fog/aws/requests/elb/describe_load_balancers.rb +2 -0
  43. data/lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb +2 -0
  44. data/lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb +2 -0
  45. data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +2 -0
  46. data/lib/fog/aws/requests/s3/copy_object.rb +2 -0
  47. data/lib/fog/aws/requests/s3/get_bucket.rb +2 -0
  48. data/lib/fog/aws/requests/s3/get_bucket_acl.rb +2 -0
  49. data/lib/fog/aws/requests/s3/get_bucket_location.rb +2 -0
  50. data/lib/fog/aws/requests/s3/get_bucket_logging.rb +2 -0
  51. data/lib/fog/aws/requests/s3/get_bucket_object_versions.rb +2 -0
  52. data/lib/fog/aws/requests/s3/get_bucket_versioning.rb +2 -0
  53. data/lib/fog/aws/requests/s3/get_object_acl.rb +2 -0
  54. data/lib/fog/aws/requests/s3/get_request_payment.rb +2 -0
  55. data/lib/fog/aws/requests/s3/get_service.rb +2 -0
  56. data/lib/fog/aws/requests/s3/put_object.rb +2 -2
  57. data/lib/fog/aws/requests/simpledb/domain_metadata.rb +2 -0
  58. data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -0
  59. data/lib/fog/aws/requests/simpledb/list_domains.rb +2 -0
  60. data/lib/fog/aws/requests/simpledb/select.rb +2 -0
  61. data/lib/fog/aws/s3.rb +68 -85
  62. data/lib/fog/aws/simpledb.rb +15 -29
  63. data/lib/fog/bluebox.rb +23 -40
  64. data/lib/fog/bluebox/models/flavors.rb +1 -7
  65. data/lib/fog/bluebox/models/images.rb +1 -9
  66. data/lib/fog/bluebox/models/servers.rb +1 -7
  67. data/lib/fog/credentials.rb +2 -0
  68. data/lib/fog/errors.rb +20 -0
  69. data/lib/fog/hmac.rb +48 -0
  70. data/lib/fog/local.rb +9 -22
  71. data/lib/fog/local/models/directories.rb +1 -7
  72. data/lib/fog/rackspace.rb +2 -6
  73. data/lib/fog/rackspace/files.rb +46 -48
  74. data/lib/fog/rackspace/models/files/directories.rb +1 -7
  75. data/lib/fog/rackspace/models/servers/flavors.rb +1 -7
  76. data/lib/fog/rackspace/models/servers/images.rb +1 -9
  77. data/lib/fog/rackspace/models/servers/server.rb +37 -1
  78. data/lib/fog/rackspace/models/servers/servers.rb +8 -7
  79. data/lib/fog/rackspace/requests/files/put_object.rb +1 -1
  80. data/lib/fog/rackspace/servers.rb +33 -45
  81. data/lib/fog/service.rb +82 -0
  82. data/lib/fog/slicehost.rb +28 -42
  83. data/lib/fog/slicehost/models/flavors.rb +1 -7
  84. data/lib/fog/slicehost/models/images.rb +1 -9
  85. data/lib/fog/slicehost/models/servers.rb +1 -7
  86. data/lib/fog/ssh.rb +1 -1
  87. data/lib/fog/vcloud.rb +20 -3
  88. data/lib/fog/vcloud/collection.rb +25 -5
  89. data/lib/fog/vcloud/model.rb +4 -0
  90. data/lib/fog/vcloud/parsers/get_organization.rb +2 -2
  91. data/lib/fog/vcloud/parsers/get_vdc.rb +2 -2
  92. data/lib/fog/vcloud/parsers/get_versions.rb +1 -1
  93. data/lib/fog/vcloud/parsers/login.rb +2 -2
  94. data/lib/fog/vcloud/parsers/network.rb +53 -0
  95. data/lib/fog/vcloud/requests/get_network.rb +54 -0
  96. data/lib/fog/vcloud/requests/get_organization.rb +1 -2
  97. data/lib/fog/vcloud/terremark/ecloud.rb +17 -4
  98. data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +35 -0
  99. data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +9 -9
  100. data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +18 -0
  101. data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +36 -0
  102. data/lib/fog/vcloud/terremark/ecloud/models/network.rb +32 -0
  103. data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +38 -0
  104. data/lib/fog/vcloud/terremark/ecloud/models/public_ip.rb +3 -1
  105. data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +1 -1
  106. data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +9 -0
  107. data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +2 -0
  108. data/lib/fog/vcloud/terremark/ecloud/parsers/network.rb +28 -0
  109. data/lib/fog/vcloud/terremark/ecloud/parsers/network_ips.rb +31 -0
  110. data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +10 -7
  111. data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +99 -0
  112. data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +54 -0
  113. data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +51 -0
  114. data/spec/aws/models/s3/file_spec.rb +15 -0
  115. data/spec/vcloud/requests/get_network_spec.rb +55 -0
  116. data/spec/vcloud/spec_helper.rb +1 -0
  117. data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +15 -0
  118. data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +35 -0
  119. data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +28 -0
  120. data/spec/vcloud/terremark/ecloud/models/network_spec.rb +65 -0
  121. data/spec/vcloud/terremark/ecloud/models/networks_spec.rb +26 -0
  122. data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +0 -2
  123. data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +44 -0
  124. data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +54 -0
  125. data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +63 -0
  126. data/tests/aws/requests/ec2/volume_tests.rb +2 -2
  127. data/tests/helper.rb +2 -0
  128. metadata +25 -3
@@ -9,7 +9,6 @@ module Fog
9
9
  identity :id
10
10
 
11
11
  attribute :addresses
12
- attribute :password, 'adminPass'
13
12
  attribute :flavor_id, 'flavorId'
14
13
  attribute :host_id, 'hostId'
15
14
  attribute :image_id, 'imageId'
@@ -19,6 +18,8 @@ module Fog
19
18
  attribute :progress
20
19
  attribute :status
21
20
 
21
+ attr_accessor :password, :private_key_path, :public_key_path
22
+
22
23
  def destroy
23
24
  requires :id
24
25
  connection.delete_server(@id)
@@ -50,6 +51,14 @@ module Fog
50
51
  true
51
52
  end
52
53
 
54
+ def private_key_path
55
+ @private_key_path || Fog.credentials[:private_key_path]
56
+ end
57
+
58
+ def public_key_path
59
+ @public_key_path || Fog.credentials[:public_key_path]
60
+ end
61
+
53
62
  def save
54
63
  requires :flavor_id, :image_id
55
64
  options = {
@@ -63,8 +72,35 @@ module Fog
63
72
  true
64
73
  end
65
74
 
75
+ def ssh(commands)
76
+ requires :addresses, :identity, :private_key_path
77
+ @ssh ||= Fog::SSH.new(@addresses['public'].first, 'root', :keys => [private_key_path])
78
+ @ssh.run(commands)
79
+ end
80
+
81
+ def setup
82
+ requires :addresses, :identity, :password, :public_key_path
83
+ Fog::SSH.new(@addresses['public'].first, 'root', :password => password).run([
84
+ %{mkdir .ssh},
85
+ %{echo "#{File.read(File.expand_path(public_key_path))}" >> ~/.ssh/authorized_keys},
86
+ %{passwd -l root},
87
+ %{echo "#{attributes.to_json}" >> ~/attributes.json},
88
+ %{echo "#{metadata.to_json}" >> ~/metadata.json}
89
+ ])
90
+ rescue Errno::ECONNREFUSED
91
+ sleep(1)
92
+ retry
93
+ end
94
+
95
+ private
96
+
97
+ def adminPass=(new_admin_pass)
98
+ @password = new_admin_pass
99
+ end
100
+
66
101
  end
67
102
 
68
103
  end
69
104
  end
105
+
70
106
  end
@@ -5,13 +5,7 @@ module Fog
5
5
  module Rackspace
6
6
  module Servers
7
7
 
8
- class Mock
9
- def servers
10
- Fog::Rackspace::Servers::Servers.new(:connection => self)
11
- end
12
- end
13
-
14
- class Real
8
+ module Collections
15
9
  def servers
16
10
  Fog::Rackspace::Servers::Servers.new(:connection => self)
17
11
  end
@@ -26,6 +20,13 @@ module Fog
26
20
  load(data)
27
21
  end
28
22
 
23
+ def bootstrap(new_attributes = {})
24
+ server = create(new_attributes)
25
+ server.wait_for { ready? }
26
+ server.setup
27
+ server
28
+ end
29
+
29
30
  def get(server_id)
30
31
  if server = connection.get_server_details(server_id).body['server']
31
32
  new(server)
@@ -9,7 +9,7 @@ module Fog
9
9
  # * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
10
10
  #
11
11
  def put_object(container, object, data)
12
- data = Fog::Rackspace::Files.parse_data(data)
12
+ data = parse_data(data)
13
13
  response = storage_request(
14
14
  :body => data[:body],
15
15
  :expects => 201,
@@ -1,52 +1,40 @@
1
1
  module Fog
2
2
  module Rackspace
3
3
  module Servers
4
+ extend Fog::Service
4
5
 
5
- class Error < Fog::Errors::Error; end
6
- class NotFound < Fog::Errors::NotFound; end
6
+ requires :rackspace_api_key, :rackspace_username
7
7
 
8
- def self.new(options={})
8
+ model_path 'fog/rackspace/models/servers'
9
+ model 'flavor'
10
+ model 'flavors'
11
+ model 'image'
12
+ model 'images'
13
+ model 'server'
14
+ model 'servers'
9
15
 
10
- unless @required
11
- require 'fog/rackspace/models/servers/flavor'
12
- require 'fog/rackspace/models/servers/flavors'
13
- require 'fog/rackspace/models/servers/image'
14
- require 'fog/rackspace/models/servers/images'
15
- require 'fog/rackspace/models/servers/server'
16
- require 'fog/rackspace/models/servers/servers'
17
- require 'fog/rackspace/requests/servers/create_image'
18
- require 'fog/rackspace/requests/servers/create_server'
19
- require 'fog/rackspace/requests/servers/delete_image'
20
- require 'fog/rackspace/requests/servers/delete_server'
21
- require 'fog/rackspace/requests/servers/get_flavor_details'
22
- require 'fog/rackspace/requests/servers/get_image_details'
23
- require 'fog/rackspace/requests/servers/get_server_details'
24
- require 'fog/rackspace/requests/servers/list_addresses'
25
- require 'fog/rackspace/requests/servers/list_private_addresses'
26
- require 'fog/rackspace/requests/servers/list_public_addresses'
27
- require 'fog/rackspace/requests/servers/list_flavors'
28
- require 'fog/rackspace/requests/servers/list_flavors_detail'
29
- require 'fog/rackspace/requests/servers/list_images'
30
- require 'fog/rackspace/requests/servers/list_images_detail'
31
- require 'fog/rackspace/requests/servers/list_servers'
32
- require 'fog/rackspace/requests/servers/list_servers_detail'
33
- require 'fog/rackspace/requests/servers/reboot_server'
34
- require 'fog/rackspace/requests/servers/update_server'
35
- @required = true
36
- end
37
-
38
- if Fog.mocking?
39
- Fog::Rackspace::Servers::Mock.new(options)
40
- else
41
- Fog::Rackspace::Servers::Real.new(options)
42
- end
43
- end
44
-
45
- def self.reset_data(keys=Mock.data.keys)
46
- Mock.reset_data(keys)
47
- end
16
+ request_path 'fog/rackspace/requests/servers'
17
+ request 'create_image'
18
+ request 'create_server'
19
+ request 'delete_image'
20
+ request 'delete_server'
21
+ request 'get_flavor_details'
22
+ request 'get_image_details'
23
+ request 'get_server_details'
24
+ request 'list_addresses'
25
+ request 'list_private_addresses'
26
+ request 'list_public_addresses'
27
+ request 'list_flavors'
28
+ request 'list_flavors_detail'
29
+ request 'list_images'
30
+ request 'list_images_detail'
31
+ request 'list_servers'
32
+ request 'list_servers_detail'
33
+ request 'reboot_server'
34
+ request 'update_server'
48
35
 
49
36
  class Mock
37
+ include Collections
50
38
 
51
39
  def self.data
52
40
  @data ||= Hash.new do |hash, key|
@@ -75,6 +63,7 @@ module Fog
75
63
  end
76
64
 
77
65
  class Real
66
+ include Collections
78
67
 
79
68
  def initialize(options={})
80
69
  credentials = Fog::Rackspace.authenticate(options)
@@ -88,7 +77,6 @@ module Fog
88
77
 
89
78
  def request(params)
90
79
  @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
91
-
92
80
  begin
93
81
  response = @connection.request(params.merge!({
94
82
  :headers => {
@@ -99,11 +87,11 @@ module Fog
99
87
  :path => "#{@path}/#{params[:path]}"
100
88
  }))
101
89
  rescue Excon::Errors::Error => error
102
- case error
90
+ raise case error
103
91
  when Excon::Errors::NotFound
104
- raise Fog::Rackspace::Servers::NotFound
92
+ Fog::Rackspace::Servers::NotFound.slurp(error)
105
93
  else
106
- raise error
94
+ error
107
95
  end
108
96
  end
109
97
  unless response.body.empty?
@@ -0,0 +1,82 @@
1
+ module Fog
2
+ module Service
3
+
4
+ def self.extended(other)
5
+ super
6
+ other.module_eval <<-EOS, __FILE__, __LINE__
7
+ class Error < Fog::Errors::Error; end
8
+ class NotFound < Fog::Errors::NotFound; end
9
+
10
+ module Collections; end
11
+
12
+ def self.new(options={})
13
+ missing = []
14
+ for requirement in requirements
15
+ missing << requirement unless options[requirement]
16
+ end
17
+ unless missing.empty?
18
+ if missing.length == 1
19
+ raise(ArgumentError, [missing.first, "is required for this service"].join(' '))
20
+ else
21
+ raise(ArgumentError, [missing[0...-1].join(", "), 'and', missing[-1], 'are required for this service'].join(' '))
22
+ end
23
+ end
24
+
25
+ unless @required
26
+ for model in models
27
+ require [@model_path, model].join('/')
28
+ end
29
+ for request in requests
30
+ require [@request_path, request].join('/')
31
+ end
32
+ @required = true
33
+ end
34
+
35
+ if Fog.mocking?
36
+ Mock.new(options)
37
+ else
38
+ Real.new(options)
39
+ end
40
+ end
41
+ EOS
42
+ end
43
+
44
+ def model_path(new_path)
45
+ @model_path = new_path
46
+ end
47
+
48
+ def model(new_model)
49
+ models << new_model
50
+ end
51
+
52
+ def models
53
+ @models ||= []
54
+ end
55
+
56
+ def request_path(new_path)
57
+ @request_path = new_path
58
+ end
59
+
60
+ def request(new_request)
61
+ requests << new_request
62
+ end
63
+
64
+ def requests
65
+ @requests ||= []
66
+ end
67
+
68
+ def requires(*args)
69
+ requirements.concat(args)
70
+ end
71
+
72
+ def requirements
73
+ @requirements ||= []
74
+ end
75
+
76
+ def reset_data(keys=Mock.data.keys)
77
+ Mock.reset_data(keys)
78
+ end
79
+
80
+ end
81
+ end
82
+
@@ -1,46 +1,31 @@
1
1
  module Fog
2
2
  module Slicehost
3
-
4
- class Error < Fog::Errors::Error; end
5
- class NotFound < Fog::Errors::NotFound; end
6
-
7
- def self.new(options={})
8
-
9
- unless @required
10
- require 'fog/slicehost/models/flavor'
11
- require 'fog/slicehost/models/flavors'
12
- require 'fog/slicehost/models/image'
13
- require 'fog/slicehost/models/images'
14
- require 'fog/slicehost/models/server'
15
- require 'fog/slicehost/models/servers'
16
- require 'fog/slicehost/requests/create_slice'
17
- require 'fog/slicehost/requests/delete_slice'
18
- require 'fog/slicehost/requests/get_backups'
19
- require 'fog/slicehost/requests/get_flavor'
20
- require 'fog/slicehost/requests/get_flavors'
21
- require 'fog/slicehost/requests/get_image'
22
- require 'fog/slicehost/requests/get_images'
23
- require 'fog/slicehost/requests/get_slice'
24
- require 'fog/slicehost/requests/get_slices'
25
- require 'fog/slicehost/requests/reboot_slice'
26
- @required = true
27
- end
28
-
29
- unless options[:slicehost_password]
30
- raise ArgumentError.new('slicehost_password is required to access slicehost')
31
- end
32
- if Fog.mocking?
33
- Fog::Slicehost::Mock.new(options)
34
- else
35
- Fog::Slicehost::Real.new(options)
36
- end
37
- end
38
-
39
- def self.reset_data(keys=Mock.data.keys)
40
- Mock.reset_data(keys)
41
- end
3
+ extend Fog::Service
4
+
5
+ requires :slicehost_password
6
+
7
+ model_path 'fog/slicehost/models'
8
+ model 'flavor'
9
+ model 'flavors'
10
+ model 'image'
11
+ model 'images'
12
+ model 'server'
13
+ model 'servers'
14
+
15
+ request_path 'fog/slicehost/requests'
16
+ request 'create_slice'
17
+ request 'delete_slice'
18
+ request 'get_backups'
19
+ request 'get_flavor'
20
+ request 'get_flavors'
21
+ request 'get_image'
22
+ request 'get_images'
23
+ request 'get_slice'
24
+ request 'get_slices'
25
+ request 'reboot_slice'
42
26
 
43
27
  class Mock
28
+ include Collections
44
29
 
45
30
  def self.data
46
31
  @data ||= Hash.new do |hash, key|
@@ -62,6 +47,7 @@ module Fog
62
47
  end
63
48
 
64
49
  class Real
50
+ include Collections
65
51
 
66
52
  def initialize(options={})
67
53
  @slicehost_password = options[:slicehost_password]
@@ -86,11 +72,11 @@ module Fog
86
72
  begin
87
73
  response = @connection.request(params.merge!({:host => @host}))
88
74
  rescue Excon::Errors::Error => error
89
- case error
75
+ raise case error
90
76
  when Excon::Errors::NotFound
91
- raise Fog::Slicehost::NotFound
77
+ Fog::Slicehost::NotFound.slurp(error)
92
78
  else
93
- raise error
79
+ error
94
80
  end
95
81
  end
96
82
 
@@ -4,13 +4,7 @@ require 'fog/slicehost/models/flavor'
4
4
  module Fog
5
5
  module Slicehost
6
6
 
7
- class Mock
8
- def flavors
9
- Fog::Slicehost::Flavors.new(:connection => self)
10
- end
11
- end
12
-
13
- class Real
7
+ module Collections
14
8
  def flavors
15
9
  Fog::Slicehost::Flavors.new(:connection => self)
16
10
  end
@@ -4,15 +4,7 @@ require 'fog/slicehost/models/image'
4
4
  module Fog
5
5
  module Slicehost
6
6
 
7
- class Mock
8
- def images(attributes = {})
9
- Fog::Slicehost::Images.new({
10
- :connection => self
11
- }.merge!(attributes))
12
- end
13
- end
14
-
15
- class Real
7
+ module Collections
16
8
  def images(attributes = {})
17
9
  Fog::Slicehost::Images.new({
18
10
  :connection => self
@@ -4,13 +4,7 @@ require 'fog/slicehost/models/server'
4
4
  module Fog
5
5
  module Slicehost
6
6
 
7
- class Mock
8
- def servers
9
- Fog::Slicehost::Servers.new(:connection => self)
10
- end
11
- end
12
-
13
- class Real
7
+ module Collections
14
8
  def servers
15
9
  Fog::Slicehost::Servers.new(:connection => self)
16
10
  end
@@ -54,7 +54,7 @@ module Fog
54
54
  sudoable_command = command.sub(/^sudo/, %{sudo -p 'fog sudo password:'})
55
55
  escaped_command = sudoable_command.sub(/'/, %{'"'"'})
56
56
  channel.request_pty
57
- result = Result.new(command)
57
+ result = Result.new(escaped_command)
58
58
  channel.exec(%{bash -lc '#{escaped_command}'}) do |channel, success|
59
59
  unless success
60
60
  raise "Could not execute command: #{command.inspect}"