smart_proxy_remote_execution_ssh 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85a2ca1f26e8131d2f97bf6dd977b6270fe91c03
4
- data.tar.gz: 1d60a395021b6b5262faa9b8115a2e6a6cb34a6b
3
+ metadata.gz: 638dd025cee7176c1140d55daad36647756d2c86
4
+ data.tar.gz: a3bf4cd13dfaa4011f187fd2c14b2581aef6c317
5
5
  SHA512:
6
- metadata.gz: 8e029bc607624b5be779d11dd67ca7447d1de32f9a868250d5a1352d775e29ffe1633635ff152b445c6a039f69be4d1cd2fc6f4124acb30a7c4423d6d6da1d87
7
- data.tar.gz: d240755257e994a5fb412d71dd3663f37490de1367f1470462566483c8992959e52e812defdd79639dd70da3d7301bc7d747461f5ff0a2a1bb9325180811d30b
6
+ metadata.gz: cb4cc423186ca8dcd71cee29466be2c635219ac26eee9d36e6614471cc3c5f2eb33f6cd66f807db1d3d29e14517e5cd07632539d3f3fd98d70ae3d6db60aed94
7
+ data.tar.gz: 793edc8274aba67e83e4575fbb0cf1e724e8c79c7d16820e7ce338a7166993e5a3487f0537eb090987534fe74b02810815fef8d8ab466a08d6b957424a9e309a
@@ -32,6 +32,7 @@ module Proxy::RemoteExecution::Ssh
32
32
 
33
33
  def initialize(data, timestamp = Time.now)
34
34
  @data = data
35
+ @data = @data.force_encoding('UTF-8') if @data.is_a? String
35
36
  @timestamp = timestamp
36
37
  end
37
38
 
@@ -22,9 +22,9 @@ module Proxy::RemoteExecution::Ssh
22
22
  def async_run(command)
23
23
  started = false
24
24
  session.open_channel do |channel|
25
- channel.on_data { |ch, data| yield CommandUpdate::StdoutData.new(handle_encoding(data)) }
25
+ channel.on_data { |ch, data| yield CommandUpdate::StdoutData.new(data) }
26
26
 
27
- channel.on_extended_data { |ch, type, data| yield CommandUpdate::StderrData.new(handle_encoding(data)) }
27
+ channel.on_extended_data { |ch, type, data| yield CommandUpdate::StderrData.new(data) }
28
28
 
29
29
  # standard exit of the command
30
30
  channel.on_request("exit-status") { |ch, data| yield CommandUpdate::StatusData.new(data.read_long) }
@@ -120,14 +120,6 @@ module Proxy::RemoteExecution::Ssh
120
120
 
121
121
  private
122
122
 
123
- def handle_encoding(data)
124
- if data.is_a? String
125
- data.force_encoding('UTF-8')
126
- else
127
- data
128
- end
129
- end
130
-
131
123
  def session
132
124
  @session ||= begin
133
125
  @logger.debug("opening session to #{@user}@#{@host}")
@@ -35,8 +35,8 @@ module Proxy::RemoteExecution::Ssh
35
35
  @session_args = { :logger => @logger,
36
36
  :clock => @clock,
37
37
  :connector_class => options[:connector_class] || Connector,
38
- :local_working_dir => options[:local_working_dir] || '/tmp/foreman-proxy-ssh/server',
39
- :remote_working_dir => options[:remote_working_dir] || '/tmp/foreman-proxy-ssh/client',
38
+ :local_working_dir => options[:local_working_dir] || ::Proxy::RemoteExecution::Ssh::Plugin.settings.local_working_dir,
39
+ :remote_working_dir => options[:remote_working_dir] || ::Proxy::RemoteExecution::Ssh::Plugin.settings.remote_working_dir,
40
40
  :client_private_key_file => Proxy::RemoteExecution::Ssh.private_key_file,
41
41
  :refresh_interval => options[:refresh_interval] || 1 }
42
42
 
@@ -5,7 +5,10 @@ module Proxy::RemoteExecution::Ssh
5
5
 
6
6
  settings_file "remote_execution_ssh.yml"
7
7
  default_settings :ssh_identity_key_file => '~/.ssh/id_rsa_foreman_proxy',
8
- :ssh_user => 'root'
8
+ :ssh_user => 'root',
9
+ :remote_working_dir => '/var/tmp',
10
+ :local_working_dir => '/var/tmp'
11
+
9
12
  plugin :ssh, Proxy::RemoteExecution::Ssh::VERSION
10
13
  end
11
14
  end
@@ -9,8 +9,8 @@ module Proxy::RemoteExecution::Ssh
9
9
  @clock = options[:clock] || Dynflow::Clock.spawn('proxy-dispatcher-clock')
10
10
  @logger = options[:logger] || Logger.new($stderr)
11
11
  @connector_class = options[:connector_class] || Connector
12
- @local_working_dir = options[:local_working_dir] || '/tmp/foreman-proxy-ssh/server'
13
- @remote_working_dir = options[:remote_working_dir] || '/tmp/foreman-proxy-ssh/client'
12
+ @local_working_dir = options[:local_working_dir] || ::Proxy::RemoteExecution::Ssh::Plugin.settings.local_working_dir
13
+ @remote_working_dir = options[:remote_working_dir] || ::Proxy::RemoteExecution::Ssh::Plugin.settings.remote_working_dir
14
14
  @refresh_interval = options[:refresh_interval] || 1
15
15
  @client_private_key_file = Proxy::RemoteExecution::Ssh.private_key_file
16
16
  @command = options[:command]
@@ -113,7 +113,7 @@ module Proxy::RemoteExecution::Ssh
113
113
  end
114
114
 
115
115
  def local_command_dir
116
- File.join(@local_working_dir, @command.id)
116
+ File.join(@local_working_dir, 'foreman-proxy', "foreman-ssh-cmd-#{@command.id}")
117
117
  end
118
118
 
119
119
  def local_command_file(filename)
@@ -121,7 +121,7 @@ module Proxy::RemoteExecution::Ssh
121
121
  end
122
122
 
123
123
  def remote_command_dir
124
- File.join(@remote_working_dir, @command.id)
124
+ File.join(@remote_working_dir, "foreman-ssh-cmd-#{@command.id}")
125
125
  end
126
126
 
127
127
  def remote_command_file(filename)
@@ -1,7 +1,7 @@
1
1
  module Proxy
2
2
  module RemoteExecution
3
3
  module Ssh
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,5 @@
1
1
  ---
2
2
  :enabled: true
3
3
  :ssh_identity_key_file: '~/.ssh/id_rsa_foreman_proxy'
4
+ :local_working_dir: '/var/tmp'
5
+ :remote_working_dir: '/var/tmp'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_remote_execution_ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-10 00:00:00.000000000 Z
11
+ date: 2015-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler