<commit_before>#
# Cookbook Name:: Hadoop
#
# Copyright RightScale, Inc. All rights reserved.  All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.

rightscale_marker :begin

class Chef::Recipe
  include RightScale::Hadoop::Helper
end

namenodes = get_hosts('namenode').to_a

if namenodes.empty? 
  namenodes.push(node[:hadoop][:ip]) if node[:hadoop][:node][:type]=='namenode'
end

log "Installing hadoop hadoop-env.sh to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/hadoop-env.sh" do
  source "hadoop-env.sh.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
  
end

log "Installing hadoop core-site.xml to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/core-site.xml" do
  source "core-site.xml.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
 variables(:namenodes =>namenodes )
end

log "Installing hadoop hdfs-site.xml to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/hdfs-site.xml" do
  source "hdfs-site.xml.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
 variables(:namenodes =>namenodes )
end

log "Installing hadoop masters to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/masters" do
  source "masters.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
 variables(:namenodes =>namenodes )
end

log "Installing hadoop slaves to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/slaves" do
  source "slaves.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
  variables(:namenodes =>namenodes )
end

rightscale_marker :end
<commit_msg>move init and config into default<commit_after>#
# Cookbook Name:: Hadoop
#
# Copyright RightScale, Inc. All rights reserved.  All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.

rightscale_marker :begin

class Chef::Recipe
  include RightScale::Hadoop::Helper
end

namenodes = get_hosts('namenode').to_a

if namenodes.empty? 
  namenodes.push('localhost') if node[:hadoop][:node][:type]=='namenode'
end

log "Installing hadoop hadoop-env.sh to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/hadoop-env.sh" do
  source "hadoop-env.sh.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
  
end

log "Installing hadoop core-site.xml to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/core-site.xml" do
  source "core-site.xml.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
 variables(:namenodes =>namenodes )
end

log "Installing hadoop hdfs-site.xml to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/hdfs-site.xml" do
  source "hdfs-site.xml.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
 variables(:namenodes =>namenodes )
end

log "Installing hadoop masters to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/masters" do
  source "masters.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
 variables(:namenodes =>namenodes )
end

log "Installing hadoop slaves to #{node[:hadoop][:install_dir]}/conf"
template "#{node[:hadoop][:install_dir]}/conf/slaves" do
  source "slaves.erb"
  owner "#{node[:hadoop][:user]}"
  group "#{node[:hadoop][:group]}"
  mode "0644"
  variables(:namenodes =>namenodes )
end

rightscale_marker :end

{'fraction_non_alphanumeric': 0.1814035976691158, 'fraction_numerical': 0.010134279199391943, 'mean_word_length': 6.100719424460432, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3502900', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1392, 'n_words': 307}