<commit_before># Encoding: UTF-8
# Recipe:: _service
#
#

## handle rhel7/debian
systemd = false
init = false
upstart = true
init_provider = Chef::Provider::Service::Upstart

if node[:init_package] == 'init'
  case node[:platform_family]
  when 'rhel'
    init_provider = Chef::Provider::Service::Init::Redhat
  when 'debian'
    init_provider = Chef::Provider::Service::Init::Debian
  end
  init = true
  upstart = false
end
if node[:init_package] == 'systemd'
  init_provider = Chef::Provider::Service::Systemd
  systemd = true
  upstart = false
end

directory File.dirname node[:etcd][:state_dir] do
  user node[:etcd][:user]
  group node[:etcd][:group]
  mode 0755
end

template '/etc/init.d/etcd' do
  mode 0755
  only_if { init }
end

init_args = Etcd.args.delete("'")
template '/etc/default/etcd' do
  mode 0644
  source 'etcd-default.erb'
  variables(args: init_args)
  notifies :restart, 'service[etcd]' if node[:etcd][:trigger_restart]
  only_if { init }
end

template '/etc/init/etcd.conf' do
  mode 0644
  variables(args: Etcd.args)
  notifies :restart, 'service[etcd]' if node[:etcd][:trigger_restart]
  only_if { upstart }
end

# TODO: use this on other sytemd platforms
template '/etc/systemd/system/etcd.service' do
  mode 0644
  variables(args: Etcd.args)
  notifies :run, 'execute[systemd_reload_units]', :immediate
  notifies :restart, 'service[etcd]' if node[:etcd][:trigger_restart]
  only_if { systemd }
end

execute 'systemd_reload_units' do
  action :nothing
  command '/bin/systemctl daemon-reload'
end

service 'etcd' do
  provider init_provider
  supports status: true, restart: true, reload: true
  action [:enable, :start] if node[:etcd][:trigger_start]
end<commit_msg>Make sure the hostname is evaluated as lazy to not put pre-bootstrap fqdn in templates.<commit_after># Encoding: UTF-8
# Recipe:: _service
#
#

## handle rhel7/debian
systemd = false
init = false
upstart = true
init_provider = Chef::Provider::Service::Upstart

if node[:init_package] == 'init'
  case node[:platform_family]
  when 'rhel'
    init_provider = Chef::Provider::Service::Init::Redhat
  when 'debian'
    init_provider = Chef::Provider::Service::Init::Debian
  end
  init = true
  upstart = false
end
if node[:init_package] == 'systemd'
  init_provider = Chef::Provider::Service::Systemd
  systemd = true
  upstart = false
end

directory File.dirname node[:etcd][:state_dir] do
  user node[:etcd][:user]
  group node[:etcd][:group]
  mode 0755
end

template '/etc/init.d/etcd' do
  mode 0755
  only_if { init }
end

init_args = Etcd.args.delete("'")
template '/etc/default/etcd' do
  mode 0644
  source 'etcd-default.erb'
  variables(args: init_args)
  notifies :restart, 'service[etcd]' if node[:etcd][:trigger_restart]
  only_if { init }
end

template '/etc/init/etcd.conf' do
  mode 0644
  variables(args: Etcd.args)
  notifies :restart, 'service[etcd]' if node[:etcd][:trigger_restart]
  only_if { upstart }
end

# TODO: use this on other sytemd platforms
template '/etc/systemd/system/etcd.service' do
  mode 0644
  variables ( lazy {{ args: Etcd.args }} )
  notifies :run, 'execute[systemd_reload_units]', :immediate
  notifies :restart, 'service[etcd]' if node[:etcd][:trigger_restart]
  only_if { systemd }
end

execute 'systemd_reload_units' do
  action :nothing
  command '/bin/systemctl daemon-reload'
end

service 'etcd' do
  provider init_provider
  supports status: true, restart: true, reload: true
  action [:enable, :start] if node[:etcd][:trigger_start]
end
{'fraction_non_alphanumeric': 0.12801377726750862, 'fraction_numerical': 0.012629161882893225, 'mean_word_length': 4.8375209380234505, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '191184', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1230, 'n_words': 315}