Skip to content

Commit

Permalink
Remove support for Kafka v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mthssdrbrg committed Mar 20, 2016
1 parent 6da904a commit 1436515
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 77 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/mthssdrbrg/kafka-cookbook.svg?branch=master)](https://travis-ci.org/mthssdrbrg/kafka-cookbook)
[![GitHub Release](https://img.shields.io/github/release/mthssdrbrg/kafka-cookbook.svg)]()

Installs and configures Kafka `>= v0.8.0`.
Installs and configures Kafka `>= v0.8.1`.

Based on the Kafka cookbook released by WebTrends (thanks!), but with a few
notable differences:
Expand Down
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class KitchenTask
'KAFKA_VERSION' => version,
'CHEF_VERSION' => ENV['CHEF_VERSION'],
}
@env['SCALA_VERSION'] = '2.8.0' if version == '0.8.0'
end

def run
Expand Down Expand Up @@ -112,7 +111,7 @@ class VagrantTask < KitchenTask
end

namespace :test do
default_versions = %w[0.8.0 0.8.1.1 0.8.2.2 0.9.0.1]
default_versions = %w[0.8.1.1 0.8.2.2 0.9.0.1]

def run_tests_for(versions, task_class)
puts '>>> Running tests for versions: %s' % [versions.join(', ')]
Expand Down
20 changes: 2 additions & 18 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def kafka_base
end

def kafka_tar_gz
[kafka_base, kafka_archive_ext].join('.')
[kafka_base, 'tgz'].join('.')
end

def kafka_local_download_path
Expand All @@ -20,11 +20,7 @@ def kafka_target_path
end

def kafka_jar_path
if kafka_v0_8_0?
::File.join(node.kafka.install_dir, %(#{kafka_base}.jar))
else
::File.join(node.kafka.install_dir, 'libs', %(#{kafka_base}.jar))
end
::File.join(node.kafka.install_dir, 'libs', %(#{kafka_base}.jar))
end

def kafka_installed?
Expand All @@ -35,18 +31,6 @@ def kafka_download_uri(filename)
[node.kafka.base_url, node.kafka.version, filename].join('/')
end

def kafka_archive_ext
if kafka_v0_8_0?
'tar.gz'
else
'tgz'
end
end

def kafka_v0_8_0?
node.kafka.version == '0.8.0'
end

def kafka_init_style
node.kafka.init_style.to_sym
end
Expand Down
1 change: 0 additions & 1 deletion recipes/_coordinate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
supports start: true, stop: true, restart: true, status: true
action kafka_service_actions
end

4 changes: 0 additions & 4 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Recipe:: default
#

if node.kafka.version == '0.8.0'
Chef::Log.warn('Support for Kafka v0.8.0 is deprecated and will be removed in the next major version')
end

include_recipe 'kafka::_defaults'
include_recipe 'kafka::_setup'
include_recipe 'kafka::_install'
Expand Down
51 changes: 0 additions & 51 deletions spec/recipes/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,55 +37,4 @@
link = chef_run.link('/opt/kafka')
expect(link).to link_to('/opt/kafka-0.8.1.1')
end

context 'archive extension for different versions' do
let :chef_run do
ChefSpec::Runner.new do |node|
node.set[:kafka][:version] = kafka_version
node.set[:kafka][:install_method] = :binary
end.converge(*described_recipes)
end

context 'when version is 0.8.0' do
let :kafka_version do
'0.8.0'
end

it 'uses .tar.gz' do
expect(chef_run).to create_kafka_download(%(#{Chef::Config.file_cache_path}/kafka_2.9.2-0.8.0.tar.gz))
end

it 'installs kafka' do
expect(chef_run).to run_kafka_install('/opt/kafka-0.8.0')
end
end

context 'when version is 0.8.1' do
let :kafka_version do
'0.8.1'
end

it 'uses .tgz' do
expect(chef_run).to create_kafka_download(%(#{Chef::Config.file_cache_path}/kafka_2.9.2-0.8.1.tgz))
end

it 'installs kafka' do
expect(chef_run).to run_kafka_install('/opt/kafka-0.8.1')
end
end

context 'when version is 0.8.1.1' do
let :kafka_version do
'0.8.1.1'
end

it 'uses .tgz' do
expect(chef_run).to create_kafka_download(%(#{Chef::Config.file_cache_path}/kafka_2.9.2-0.8.1.1.tgz))
end

it 'installs kafka' do
expect(chef_run).to run_kafka_install('/opt/kafka-0.8.1.1')
end
end
end
end

0 comments on commit 1436515

Please sign in to comment.