Sha256: 15e8f265ddb5d9112f36f9e0bb21d74e731e49ba109c158fa2684f34a75ea1d6

Contents?: true

Size: 1.01 KB

Versions: 28

Compression:

Stored size: 1.01 KB

Contents

embedded_path = "/opt/chef/embedded/bin:#{ENV["PATH"]}"

api_root_dir = "/var/opt/data_collector_api"

directory api_root_dir do
  recursive true
end

cookbook_file ::File.join(api_root_dir, "Gemfile") do
  source "apigemfile"
end

cookbook_file ::File.join(api_root_dir, "config.ru")

cookbook_file ::File.join(api_root_dir, "api.rb")

execute "bundle install --binstubs" do
  cwd api_root_dir
  environment({ "PATH" => embedded_path })
end

pid_file    = "/var/run/api.pid"
running_pid = ::File.exist?(pid_file) ? ::File.read(pid_file).strip : nil

execute "kill existing API process" do
  command "kill #{running_pid}"
  environment({ "PATH" => embedded_path })
  not_if { running_pid.nil? }
end

execute "start API" do
  command "bin/rackup -D -P #{pid_file}"
  environment({ "PATH" => embedded_path })
  cwd api_root_dir
end

directory "/etc/chef"

["both-mode", "client-mode", "no-endpoint", "solo-mode"].each do |config_file|
  cookbook_file "/etc/chef/#{config_file}.rb" do
    source "client-rb-#{config_file}.rb"
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
chef-13.11.3 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.10.4 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.10.0 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.9.4 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-14.2.0 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-14.1.12 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-14.1.1 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.9.1 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-14.0.202-universal-mingw32 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-14.0.202 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-14.0.190 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.8.5 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.8.3 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.8.0 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.7.16-universal-mingw32 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.7.16 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.6.4-universal-mingw32 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.6.4 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.6.0-universal-mingw32 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
chef-13.6.0 acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb