From 8f4a96e398037dce6ad4be5d5ef69b4862d2094a Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Wed, 11 Mar 2015 15:56:52 -0500 Subject: [PATCH] Add auto create_key task to rakefile To eliminate one more step in the process of running our repo steps, added create_key task and made the test task depend upon it. The other manual step is to run the berk_vendor task, but I hesitate to include that in the test tasks as most developers are always messing around with the code and would not like it blown away all the time. Change-Id: I57c4fd8118c289386552e0ed1087959883724ec4 --- README.md | 1 - Rakefile | 15 +++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 63c4dd6..8d6ae46 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ $ git clone https://github.com/jjasghar/chef-openstack-testing-stack.git testing $ cd testing-stack $ vi vagrant_linux.rb # change the 'vm.box' to the openstack platform you'd like to run. $ chef exec rake berks_vendor -$ chef exec ruby -e "require 'openssl'; File.binwrite('.chef/validator.pem', OpenSSL::PKey::RSA.new(2048).to_pem)" ``` The stackforge OpenStack cookbooks by default use databags for configuring passwords. There are four diff --git a/Rakefile b/Rakefile index 074b72b..90b00aa 100644 --- a/Rakefile +++ b/Rakefile @@ -26,23 +26,30 @@ task :berks_vendor do run_command('berks vendor cookbooks') end +desc "Create Chef Key" +task :create_key do + if not File.exist?('.chef/validator.pem') + sh %(chef exec ruby -e "require 'openssl'; File.binwrite('.chef/validator.pem', OpenSSL::PKey::RSA.new(2048).to_pem)") + end +end + desc "All-in-One Neutron build" -task :aio_neutron do +task :aio_neutron => :create_key do run_command('chef-client -z vagrant_linux.rb aio-neutron.rb') end desc "All-in-One Nova-networking build" -task :aio_nova do +task :aio_nova => :create_key do run_command('chef-client -z vagrant_linux.rb aio-nova.rb') end desc "Multi-Neutron build" -task :multi_neutron do +task :multi_neutron => :create_key do run_command('chef-client -z vagrant_linux.rb multi-neutron.rb') end desc "Multi-Nova-networking build" -task :multi_nova do +task :multi_nova => :create_key do run_command('chef-client -z vagrant_linux.rb multi-nova.rb') end