<commit_before>Chef::Log.info("Setting environment variables")

Chef::Log.info("Adding ec2 environment variables")
ENV["EC2_INSTANCE_ID"] = `ec2-metadata -i`[/ (?<a>.*)n?$/, "a"]
ENV["EC2_AVAIL_ZONE"] = `ec2-metadata -z`[/ (?<a>.*)n?$/, "a"]
ENV["EC2_PUBLIC_IP4"] = `ec2-metadata -z`[/ (?<a>.*)n?$/, "a"]
ENV["HOST_NAME"] = `ec2-metadata -p`[/ (?<a>.*)n?$/, "a"]

Chef::Log.info("Setting environment variables for current process")
node[:environment_variables].each do |name, value|
	ENV["#{name}"] = "#{value}"
end

Chef::Log.info("Writing variables to /etc/environment to have them after restart")
template "/etc/environment" do
	source "environment.erb"
	mode "0644"
	owner "root"
	group "root"
	variables({
		:environment_variables => node[:environment_variables]
	})
end<commit_msg>Added them to the proper dictionary<commit_after>Chef::Log.info("Setting environment variables")

Chef::Log.info("Adding ec2 environment variables")
node[:environment_variables]["EC2_INSTANCE_ID"] = `ec2-metadata -i`[/ (?<a>.*)n?$/, "a"]
node[:environment_variables]["EC2_AVAIL_ZONE"] = `ec2-metadata -z`[/ (?<a>.*)n?$/, "a"]
node[:environment_variables]["EC2_PUBLIC_IP4"] = `ec2-metadata -z`[/ (?<a>.*)n?$/, "a"]
node[:environment_variables]["HOST_NAME"] = `ec2-metadata -p`[/ (?<a>.*)n?$/, "a"]

Chef::Log.info("Setting environment variables for current process")
node[:environment_variables].each do |name, value|
	ENV["#{name}"] = "#{value}"
end

Chef::Log.info("Writing variables to /etc/environment to have them after restart")
template "/etc/environment" do
	source "environment.erb"
	mode "0644"
	owner "root"
	group "root"
	variables({
		:environment_variables => node[:environment_variables]
	})
end
{'fraction_non_alphanumeric': 0.21462264150943397, 'fraction_numerical': 0.015330188679245283, 'mean_word_length': 6.378260869565217, 'pattern_counts': {'":': 0, '<': 11, '<?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': '118464', 'n_tokens_mistral': 630, 'n_tokens_neox': 613, 'n_words': 132}