<commit_before>include_recipe 'java'

storm_package_name = node['storm']['package']
storm_version = node['storm']['version']
storm_remote_name = "#{node['storm']['download_url']}#{node['storm']['download_dir']}"
install_dir = node['storm']['install_dir']

group 'storm' do
  action :create
end

user 'storm' do
  comment 'For storm services'
  gid 'storm'
  home '/home/storm'
  shell '/bin/bash'
  action :create
end

directory '/usr/share/storm' do
  owner 'root'
  group 'root'
  mode '0644'
  action :create
end

case node['storm']['install_method']
when 'cookbook_file'
  cookbook_file "/tmp/#{storm_package_name}.tar.gz" do
    source "#{storm_package_name}.tar.gz"
  end
when 'remote_file'
  remote_file "/tmp/#{storm_package_name}.tar.gz" do # ~FC013
    source storm_remote_name
  end
end

script 'install_storm' do
  interpreter 'bash'
  user 'root'
  code <<-EOL
    tar zxvf /tmp/#{storm_package_name}.tar.gz -C #{install_dir}
    rm -rf #{install_dir}/#{storm_version}
    mv #{install_dir}/#{storm_package_name} #{install_dir}/#{storm_version}
    chown -R storm:storm #{install_dir}/#{storm_version}
  EOL
end

template "#{install_dir}/#{storm_version}/conf/storm.yaml" do
  source 'storm.yaml.erb'
  mode '0440'
  owner 'root'
  group 'root'
end<commit_msg>insure recipe doesn't repeatedly uncompress the storm tarball<commit_after>include_recipe 'java'

storm_package_name = node['storm']['package']
storm_version = node['storm']['version']
storm_remote_name = "#{node['storm']['download_url']}#{node['storm']['download_dir']}"
install_dir = node['storm']['install_dir']

group 'storm' do
  action :create
end

user 'storm' do
  comment 'For storm services'
  gid 'storm'
  home '/home/storm'
  shell '/bin/bash'
  action :create
end

directory '/usr/share/storm' do
  owner 'root'
  group 'root'
  mode '0644'
  action :create
end

case node['storm']['install_method']
when 'cookbook_file'
  cookbook_file "/tmp/#{storm_package_name}.tar.gz" do
    source "#{storm_package_name}.tar.gz"
  end
when 'remote_file'
  remote_file "/tmp/#{storm_package_name}.tar.gz" do # ~FC013
    source storm_remote_name
  end
end

script 'install_storm' do
  interpreter 'bash'
  user 'root'
  code <<-EOL
    tar zxvf /tmp/#{storm_package_name}.tar.gz -C #{install_dir}
    rm -rf #{install_dir}/#{storm_version}
    mv #{install_dir}/#{storm_package_name} #{install_dir}/#{storm_version}
    chown -R storm:storm #{install_dir}/#{storm_version}
  EOL
  not_if { ::File.exists?("#{install_dir}/#{storm_version}") }
end

template "#{install_dir}/#{storm_version}/conf/storm.yaml" do
  source 'storm.yaml.erb'
  mode '0440'
  owner 'root'
  group 'root'
end
{'fraction_non_alphanumeric': 0.1565675573955589, 'fraction_numerical': 0.008280015054572827, 'mean_word_length': 4.933035714285714, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5728401', 'n_tokens_mistral': 958, 'n_tokens_neox': 952, 'n_words': 212}