Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ AllCops:
Exclude:
- vendor/**/*

Documentation:
Metrics/LineLength:
Enabled: false
FileName:
Style/Documentation:
Enabled: false
SignalException:
Style/ExtraSpacing:
Enabled: false
Encoding:
Style/FileName:
Enabled: false
HashSyntax:
Style/HashSyntax:
Enabled: false
LineLength:
Enabled: false
ExtraSpacing:
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
Style/SignalException:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ group :test do
gem 'chefspec', '~> 4.2'
gem 'rspec', '~> 3.2'
gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.27.1'
gem 'rubocop', '~> 0.42.0'
end

group :integration do
Expand Down
13 changes: 10 additions & 3 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
license 'Apache License 2.0'
description 'A cookbook to install and configure Apache Spark'
version '1.2.14'
source_url 'https://github.com/clearstorydata-cookbooks/apache_spark'
issues_url 'https://github.com/clearstorydata-cookbooks/apache_spark/issues'

%w( debian ubuntu centos redhat fedora ).each do |os|
source_url 'https://github.com/clearstorydata-cookbooks/apache_spark' if respond_to?(:source_url)
issues_url 'https://github.com/clearstorydata-cookbooks/apache_spark/issues' if respond_to?(:issues_url)

%w(
centos
debian
fedora
redhat
ubuntu
).each do |os|
supports os
end

Expand Down
3 changes: 1 addition & 2 deletions recipes/spark-install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@
tarball_basename = ::File.basename(URI.parse(node['apache_spark']['download_url']).path)
downloaded_tarball_path = ::File.join(Chef::Config[:file_cache_path], tarball_basename)
tarball_url = node['apache_spark']['download_url']
Chef::Log.warn("#{tarball_url} will be downloaded to #{downloaded_tarball_path}")

remote_file downloaded_tarball_path do
source tarball_url
checksum node['apache_spark']['checksum']
end

extracted_dir_name = tarball_basename.sub(/[.](tar[.]gz|tgz)$/, '')

Chef::Log.warn("#{downloaded_tarball_path} will be extracted in #{install_base_dir}")
actual_install_dir = ::File.join(install_base_dir, extracted_dir_name)
tar_extract downloaded_tarball_path do
action :extract_local
Expand Down
10 changes: 5 additions & 5 deletions recipes/spark-standalone-worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
spark_user = node['apache_spark']['user']
spark_group = node['apache_spark']['group']

if node['apache_spark']['standalone']['master_url'].nil?
spark_master_url = "spark://#{node['apache_spark']['standalone']['master_host']}:#{node['apache_spark']['standalone']['master_port']}"
else
spark_master_url = node['apache_spark']['standalone']['master_url']
end
spark_master_url = if node['apache_spark']['standalone']['master_url'].nil?
"spark://#{node['apache_spark']['standalone']['master_host']}:#{node['apache_spark']['standalone']['master_port']}"
else
node['apache_spark']['standalone']['master_url']
end

template worker_runner_script do
source 'spark_worker_runner.sh.erb'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@
'--class org.apache.spark.examples.SparkPi ' \
'--deploy-mode client ' \
'--master spark://localhost:7077 ' \
"#{spark_examples_jar} 100")
"#{spark_examples_jar} 100"
)
expected_msg = 'Pi is roughly 3.14'
assert(
spark_pi_result.stdout.include?(expected_msg),
"Expected stdout to say '#{expected_msg}'. " \
"Actual stdout:\n#{spark_pi_result.stdout}\n\nStderr:\n#{spark_pi_result.stderr}")
"Actual stdout:\n#{spark_pi_result.stdout}\n\nStderr:\n#{spark_pi_result.stderr}"
)
end
end