server_maint 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. data/.gitmodules +3 -0
  2. data/lib/cookbooks/postgresql/.gitignore +7 -0
  3. data/lib/cookbooks/postgresql/.ruby-version +1 -0
  4. data/lib/cookbooks/postgresql/LICENSE.txt +20 -0
  5. data/lib/cookbooks/postgresql/README.md +588 -0
  6. data/lib/cookbooks/postgresql/Rakefile +35 -0
  7. data/lib/cookbooks/postgresql/attributes/default.rb +365 -0
  8. data/lib/cookbooks/postgresql/definitions/pg_database.rb +61 -0
  9. data/lib/cookbooks/postgresql/definitions/pg_database_extensions.rb +67 -0
  10. data/lib/cookbooks/postgresql/definitions/pg_user.rb +45 -0
  11. data/lib/cookbooks/postgresql/files/default/pgdg.pref +3 -0
  12. data/lib/cookbooks/postgresql/metadata.rb +22 -0
  13. data/lib/cookbooks/postgresql/recipes/client.rb +8 -0
  14. data/lib/cookbooks/postgresql/recipes/contrib.rb +8 -0
  15. data/lib/cookbooks/postgresql/recipes/dbg.rb +8 -0
  16. data/lib/cookbooks/postgresql/recipes/default.rb +50 -0
  17. data/lib/cookbooks/postgresql/recipes/doc.rb +8 -0
  18. data/lib/cookbooks/postgresql/recipes/libpq.rb +9 -0
  19. data/lib/cookbooks/postgresql/recipes/postgis.rb +8 -0
  20. data/lib/cookbooks/postgresql/recipes/server.rb +118 -0
  21. data/lib/cookbooks/postgresql/templates/default/environment.erb +11 -0
  22. data/lib/cookbooks/postgresql/templates/default/pg_ctl.conf.erb +5 -0
  23. data/lib/cookbooks/postgresql/templates/default/pg_hba.conf.erb +100 -0
  24. data/lib/cookbooks/postgresql/templates/default/pg_ident.conf.erb +46 -0
  25. data/lib/cookbooks/postgresql/templates/default/postgresql.conf.custom.erb +10 -0
  26. data/lib/cookbooks/postgresql/templates/default/postgresql.conf.standard.erb +558 -0
  27. data/lib/cookbooks/postgresql/templates/default/start.conf.erb +9 -0
  28. data/lib/cookbooks/postgresql/test/.chef/knife.rb +2 -0
  29. data/lib/cookbooks/postgresql/test/support/Gemfile +5 -0
  30. data/lib/server_maint/version.rb +1 -1
  31. metadata +32 -4
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env rake
2
+
3
+ task :default => "foodcritic"
4
+
5
+ desc "Runs foodcritic linter"
6
+ task :foodcritic do
7
+ Rake::Task[:prepare_sandbox].execute
8
+
9
+ if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
10
+ sh "foodcritic -f any #{sandbox_path}"
11
+ else
12
+ puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
13
+ end
14
+ end
15
+
16
+ desc "Runs knife cookbook test"
17
+ task :knife do
18
+ Rake::Task[:prepare_sandbox].execute
19
+
20
+ sh "bundle exec knife cookbook test cookbook -c test/.chef/knife.rb -o #{sandbox_path}/../"
21
+ end
22
+
23
+ task :prepare_sandbox do
24
+ files = %w{*.md *.rb attributes definitions libraries files providers recipes resources templates}
25
+
26
+ rm_rf sandbox_path
27
+ mkdir_p sandbox_path
28
+ cp_r Dir.glob("{#{files.join(",")}}"), sandbox_path
29
+ end
30
+
31
+ private
32
+
33
+ def sandbox_path
34
+ File.join(File.dirname(__FILE__), %w[tmp cookbooks cookbook])
35
+ end
@@ -0,0 +1,365 @@
1
+ #
2
+ # Cookbook Name:: postgresql
3
+ # Attributes:: default
4
+ #
5
+ # Author:: Phil Cohen <github@phlippers.net>
6
+ #
7
+ # Copyright 2012-2013, Phil Cohen
8
+ #
9
+
10
+ default["postgresql"]["version"] = "9.2"
11
+
12
+ default["postgresql"]["environment_variables"] = {}
13
+ default["postgresql"]["pg_ctl_options"] = ""
14
+ default["postgresql"]["pg_hba"] = []
15
+ default["postgresql"]["pg_hba_defaults"] = true
16
+ default["postgresql"]["pg_ident"] = []
17
+ default["postgresql"]["start"] = "auto" # auto, manual, disabled
18
+
19
+ default["postgresql"]["conf"] = {}
20
+ default["postgresql"]["initdb_options"] = "--locale=en_US.UTF-8"
21
+
22
+ #------------------------------------------------------------------------------
23
+ # POSTGIS
24
+ #------------------------------------------------------------------------------
25
+
26
+ default["postgis"]["version"] = "1.5"
27
+
28
+ #------------------------------------------------------------------------------
29
+ # FILE LOCATIONS
30
+ #------------------------------------------------------------------------------
31
+ default["postgresql"]["data_directory"] = "/var/lib/postgresql/#{node["postgresql"]["version"]}/main"
32
+ default["postgresql"]["hba_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_hba.conf"
33
+ default["postgresql"]["ident_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_ident.conf"
34
+ default["postgresql"]["external_pid_file"] = "/var/run/postgresql/#{node["postgresql"]["version"]}-main.pid"
35
+
36
+
37
+ #------------------------------------------------------------------------------
38
+ # CONNECTIONS AND AUTHENTICATION
39
+ #------------------------------------------------------------------------------
40
+
41
+ # connection settings
42
+ default["postgresql"]["listen_addresses"] = "localhost"
43
+ default["postgresql"]["port"] = 5432
44
+ default["postgresql"]["max_connections"] = 100
45
+ default["postgresql"]["superuser_reserved_connections"] = 3
46
+ default["postgresql"]["unix_socket_directory"] = "/var/run/postgresql"
47
+ default["postgresql"]["unix_socket_group"] = ""
48
+ default["postgresql"]["unix_socket_permissions"] = "0777"
49
+ default["postgresql"]["bonjour"] = "off"
50
+ default["postgresql"]["bonjour_name"] = ""
51
+
52
+ # security and authentication
53
+ default["postgresql"]["authentication_timeout"] = "1min"
54
+ default["postgresql"]["ssl"] = true
55
+ default["postgresql"]["ssl_ciphers"] = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"
56
+ default["postgresql"]["ssl_renegotiation_limit"] = "512MB"
57
+ default["postgresql"]["ssl_ca_file"] = ""
58
+ default["postgresql"]["ssl_cert_file"] = "/etc/ssl/certs/ssl-cert-snakeoil.pem"
59
+ default["postgresql"]["ssl_crl_file"] = ""
60
+ default["postgresql"]["ssl_key_file"] = "/etc/ssl/private/ssl-cert-snakeoil.key"
61
+ default["postgresql"]["password_encryption"] = "on"
62
+ default["postgresql"]["db_user_namespace"] = "off"
63
+
64
+ # kerberos and gssapi
65
+ default["postgresql"]["db_user_namespace"] = "off"
66
+ default["postgresql"]["krb_server_keyfile"] = ""
67
+ default["postgresql"]["krb_srvname"] = "postgres"
68
+ default["postgresql"]["krb_caseins_users"] = "off"
69
+
70
+ # tcp keepalives
71
+ default["postgresql"]["tcp_keepalives_idle"] = 0
72
+ default["postgresql"]["tcp_keepalives_interval"] = 0
73
+ default["postgresql"]["tcp_keepalives_count"] = 0
74
+
75
+
76
+ #------------------------------------------------------------------------------
77
+ # RESOURCE USAGE (except WAL)
78
+ #------------------------------------------------------------------------------
79
+
80
+ # memory
81
+ default["postgresql"]["shared_buffers"] = "24MB"
82
+ default["postgresql"]["temp_buffers"] = "8MB"
83
+ default["postgresql"]["max_prepared_transactions"] = 0
84
+ default["postgresql"]["work_mem"] = "1MB"
85
+ default["postgresql"]["maintenance_work_mem"] = "16MB"
86
+ default["postgresql"]["max_stack_depth"] = "2MB"
87
+
88
+ # kernel resource usage
89
+ default["postgresql"]["max_files_per_process"] = 1000
90
+ default["postgresql"]["shared_preload_libraries"] = ""
91
+
92
+ # cost-based vacuum delay
93
+ default["postgresql"]["vacuum_cost_delay"] = "0ms"
94
+ default["postgresql"]["vacuum_cost_page_hit"] = 1
95
+ default["postgresql"]["vacuum_cost_page_miss"] = 10
96
+ default["postgresql"]["vacuum_cost_page_dirty"] = 20
97
+ default["postgresql"]["vacuum_cost_limit"] = 200
98
+
99
+ # background writer
100
+ default["postgresql"]["bgwriter_delay"] = "200ms"
101
+ default["postgresql"]["bgwriter_lru_maxpages"] = 100
102
+ default["postgresql"]["bgwriter_lru_multiplier"] = 2.0
103
+
104
+ # asynchronous behavior
105
+ default["postgresql"]["effective_io_concurrency"] = 1
106
+
107
+
108
+ #------------------------------------------------------------------------------
109
+ # WRITE AHEAD LOG
110
+ #------------------------------------------------------------------------------
111
+
112
+ # settings
113
+ default["postgresql"]["wal_level"] = "minimal"
114
+ default["postgresql"]["fsync"] = "on"
115
+ default["postgresql"]["synchronous_commit"] = "on"
116
+ default["postgresql"]["wal_sync_method"] = "fsync"
117
+ default["postgresql"]["full_page_writes"] = "on"
118
+ default["postgresql"]["wal_buffers"] = -1
119
+ default["postgresql"]["wal_writer_delay"] = "200ms"
120
+ default["postgresql"]["commit_delay"] = 0
121
+ default["postgresql"]["commit_siblings"] = 5
122
+
123
+ # checkpoints
124
+ default["postgresql"]["checkpoint_segments"] = 3
125
+ default["postgresql"]["checkpoint_timeout"] = "5min"
126
+ default["postgresql"]["checkpoint_completion_target"] = 0.5
127
+ default["postgresql"]["checkpoint_warning"] = "30s"
128
+
129
+ # archiving
130
+ default["postgresql"]["archive_mode"] = "off"
131
+ default["postgresql"]["archive_command"] = ""
132
+ default["postgresql"]["archive_timeout"] = 0
133
+
134
+
135
+ #------------------------------------------------------------------------------
136
+ # REPLICATION
137
+ #------------------------------------------------------------------------------
138
+
139
+ # master server
140
+ default["postgresql"]["max_wal_senders"] = 0
141
+ default["postgresql"]["wal_sender_delay"] = "1s"
142
+ default["postgresql"]["wal_keep_segments"] = 0
143
+ default["postgresql"]["vacuum_defer_cleanup_age"] = 0
144
+ default["postgresql"]["replication_timeout"] = "60s"
145
+ default["postgresql"]["synchronous_standby_names"] = ""
146
+
147
+ # standby servers
148
+ default["postgresql"]["hot_standby"] = "off"
149
+ default["postgresql"]["max_standby_archive_delay"] = "30s"
150
+ default["postgresql"]["max_standby_streaming_delay"] = "30s"
151
+ default["postgresql"]["wal_receiver_status_interval"] = "10s"
152
+ default["postgresql"]["hot_standby_feedback"] = "off"
153
+
154
+
155
+ #------------------------------------------------------------------------------
156
+ # QUERY TUNING
157
+ #------------------------------------------------------------------------------
158
+
159
+ # planner method configuration
160
+ default["postgresql"]["enable_bitmapscan"] = "on"
161
+ default["postgresql"]["enable_hashagg"] = "on"
162
+ default["postgresql"]["enable_hashjoin"] = "on"
163
+ default["postgresql"]["enable_indexscan"] = "on"
164
+ default["postgresql"]["enable_material"] = "on"
165
+ default["postgresql"]["enable_mergejoin"] = "on"
166
+ default["postgresql"]["enable_nestloop"] = "on"
167
+ default["postgresql"]["enable_seqscan"] = "on"
168
+ default["postgresql"]["enable_sort"] = "on"
169
+ default["postgresql"]["enable_tidscan"] = "on"
170
+
171
+ # planner cost constants
172
+ default["postgresql"]["seq_page_cost"] = 1.0
173
+ default["postgresql"]["random_page_cost"] = 4.0
174
+ default["postgresql"]["cpu_tuple_cost"] = 0.01
175
+ default["postgresql"]["cpu_index_tuple_cost"] = 0.005
176
+ default["postgresql"]["cpu_operator_cost"] = 0.0025
177
+ default["postgresql"]["effective_cache_size"] = "128MB"
178
+
179
+ # genetic query optimizer
180
+ default["postgresql"]["geqo"] = "on"
181
+ default["postgresql"]["geqo_threshold"] = 12
182
+ default["postgresql"]["geqo_effort"] = 5
183
+ default["postgresql"]["geqo_pool_size"] = 0
184
+ default["postgresql"]["geqo_generations"] = 0
185
+ default["postgresql"]["geqo_selection_bias"] = 2.0
186
+ default["postgresql"]["geqo_seed"] = 0.0
187
+
188
+ # other planner options
189
+ default["postgresql"]["default_statistics_target"] = 100
190
+ default["postgresql"]["constraint_exclusion"] = "partition"
191
+ default["postgresql"]["cursor_tuple_fraction"] = 0.1
192
+ default["postgresql"]["from_collapse_limit"] = 8
193
+ default["postgresql"]["join_collapse_limit"] = 8
194
+
195
+
196
+ #------------------------------------------------------------------------------
197
+ # ERROR REPORTING AND LOGGING
198
+ #------------------------------------------------------------------------------
199
+
200
+ # where to log
201
+ default["postgresql"]["log_destination"] = "stderr"
202
+ default["postgresql"]["logging_collector"] = "off"
203
+ default["postgresql"]["log_directory"] = "pg_log"
204
+ default["postgresql"]["log_filename"] = "postgresql-%Y-%m-%d_%H%M%S.log"
205
+ default["postgresql"]["log_file_mode"] = 0600
206
+ default["postgresql"]["log_truncate_on_rotation"] = "off"
207
+ default["postgresql"]["log_rotation_age"] = "1d"
208
+ default["postgresql"]["log_rotation_size"] = "10MB"
209
+
210
+ # These are relevant when logging to syslog:
211
+ default["postgresql"]["syslog_facility"] = "LOCAL0"
212
+ default["postgresql"]["syslog_ident"] = "postgres"
213
+ default["postgresql"]["silent_mode"] = "off"
214
+
215
+ # when to log
216
+ default["postgresql"]["client_min_messages"] = "notice"
217
+ default["postgresql"]["log_min_messages"] = "warning"
218
+ default["postgresql"]["log_min_error_statement"] = "error"
219
+ default["postgresql"]["log_min_duration_statement"] = -1
220
+
221
+ # what to log
222
+ default["postgresql"]["debug_print_parse"] = "off"
223
+ default["postgresql"]["debug_print_rewritten"] = "off"
224
+ default["postgresql"]["debug_print_plan"] = "off"
225
+ default["postgresql"]["debug_pretty_print"] = "on"
226
+ default["postgresql"]["log_checkpoints"] = "off"
227
+ default["postgresql"]["log_connections"] = "off"
228
+ default["postgresql"]["log_disconnections"] = "off"
229
+ default["postgresql"]["log_duration"] = "off"
230
+ default["postgresql"]["log_error_verbosity"] = "default"
231
+ default["postgresql"]["log_hostname"] = "off"
232
+ default["postgresql"]["log_line_prefix"] = "%t "
233
+ default["postgresql"]["log_lock_waits"] = "off"
234
+ default["postgresql"]["log_statement"] = "none"
235
+ default["postgresql"]["log_temp_files"] = -1
236
+ default["postgresql"]["log_timezone"] = "(defaults to server environment setting)"
237
+
238
+
239
+ #------------------------------------------------------------------------------
240
+ # RUNTIME STATISTICS
241
+ #------------------------------------------------------------------------------
242
+
243
+ # query/index statistics collector
244
+ default["postgresql"]["track_activities"] = "on"
245
+ default["postgresql"]["track_counts"] = "on"
246
+ default["postgresql"]["track_functions"] = "none"
247
+ default["postgresql"]["track_activity_query_size"] = 1024
248
+ default["postgresql"]["update_process_title"] = "on"
249
+ default["postgresql"]["stats_temp_directory"] = 'pg_stat_tmp'
250
+
251
+ # statistics monitoring
252
+ default["postgresql"]["log_parser_stats"] = "off"
253
+ default["postgresql"]["log_planner_stats"] = "off"
254
+ default["postgresql"]["log_executor_stats"] = "off"
255
+ default["postgresql"]["log_statement_stats"] = "off"
256
+
257
+
258
+ #------------------------------------------------------------------------------
259
+ # AUTOVACUUM PARAMETERS
260
+ #------------------------------------------------------------------------------
261
+
262
+ default["postgresql"]["autovacuum"] = "on"
263
+ default["postgresql"]["log_autovacuum_min_duration"] = -1
264
+ default["postgresql"]["autovacuum_max_workers"] = 3
265
+ default["postgresql"]["autovacuum_naptime"] = "1min"
266
+ default["postgresql"]["autovacuum_vacuum_threshold"] = 50
267
+ default["postgresql"]["autovacuum_analyze_threshold"] = 50
268
+ default["postgresql"]["autovacuum_vacuum_scale_factor"] = 0.2
269
+ default["postgresql"]["autovacuum_analyze_scale_factor"] = 0.1
270
+ default["postgresql"]["autovacuum_freeze_max_age"] = 200000000
271
+ default["postgresql"]["autovacuum_vacuum_cost_delay"] = "20ms"
272
+ default["postgresql"]["autovacuum_vacuum_cost_limit"] = -1
273
+
274
+
275
+ #------------------------------------------------------------------------------
276
+ # CLIENT CONNECTION DEFAULTS
277
+ #------------------------------------------------------------------------------
278
+
279
+ # statement behavior
280
+ default["postgresql"]["search_path"] = '"$user",public'
281
+ default["postgresql"]["default_tablespace"] = ""
282
+ default["postgresql"]["temp_tablespaces"] = ""
283
+ default["postgresql"]["check_function_bodies"] = "on"
284
+ default["postgresql"]["default_transaction_isolation"] = "read committed"
285
+ default["postgresql"]["default_transaction_read_only"] = "off"
286
+ default["postgresql"]["default_transaction_deferrable"] = "off"
287
+ default["postgresql"]["session_replication_role"] = "origin"
288
+ default["postgresql"]["statement_timeout"] = 0
289
+ default["postgresql"]["vacuum_freeze_min_age"] = 50000000
290
+ default["postgresql"]["vacuum_freeze_table_age"] = 150000000
291
+ default["postgresql"]["bytea_output"] = "hex"
292
+ default["postgresql"]["xmlbinary"] = "base64"
293
+ default["postgresql"]["xmloption"] = "content"
294
+
295
+ # locale and formatting
296
+ default["postgresql"]["datestyle"] = "iso, mdy"
297
+ default["postgresql"]["intervalstyle"] = "postgres"
298
+ default["postgresql"]["timezone"] = "(defaults to server environment setting)"
299
+ default["postgresql"]["timezone_abbreviations"] = "Default"
300
+ default["postgresql"]["extra_float_digits"] = 0
301
+ default["postgresql"]["client_encoding"] = "sql_ascii"
302
+
303
+ # These settings are initialized by initdb, but they can be changed.
304
+ default["postgresql"]["lc_messages"] = "en_US.UTF-8"
305
+ default["postgresql"]["lc_monetary"] = "en_US.UTF-8"
306
+ default["postgresql"]["lc_numeric"] = "en_US.UTF-8"
307
+ default["postgresql"]["lc_time"] = "en_US.UTF-8"
308
+
309
+ # default configuration for text search
310
+ default["postgresql"]["default_text_search_config"] = "pg_catalog.english"
311
+
312
+ # other defaults
313
+ default["postgresql"]["dynamic_library_path"] = "$libdir"
314
+ default["postgresql"]["local_preload_libraries"] = ""
315
+
316
+
317
+ #------------------------------------------------------------------------------
318
+ # LOCK MANAGEMENT
319
+ #------------------------------------------------------------------------------
320
+
321
+ default["postgresql"]["deadlock_timeout"] = "1s"
322
+ default["postgresql"]["max_locks_per_transaction"] = 64
323
+ default["postgresql"]["max_pred_locks_per_transaction"] = 64
324
+
325
+
326
+ #------------------------------------------------------------------------------
327
+ # VERSION/PLATFORM COMPATIBILITY
328
+ #------------------------------------------------------------------------------
329
+
330
+ # previous postgresql versions
331
+ default["postgresql"]["array_nulls"] = "on"
332
+ default["postgresql"]["backslash_quote"] = "safe_encoding"
333
+ default["postgresql"]["default_with_oids"] = "off"
334
+ default["postgresql"]["escape_string_warning"] = "on"
335
+ default["postgresql"]["lo_compat_privileges"] = "off"
336
+ default["postgresql"]["quote_all_identifiers"] = "off"
337
+ default["postgresql"]["sql_inheritance"] = "on"
338
+ default["postgresql"]["standard_conforming_strings"] = "on"
339
+ default["postgresql"]["synchronize_seqscans"] = "on"
340
+
341
+ # other platforms and clients
342
+ default["postgresql"]["transform_null_equals"] = "off"
343
+
344
+
345
+ #------------------------------------------------------------------------------
346
+ # ERROR HANDLING
347
+ #------------------------------------------------------------------------------
348
+
349
+ default["postgresql"]["exit_on_error"] = "off"
350
+ default["postgresql"]["restart_after_crash"] = "on"
351
+
352
+
353
+ #------------------------------------------------------------------------------
354
+ # USERS AND DATABASES
355
+ #------------------------------------------------------------------------------
356
+
357
+ default["postgresql"]["users"] = []
358
+ default["postgresql"]["databases"] = []
359
+
360
+
361
+ #------------------------------------------------------------------------------
362
+ # CUSTOMIZED OPTIONS
363
+ #------------------------------------------------------------------------------
364
+
365
+ default["postgresql"]["custom_variable_classes"] = ""
@@ -0,0 +1,61 @@
1
+ define :pg_database, :action => :create do
2
+
3
+ defaults = {
4
+ :user => "postgres",
5
+ :username => nil,
6
+ :host => nil,
7
+ :port => nil,
8
+ :encoding => "utf8",
9
+ :locale => nil,
10
+ :template => nil,
11
+ :owner => nil,
12
+ }
13
+
14
+ defaults.merge! params
15
+
16
+ exists = ["psql"]
17
+ exists.push "-c \"SELECT datname from pg_database WHERE datname='#{params[:name]}'\""
18
+ exists.push "--host #{defaults[:host]}" if defaults[:host]
19
+ exists.push "--port #{defaults[:port]}" if defaults[:port]
20
+ exists.push "| grep #{params[:name]}"
21
+
22
+ exists = exists.join ' '
23
+
24
+ case params[:action]
25
+ when :create
26
+ createdb = ["createdb"]
27
+ createdb.push "-U #{defaults[:username]}" if defaults[:username]
28
+ createdb.push "-E #{defaults[:encoding]}" if defaults[:encoding]
29
+ createdb.push "--locale #{defaults[:locale]}" if defaults[:locale]
30
+ createdb.push "-T #{defaults[:template]}" if defaults[:template]
31
+ createdb.push "--host #{defaults[:host]}" if defaults[:host]
32
+ createdb.push "--port #{defaults[:port]}" if defaults[:port]
33
+ createdb.push "-O #{defaults[:owner]}" if defaults[:owner]
34
+
35
+ createdb.push params[:name]
36
+
37
+ createdb = createdb.join ' '
38
+
39
+ execute "creating pg database #{params[:name]}" do
40
+ user defaults[:user]
41
+ command createdb
42
+ not_if exists, :user => defaults[:user]
43
+ end
44
+
45
+ when :drop
46
+ dropdb = ["dropdb"]
47
+ dropdb.push "-U #{defaults[:username]}" if defaults[:username]
48
+ dropdb.push "--host #{defaults[:host]}" if defaults[:host]
49
+ dropdb.push "--port #{defaults[:port]}" if defaults[:port]
50
+
51
+ dropdb.push params[:name]
52
+
53
+ dropdb = dropdb.join ' '
54
+
55
+ execute "dropping pg database #{params[:name]}" do
56
+ user defaults[:user]
57
+ command dropdb
58
+ only_if exists, :user => defaults[:user]
59
+ end
60
+ end
61
+ end