<commit_before>#
# Cookbook Name:: roadrunner
# Recipe:: default
# Author:: <NAME>
#
# Copyright 2011, Webtrends
#
# All rights reserved - Do Not Redistribute
# This recipe installs the needed components to full setup/configure the RoadRunner service

include_recipe "windows"

# source build
build_url = "#{node['wt_common']['install_server']}#{node['wt_roadrunner']['url']}#{node['wt_roadrunner']['zip_file']}"

# destinations
install_dir = "#{node['wt_common']['install_dir']}\\RoadRunner"
log_dir     = "#{node['wt_common']['install_dir']}\\logs"

# get data bag items 
auth_data = data_bag_item('authorization', node.chef_environment)
svcuser = auth_data['wt_common']['loader_user']
svcpass = auth_data['wt_common']['loader_pass']

# get parameters
master_host = node['wt_common']['master_host']

# determine root drive of install_dir - ENG390500
if (install_dir =~ /^(\w:)\\.*$/)
	install_dir_drive = $1
else
	raise Chef::Exceptions::AttributeNotFound,
		"could not determine install_dir_drive, please verify value of install_dir: #{install_dir}"
end

Chef::Log.info "Source URL: #{build_url}"

gac_cmd = "#{install_dir}\\gacutil.exe /i \"#{install_dir}\\Webtrends.RoadRunner.SSISPackageRunner.dll\""
sc_cmd = "\"%WINDIR%\\System32\\sc.exe create WebtrendsRoadRunnerService binPath= #{install_dir}\\Webtrends.RoadRunner.Service.exe obj= #{svcuser} password= #{svcpass} start= auto\""
urlacl_cmd = "netsh http add urlacl url=http://+:8097/ user=\"#{svcuser}\""
firewall_cmd="netsh advfirewall firewall add rule name=\"Webtrends RoadRunner port 8097\" dir=in action=allow protocol=TCP localport=8097"
share_cmd="net share wrs=#{install_dir_drive}\\#{install_dir} /grant:EVERYONE,FULL /remark:\"Set from the install batch file\""

# create the install directory
directory "#{install_dir}" do
	recursive true
	action :create
end

# set permissions for the service user to have read access to the install drive
wt_base_icacls "#{install_dir_drive}" do<commit_msg>Fixing path to eliminate duplicate drive letters.<commit_after>#
# Cookbook Name:: roadrunner
# Recipe:: default
# Author:: <NAME>
#
# Copyright 2011, Webtrends
#
# All rights reserved - Do Not Redistribute
# This recipe installs the needed components to full setup/configure the RoadRunner service

include_recipe "windows"

# source build
build_url = "#{node['wt_common']['install_server']}#{node['wt_roadrunner']['url']}#{node['wt_roadrunner']['zip_file']}"

# destinations
install_dir = "#{node['wt_common']['install_dir']}\\RoadRunner"
log_dir     = "#{node['wt_common']['install_dir']}\\logs"

# get data bag items 
auth_data = data_bag_item('authorization', node.chef_environment)
svcuser = auth_data['wt_common']['loader_user']
svcpass = auth_data['wt_common']['loader_pass']

# get parameters
master_host = node['wt_common']['master_host']

# determine root drive of install_dir - ENG390500
if (install_dir =~ /^(\w:)\\.*$/)
	install_dir_drive = $1
else
	raise Chef::Exceptions::AttributeNotFound,
		"could not determine install_dir_drive, please verify value of install_dir: #{install_dir}"
end

Chef::Log.info "Source URL: #{build_url}"

gac_cmd = "#{install_dir}\\gacutil.exe /i \"#{install_dir}\\Webtrends.RoadRunner.SSISPackageRunner.dll\""
sc_cmd = "\"%WINDIR%\\System32\\sc.exe create WebtrendsRoadRunnerService binPath= #{install_dir}\\Webtrends.RoadRunner.Service.exe obj= #{svcuser} password= #{<PASSWORD>} start= auto\""
urlacl_cmd = "netsh http add urlacl url=http://+:8097/ user=\"#{svcuser}\""
firewall_cmd="netsh advfirewall firewall add rule name=\"Webtrends RoadRunner port 8097\" dir=in action=allow protocol=TCP localport=8097"
share_cmd="net share wrs=#{install_dir} /grant:EVERYONE,FULL /remark:\"Set from the install batch file\""

# create the install directory
directory "#{install_dir}" do
	recursive true
	action :create
end

# set permissions for the service user to have read access to the install drive
wt_base_icacls "#{install_dir_drive}" do
{'fraction_non_alphanumeric': 0.14651457541191382, 'fraction_numerical': 0.012674271229404309, 'mean_word_length': 6.530534351145038, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5384067', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1272, 'n_words': 323}