Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Commit

Permalink
Add job flow role to configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jshafton committed Nov 20, 2014
1 parent 4a44034 commit 9cbc878
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/elasticity/job_flow.rb
Expand Up @@ -22,6 +22,7 @@ class JobFlow
attr_accessor :region
attr_accessor :visible_to_all_users
attr_accessor :enable_debugging
attr_accessor :job_flow_role

attr_reader :access_key
attr_reader :secret_key
Expand Down Expand Up @@ -185,6 +186,7 @@ def jobflow_config
steps.insert(0, Elasticity::SetupHadoopDebuggingStep.new.to_aws_step(self)) if @enable_debugging
config[:steps] = steps
config[:log_uri] = @log_uri if @log_uri
config[:job_flow_role] = @job_flow_role if @job_flow_role
config[:bootstrap_actions] = @bootstrap_actions.map{|a| a.to_aws_bootstrap_action} unless @bootstrap_actions.empty?
config
end
Expand Down Expand Up @@ -229,4 +231,4 @@ def jobflow_instance_groups

end

end
end
28 changes: 27 additions & 1 deletion spec/lib/elasticity/job_flow_spec.rb
Expand Up @@ -344,6 +344,32 @@

end

describe 'job flow role' do

context 'when a job flow role is specified' do
let(:jobflow_with_job_flow_role) do
Elasticity::JobFlow.new('_', '_').tap do |jf|
jf.job_flow_role = 'JOB_FLOW_ROLE'
end
end
it 'should incorporate it into the jobflow config' do
jobflow_with_job_flow_role.send(:jobflow_config).should be_a_hash_including({:job_flow_role => 'JOB_FLOW_ROLE'})
end
end

context 'when a log URI is not specified' do
let(:jobflow_with_no_job_flow_role) do
Elasticity::JobFlow.new('_', '_').tap do |jf|
jf.job_flow_role = nil
end
end
it 'should not make space for it in the jobflow config' do
jobflow_with_no_job_flow_role.send(:jobflow_config).should_not have_key(:job_flow_role)
end
end

end

describe 'bootstrap actions' do

context 'when bootstrap actions are specified' do
Expand Down Expand Up @@ -686,4 +712,4 @@

end

end
end

0 comments on commit 9cbc878

Please sign in to comment.