From 80c0742e80625dec1500fb2a49604c429acdc45f Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Tue, 24 Jan 2017 14:37:36 -0800 Subject: [PATCH 1/2] (maint) Update Gemfile and gitignore Previously, a bundle install would not pull in gems from Gemfile.local or ~/.gemfile which are common development workflows in Puppet. This commit modifies the Gemfile to pull in these additional gemfiles if they exist. This commit also adds common files and folders to gitignore which should not be committed to this repository. --- .gitignore | 4 ++++ Gemfile | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 835dcd0..99789c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ .ruby-version Gemfile.lock +Gemfile.local vendor +vmpooler.yaml +.bundle +coverage diff --git a/Gemfile b/Gemfile index 4fef816..79aa1c2 100644 --- a/Gemfile +++ b/Gemfile @@ -23,3 +23,13 @@ group :test do gem 'simplecov', '>= 0.11.2' gem 'yarjuf', '>= 2.0' end + +# Evaluate Gemfile.local if it exists +if File.exists? "#{__FILE__}.local" + instance_eval(File.read("#{__FILE__}.local")) +end + +# Evaluate ~/.gemfile if it exists +if File.exists?(File.join(Dir.home, '.gemfile')) + instance_eval(File.read(File.join(Dir.home, '.gemfile'))) +end From 8f294c055eab508ab489971e04fa45547cee22b1 Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Mon, 28 Nov 2016 15:14:39 -0800 Subject: [PATCH 2/2] (maint) Enable Ctrl-C to kill all threads in developer environment Previously, if you ran the vpooler via ruby, pressing Ctrl-C would terminate the Webserver however the PoolManager does not have a handler and would instead just keep executing. This commit adds a global Ctrl-C hook which terminates both the api and manager threads. This behaviour will only be enabled if the `VMPOOLER_DEBUG` environment variable exists so that it does not affect VMPooler when running in production environments. --- vmpooler | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vmpooler b/vmpooler index 20eba53..fd8d557 100755 --- a/vmpooler +++ b/vmpooler @@ -26,4 +26,11 @@ manager = Thread.new { ).execute! } +if ENV['VMPOOLER_DEBUG'] + trap("INT") { + puts "Shutting down." + [api, manager].each { |t| t.exit } + } +end + [api, manager].each { |t| t.join }