~charmers/charms/precise/rails/trunk

« back to all changes in this revision

Viewing changes to hooks/chef/cookbooks/postgresql-relation/recipes/changed.rb

  • Committer: Pavel Pachkovskij
  • Date: 2013-08-21 10:46:29 UTC
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: pavel.pachkovskij@gmail.com-20130821104629-zgrf6efx90tkf0ps
add rvm-installer, move cookbooks to CHARM_DIR

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
postgresql = {
2
 
  host: juju_relation['host'],
3
 
  database: juju_relation['database'],
4
 
  username: juju_relation['user'],
5
 
  password: juju_relation['password'],
6
 
  port: juju_relation['port']
7
 
}
8
 
 
9
 
if %i(host database username password).any? { |attr| postgresql[attr].nil? || postgresql[attr].empty? }
10
 
  puts "Waiting for all attributes being set."
11
 
else
12
 
  rack_envfile "#{node[:rack][:root]}/shared/.env" do
13
 
    variables({
14
 
      database_url: "postgres://#{postgresql[:username]}:#{postgresql[:password]}@#{postgresql[:host]}:#{postgresql[:port]}/#{postgresql[:database]}",
15
 
    })
16
 
    user 'deploy'
17
 
    group 'deploy'
18
 
    mode '0644'
19
 
    action :merge
20
 
  end
21
 
 
22
 
  executables do
23
 
    action :export
24
 
  end
25
 
 
26
 
  service 'rack' do
27
 
    ignore_failure true
28
 
    provider Chef::Provider::Service::Upstart
29
 
    action :restart
30
 
  end
31
 
end
 
 
b'\\ No newline at end of file'