masamune 0.17.1 → 0.17.2

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: 6ddce086bb21f28d0fed13c985c5d4f85712e9a4
4
- data.tar.gz: 0f9458ce48db794367985117fe07a7eb9fa6c67f
3
+ metadata.gz: 539cdf75fd7e8734d5ad8393a80c1fe389ca1e52
4
+ data.tar.gz: fea5c3e3908578febd63ac0a1e959c30442b5e09
5
5
  SHA512:
6
- metadata.gz: 532d05598d8286dc976935cbd15ee0e943dd4127f4d0f60f85044fb983f7f9214fa9c6115ea9b715684dd2985ad1740b00d0669cf495311ec9d90e999b90448b
7
- data.tar.gz: 6541b858616931ed4b50aae951824e3ed0b40e4b49a4b7595540a2b407b3f9f50f7f2e99d10eebb21a6a3c2def11e43abe085e9952950d632406967467a4b01e
6
+ metadata.gz: 06705c4e419adb0b2ffb82d35b80e92cfca1148f97c638880277f06d6f52731354915a9a3e468fdeec4f0874a5da7c6213660e5bc0df70e8ed5a104b3885d361
7
+ data.tar.gz: b6c98cdbe32f2f83ce54835243da0c1f060f5dfca1500dd6366a99d3fb7b77e4f181b373dac32eb388d027840b796820e0979b71c03445f75d2520032a3d3966
@@ -38,6 +38,10 @@ module Masamune::Actions
38
38
  define_method(:command_args) do
39
39
  args
40
40
  end
41
+
42
+ define_method(:command_env) do
43
+ opts[:env] || {}
44
+ end
41
45
  end
42
46
 
43
47
  klass.class_eval do
@@ -77,7 +77,7 @@ module Masamune::Commands
77
77
  def ssh_command
78
78
  @ssh_command ||= begin
79
79
  result = nil
80
- execute(*ssh_args, fail_fast: true, safe: true) do |line|
80
+ execute(*ssh_args, env: command_env, fail_fast: true, safe: true) do |line|
81
81
  next if result
82
82
  if line =~ /exit\Z/
83
83
  result = line.sub(/ exit\Z/, '').split(' ')
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.17.1'
24
+ VERSION = '0.17.2'
25
25
  end
@@ -52,5 +52,12 @@ describe Masamune::Actions::Execute do
52
52
 
53
53
  it { expect { |b| instance.execute(*command, options, &b) }.to yield_with_args('pong', 0) }
54
54
  end
55
+
56
+ context 'with a simple command with env' do
57
+ let(:command) { %Q(bash -c "echo $MESSAGE") }
58
+ let(:options) { {env: { 'MESSAGE' => 'pong' }, fail_fast: true} }
59
+
60
+ it { expect { |b| instance.execute(*command, options, &b) }.to yield_with_args('pong', 0) }
61
+ end
55
62
  end
56
63
  end
@@ -49,10 +49,10 @@ describe Masamune::Commands::AwsEmr do
49
49
 
50
50
  context 'with --cluster-id j-XYZ' do
51
51
  let(:delegate) { double(command_args: ['hive', '-e', "'show tables;'"]) }
52
- let(:attrs) { { cluster_id: 'j-XYZ' } }
52
+ let(:attrs) { { config_file: '/etc/aws_config', cluster_id: 'j-XYZ' } }
53
53
 
54
54
  before do
55
- expect(instance).to receive(:execute).with('aws', 'emr', 'ssh', '--cluster-id', 'j-XYZ', '--command', 'exit', {fail_fast: true, safe: true}).
55
+ expect(instance).to receive(:execute).with('aws', 'emr', 'ssh', '--cluster-id', 'j-XYZ', '--command', 'exit', {env: {"AWS_CONFIG_FILE"=>"/etc/aws_config"}, fail_fast: true, safe: true}).
56
56
  and_yield('ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=10 -i /etc/ssh/aws.key hadoop@ec2-10.0.0.1.compute-1.amazonaws.com exit').
57
57
  and_yield("Warning: Permanently added 'ec2-10.0.0.1.compute-1.amazonaws.com,10.0.0.1' (ECDSA) to the list of known hosts.")
58
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masamune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Andrews