Skip to content
Snippets Groups Projects
Commit 60e8fe59 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[BUGFIX] Some features must be optional

parent be95a6db
No related branches found
No related tags found
No related merge requests found
default['typo3_site']['ip_address'] = '192.168.156.140'
default['typo3_site']['ip_address'] = ''
default['typo3_site']['webroot'] = '/var/www'
default['typo3_site']['site_configuration'] = 'SiteConfiguration.php'
default['typo3_site']['server_aliases'] = 'www.site.dev'
default['typo3_site']['hostname'] = 'site.dev'
default['typo3_site']['repository'] = ''
default['typo3_site']['repository_hostname'] = 'git.domain'
default['typo3_site']['repository_hostname'] = ''
default['typo3_site']['repository_port'] = 22
default['typo3_site']['download_typo3'] = false
default['typo3_site']['typo3_version'] = '6.2'
......
......@@ -141,6 +141,7 @@ if node['typo3_site']['download_typo3']
cd #{node['typo3_site']['webroot']}/#{node['typo3_site']['hostname']}
rm -f typo3_src
ln -s ../typo3_src-#{node['typo3_site']['typo3_version']} typo3_src
touch typo3conf/ENABLE_INSTALL_TOOL
if [ ! -f typo3 ]
then
......@@ -160,20 +161,22 @@ end
### Provide Sources ###
#######################
ssh_known_hosts_entry node['typo3_site']['repository_hostname'] do
port node['typo3_site']['repository_port']
end
if node['typo3_site']['repository'] != ''
ssh_known_hosts_entry node['typo3_site']['repository_hostname'] do
port node['typo3_site']['repository_port']
end
git "#{node['typo3_site']['webroot']}/#{node['typo3_site']['hostname']}" do
repository node['typo3_site']['repository']
remote 'origin'
revision 'HEAD'
reference 'master'
timeout 100000
user 'vagrant'
group 'vagrant'
action :checkout
ssh_wrapper '/home/vagrant/ssh_wrapper.sh'
git "#{node['typo3_site']['webroot']}/#{node['typo3_site']['hostname']}" do
repository node['typo3_site']['repository']
remote 'origin'
revision 'HEAD'
reference 'master'
timeout 100000
user 'vagrant'
group 'vagrant'
action :checkout
ssh_wrapper '/home/vagrant/ssh_wrapper.sh'
end
end
###########################################
......@@ -266,47 +269,51 @@ node['typo3_site']['sync_databases'].each do |database_data|
action :grant
end
# add host to ssh known hosts
ssh_known_hosts_entry database_data['dump_hostname'] do
port database_data['dump_port']
end
if database_data['dump_hostname']
# add host to ssh known hosts
ssh_known_hosts_entry database_data['dump_hostname'] do
port database_data['dump_port']
end
# download the sql data
bash 'Download Dump for ' + database_data['database_name'] do
user 'vagrant'
group 'vagrant'
timeout 3000000
code <<-EOF
rsync --delete -auvz --progress -e "ssh -i /home/vagrant/.ssh/id_rsa -p #{database_data['dump_port']} -o StrictHostKeyChecking=no" \
--no-o --no-g #{database_data['dump_user']}@#{database_data['dump_hostname']}:#{database_data['dump_remote']} \
#{database_data['dump_local']};
EOF
action :run
end
# download the sql data
bash 'Download Dump for ' + database_data['database_name'] do
user 'vagrant'
group 'vagrant'
timeout 3000000
code <<-EOF
rsync --delete -auvz --progress -e "ssh -i /home/vagrant/.ssh/id_rsa -p #{database_data['dump_port']} -o StrictHostKeyChecking=no" \
--no-o --no-g #{database_data['dump_user']}@#{database_data['dump_hostname']}:#{database_data['dump_remote']} \
#{database_data['dump_local']};
EOF
action :run
end
# load the dump
bash 'Import Dump for ' + database_data['database_name'] do
code <<-EOF
mysql -h 127.0.0.1 -u root -proot #{database_data['database_name']} < #{database_data['dump_local']}
EOF
action :run
# load the dump
bash 'Import Dump for ' + database_data['database_name'] do
code <<-EOF
mysql -h 127.0.0.1 -u root -proot #{database_data['database_name']} < #{database_data['dump_local']}
EOF
action :run
end
# # this would be better, but currently buggy in the database cookbook
# # https://github.com/opscode-cookbooks/database/issues/128
# mysql_database 'Import Dump for ' + database_data['database_name'] do
# connection connection_info
# database_name #{database_data['database_name']}
# sql { ::File.open(#{database_data['dump_local']}).read }
# action :query
# end
end
# # this would be better, but currently buggy in the database cookbook
# # https://github.com/opscode-cookbooks/database/issues/128
# mysql_database 'Import Dump for ' + database_data['database_name'] do
# connection connection_info
# database_name #{database_data['database_name']}
# sql { ::File.open(#{database_data['dump_local']}).read }
# action :query
# end
database_data['post_install_queries'].each do |query|
mysql_database 'Execute Post Install Query' do
connection connection_info
database_name database_data['database_name']
sql query
action :query
if database_data['post_install_queries']
database_data['post_install_queries'].each do |query|
mysql_database 'Execute Post Install Query' do
connection connection_info
database_name database_data['database_name']
sql query
action :query
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment