From 59e93cb917f1d0b2e948ad7365a7f00686f76aae Mon Sep 17 00:00:00 2001 From: Peter Schroeter Date: Tue, 27 May 2014 21:51:26 -0700 Subject: [PATCH 1/5] Add collateral_path input --- attributes/default.rb | 2 ++ metadata.rb | 8 ++++++++ recipes/setup_virtualmonkey.rb | 24 ++++++++++++++---------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index d8b77e9..8e3c2fb 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -132,6 +132,8 @@ default[:virtualmonkey][:virtualmonkey][:monkey_repo_branch] = "" # Collateral Repository URL default[:virtualmonkey][:virtualmonkey][:collateral_repo_url] = "" +# Collateral Repository URL +default[:virtualmonkey][:virtualmonkey][:collateral_repo_path] = "" # Collateral Repository Branch default[:virtualmonkey][:virtualmonkey][:collateral_repo_branch] = "" # Right API Objects Repository URL diff --git a/metadata.rb b/metadata.rb index 56ebec9..ad87f1d 100644 --- a/metadata.rb +++ b/metadata.rb @@ -306,6 +306,14 @@ :required => "required", :recipes => ["virtualmonkey::setup_virtualmonkey"] +attribute "virtualmonkey/virtualmonkey/collateral_repo_path", + :display_name => "Collateral Repo Path", + :description => + "Subdirectory containing virtualmonkey collateral for Git project. Defaults to root dir", + :required => "recommended", + :default => "", + :recipes => ["virtualmonkey::setup_virtualmonkey"] + attribute "virtualmonkey/virtualmonkey/collateral_repo_branch", :display_name => "Collateral Repo Branch", :description => diff --git a/recipes/setup_virtualmonkey.rb b/recipes/setup_virtualmonkey.rb index 4063f5c..a4ff58a 100644 --- a/recipes/setup_virtualmonkey.rb +++ b/recipes/setup_virtualmonkey.rb @@ -99,27 +99,32 @@ basename_cmd.error! node[:virtualmonkey][:virtualmonkey][:collateral_name] = basename_cmd.stdout.chomp +collateral_dir = ::File.join( + node[:virtualmonkey][:user_home], + node[:virtualmonkey][:virtualmonkey][:collateral_path], + node[:virtualmonkey][:virtualmonkey][:collateral_name]) +repo_checkout_dir = ::File.join( + node[:virtualmonkey][:user_home], + node[:virtualmonkey][:virtualmonkey][:collateral_name]) -log " Checking out collateral repo to" + - " #{node[:virtualmonkey][:virtualmonkey][:collateral_name]}" -git "#{node[:virtualmonkey][:user_home]}/" + - "#{node[:virtualmonkey][:virtualmonkey][:collateral_name]}" do + + +log " Checking out collateral repo to #{repo_checkout_dir}" +git repo_checkout_dir do repository node[:virtualmonkey][:virtualmonkey][:collateral_repo_url] reference node[:virtualmonkey][:virtualmonkey][:collateral_repo_branch] action :sync end execute "git checkout" do - cwd "#{node[:virtualmonkey][:user_home]}/" + - "#{node[:virtualmonkey][:virtualmonkey][:collateral_name]}" + cwd repo_checkout_dir command "git checkout" + " #{node[:virtualmonkey][:virtualmonkey][:collateral_repo_branch]}" end log " Installing gems required for the collateral project" execute "bundle install on collateral" do - cwd "#{node[:virtualmonkey][:user_home]}/" + - "#{node[:virtualmonkey][:virtualmonkey][:collateral_name]}" + cwd collateral_dir # Bundler loads in /usr/local/bin in Ubuntu. Chef looks at system path, so we need to add this explicitly. environment("PATH" => "#{ENV["PATH"]}:/usr/local/bin") command "bundle install --no-color --system" @@ -153,8 +158,7 @@ # Populate all virtualmonkey cloud variables log " Populating virtualmonkey cloud variables" execute "populate cloud variables" do - cwd "#{node[:virtualmonkey][:user_home]}/" + - "#{node[:virtualmonkey][:virtualmonkey][:collateral_name]}" + cwd collateral_dir # Bundler loads in /usr/local/bin in Ubuntu. Chef looks at system path, so we need to add this explicitly. environment("PATH" => "#{ENV["PATH"]}:/usr/local/bin") command "bundle exec monkey populate_all_cloud_vars" + From 68ff1f7ba942e82ea156f599b690775dd064ef46 Mon Sep 17 00:00:00 2001 From: Peter Schroeter Date: Tue, 27 May 2014 23:32:20 -0700 Subject: [PATCH 2/5] Mistyped variable name --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 8e3c2fb..344ce35 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -133,7 +133,7 @@ # Collateral Repository URL default[:virtualmonkey][:virtualmonkey][:collateral_repo_url] = "" # Collateral Repository URL -default[:virtualmonkey][:virtualmonkey][:collateral_repo_path] = "" +default[:virtualmonkey][:virtualmonkey][:collateral_path] = "" # Collateral Repository Branch default[:virtualmonkey][:virtualmonkey][:collateral_repo_branch] = "" # Right API Objects Repository URL From 4eb38e80dc55d6a2f5a519f1d9fedc8b57fae3a1 Mon Sep 17 00:00:00 2001 From: Peter Schroeter Date: Wed, 4 Jun 2014 22:12:01 -0700 Subject: [PATCH 3/5] Support collateral path option for rocketmonkey as well --- metadata.rb | 2 +- recipes/setup_rocketmonkey.rb | 7 ++++++- templates/default/rocketmonkey_config.yaml.erb | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/metadata.rb b/metadata.rb index ad87f1d..28cdefa 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures VirtualMonkey' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '13.10.1' +version '13.11.0' supports "centos" supports "redhat" diff --git a/recipes/setup_rocketmonkey.rb b/recipes/setup_rocketmonkey.rb index 984f80b..82e8c55 100644 --- a/recipes/setup_rocketmonkey.rb +++ b/recipes/setup_rocketmonkey.rb @@ -49,6 +49,11 @@ # The rocketmonkey main configuration file is created from a template initially # allowing custom edits on the configuration. +collateral_dir = ::File.join( + node[:virtualmonkey][:user_home], + node[:virtualmonkey][:virtualmonkey][:collateral_path], + node[:virtualmonkey][:virtualmonkey][:collateral_name]) + template "#{node[:virtualmonkey][:user_home]}/.rocketmonkey/rocketmonkey.yaml" do source "rocketmonkey_config.yaml.erb" owner node[:virtualmonkey][:user] @@ -59,7 +64,7 @@ :jenkins_password => node[:'rs-jenkins'][:server][:password], :right_acct_id => node[:virtualmonkey][:rest][:right_acct_id], :right_subdomain => node[:virtualmonkey][:rest][:right_subdomain], - :collateral_repo_name => node['virtualmonkey']['virtualmonkey']['collateral_name'], + :collateral_dir => collateral_dir, :servertemplate_mapping_file_name => node['virtualmonkey']['rocketmonkey']['servertemplate_mapping_file_name'] ) action :create_if_missing diff --git a/templates/default/rocketmonkey_config.yaml.erb b/templates/default/rocketmonkey_config.yaml.erb index 9266d4c..8a448a8 100644 --- a/templates/default/rocketmonkey_config.yaml.erb +++ b/templates/default/rocketmonkey_config.yaml.erb @@ -57,19 +57,19 @@ # # troop_path - Path to troop files # -:troop_path: "/root/<%= @collateral_repo_name %>/updatedTroops/" +:troop_path: "<%= @collateral_dir %>/updatedTroops/" # # suite_path - Path to test suites # -:suite_path: "/root/<%= @collateral_repo_name %>/suites/" +:suite_path: "<%= @collateral_dir %>/suites/" # # server_template_map_file - Path to server template map file # -:server_template_map_file: "/root/<%= @collateral_repo_name %>/config/servertemplate_mapping/<%= @servertemplate_mapping_file_name %>" +:server_template_map_file: "<%= @collateral_dir %>/config/servertemplate_mapping/<%= @servertemplate_mapping_file_name %>" # From d86c1600c0a63bfcf0502011fbde2e4b6bb325e3 Mon Sep 17 00:00:00 2001 From: Peter Schroeter Date: Wed, 4 Jun 2014 23:26:49 -0700 Subject: [PATCH 4/5] Fix up errors --- attributes/default.rb | 2 +- recipes/setup_rocketmonkey.rb | 4 ++-- recipes/setup_virtualmonkey.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 344ce35..8e3c2fb 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -133,7 +133,7 @@ # Collateral Repository URL default[:virtualmonkey][:virtualmonkey][:collateral_repo_url] = "" # Collateral Repository URL -default[:virtualmonkey][:virtualmonkey][:collateral_path] = "" +default[:virtualmonkey][:virtualmonkey][:collateral_repo_path] = "" # Collateral Repository Branch default[:virtualmonkey][:virtualmonkey][:collateral_repo_branch] = "" # Right API Objects Repository URL diff --git a/recipes/setup_rocketmonkey.rb b/recipes/setup_rocketmonkey.rb index 82e8c55..82808f4 100644 --- a/recipes/setup_rocketmonkey.rb +++ b/recipes/setup_rocketmonkey.rb @@ -51,8 +51,8 @@ # allowing custom edits on the configuration. collateral_dir = ::File.join( node[:virtualmonkey][:user_home], - node[:virtualmonkey][:virtualmonkey][:collateral_path], - node[:virtualmonkey][:virtualmonkey][:collateral_name]) + node[:virtualmonkey][:virtualmonkey][:collateral_name], + node[:virtualmonkey][:virtualmonkey][:collateral_repo_path]) template "#{node[:virtualmonkey][:user_home]}/.rocketmonkey/rocketmonkey.yaml" do source "rocketmonkey_config.yaml.erb" diff --git a/recipes/setup_virtualmonkey.rb b/recipes/setup_virtualmonkey.rb index a4ff58a..c1a259e 100644 --- a/recipes/setup_virtualmonkey.rb +++ b/recipes/setup_virtualmonkey.rb @@ -101,8 +101,8 @@ node[:virtualmonkey][:virtualmonkey][:collateral_name] = basename_cmd.stdout.chomp collateral_dir = ::File.join( node[:virtualmonkey][:user_home], - node[:virtualmonkey][:virtualmonkey][:collateral_path], - node[:virtualmonkey][:virtualmonkey][:collateral_name]) + node[:virtualmonkey][:virtualmonkey][:collateral_name], + node[:virtualmonkey][:virtualmonkey][:collateral_repo_path]) repo_checkout_dir = ::File.join( node[:virtualmonkey][:user_home], node[:virtualmonkey][:virtualmonkey][:collateral_name]) From ccba7bdd0e9f3c8fc5e5aa70b2155cb321c816de Mon Sep 17 00:00:00 2001 From: Peter Schroeter Date: Thu, 5 Jun 2014 13:49:21 -0700 Subject: [PATCH 5/5] Variable is used by rocketmonkey setup as well --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 28cdefa..a5b651f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -312,7 +312,7 @@ "Subdirectory containing virtualmonkey collateral for Git project. Defaults to root dir", :required => "recommended", :default => "", - :recipes => ["virtualmonkey::setup_virtualmonkey"] + :recipes => ["virtualmonkey::setup_virtualmonkey", "virtualmonkey::setup_rocketmonkey"] attribute "virtualmonkey/virtualmonkey/collateral_repo_branch", :display_name => "Collateral Repo Branch",