From 5bd6528879e2a1b051f6650b663bdc8970f7107b Mon Sep 17 00:00:00 2001 From: Lincoln Lee Date: Sun, 6 Dec 2015 10:57:08 +0800 Subject: [PATCH] Set home path to 3.x default when it exists - set directory to right permission --- attributes/default.rb | 7 ++++++- recipes/configuration.rb | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 124cae2..c2181f3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -3,7 +3,12 @@ default['stash']['version'] = '4.1.0' default['stash']['product'] = Chef::Version.new(node['stash']['version']) >= Chef::Version.new('4.0.0') ? 'bitbucket' : 'stash' -default['stash']['home_path'] = "/var/atlassian/application-data/#{node['stash']['product']}" +if Dir.exist?('/var/atlassian/application-data/stash') + default['stash']['home_path'] = '/var/atlassian/application-data/stash' +else + default['stash']['home_path'] = "/var/atlassian/application-data/#{node['stash']['product']}" +end + default['stash']['install_path'] = '/opt/atlassian' default['stash']['install_type'] = 'standalone' default['stash']['service_type'] = 'init' diff --git a/recipes/configuration.rb b/recipes/configuration.rb index 1fe92e1..8777c41 100644 --- a/recipes/configuration.rb +++ b/recipes/configuration.rb @@ -22,6 +22,12 @@ action :create recursive true end + + bash 'update home path permission' do + code <<-EOH + chown -R #{node['stash']['user']}:#{node['stash']['user']} #{node['stash']['home_path']} + EOH + end else config_path = '/stash-config.properties' end