mozilla/socorro — pull request #709 by Zoubi (2012-07-17 11:42:43+00:00)
Title: Added a check in setupdb_app.py for database existence. Returns immediately if it already exists

There seems to be a bug in chef on this resource:

```ruby
execute "Setup PostgreSQL database" do
command "/home/socorro/source/socorro/external/postgresql/setupdb_app.py --database_name=breakpad"
not_if "/usr/bin/psql --list breakpad | grep breakpad"
cwd '/home/socorro/source'
environment ({'PYTHONPATH' => '/data/socorro/application:/data/socorro/thirdparty'})
user "postgres"
action :run
end
```

It always calls setupdb_app.py --database_name=breakpad even if not_if "/usr/bin/psql --list breakpad | grep breakpad" avoids that

I updated the python script to do nothing if it detects that the DB already exists