<commit_before># Cookbook Name:: wt_datadeleter
# Recipe:: uninstall
# Author:: <NAME>
#
# Copyright 2012, Webtrends, Inc
#
# All rights reserved - Do Not Redistribute
# This recipe uninstalls existing Search Service installs

# destinations
install_dir = File.join(node['wt_common']['install_dir_windows'], node['wt_datadeleter']['install_dir'].gsub(/[\\\/]+/,"\\"))
log_dir = File.join(node['wt_common']['install_dir_windows'], node['wt_datadeleter']['log_dir'].gsub(/[\\\/]+/,"\\"))

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

powershell "uninstall data deleter" do
	environment({'install_dir' => install_dir, 'service_binary' => node['wt_datadeleter']['datadeleter_binary']})
	code <<-EOH
        $binary_path = $env:install_dir + "\\" + $env:service_binary
	&$binary_path --uninstall	
	EOH
end

powershell "uninstall deletion scheduler" do
	environment({'install_dir' => install_dir, 'service_binary' => node['wt_datadeleter']['deletionscheduler_binary']})
	code <<-EOH
	$binary_path = $env:install_dir + "\\" + $env:service_binary
        &$binary_path --uninstall
	EOH
end


# delete install folder
directory install_dir do
	recursive true
	action :delete
end

# delete log folder
directory log_dir do
	recursive true
	action :delete
end<commit_msg>Test the path before uninstalling... might be a clean installation<commit_after># Cookbook Name:: wt_datadeleter
# Recipe:: uninstall
# Author:: <NAME>
#
# Copyright 2012, Webtrends, Inc
#
# All rights reserved - Do Not Redistribute
# This recipe uninstalls existing Search Service installs

# destinations
install_dir = File.join(node['wt_common']['install_dir_windows'], node['wt_datadeleter']['install_dir'].gsub(/[\\\/]+/,"\\"))
log_dir = File.join(node['wt_common']['install_dir_windows'], node['wt_datadeleter']['log_dir'].gsub(/[\\\/]+/,"\\"))

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

powershell "uninstall data deleter" do
	environment({'install_dir' => install_dir, 'service_binary' => node['wt_datadeleter']['datadeleter_binary']})
	code <<-EOH
        $binary_path = $env:install_dir + "\\" + $env:service_binary
	$binary_path_exists = Test-Path $binary_path
	if ($binary_path_exists) {
		&$binary_path --uninstall
	}	
	EOH
end

powershell "uninstall deletion scheduler" do
	environment({'install_dir' => install_dir, 'service_binary' => node['wt_datadeleter']['deletionscheduler_binary']})
	code <<-EOH
	$binary_path = $env:install_dir + "\\" + $env:service_binary
        $binary_path_exists = Test-Path $binary_path
        if ($binary_path_exists) {
                &$binary_path --uninstall
        }

	EOH
end


# delete install folder
directory install_dir do
	recursive true
	action :delete
end

# delete log folder
directory log_dir do
	recursive true
	action :delete
end
{'fraction_non_alphanumeric': 0.14611716621253407, 'fraction_numerical': 0.0027247956403269754, 'mean_word_length': 5.440789473684211, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3424785', 'n_tokens_mistral': 1002, 'n_tokens_neox': 962, 'n_words': 216}