Class: Webhookdb::Postgres::Maintenance::Command
- Inherits:
-
Base
- Object
- Base
- Webhookdb::Postgres::Maintenance::Command
show all
- Defined in:
- lib/webhookdb/postgres/maintenance.rb
Direct Known Subclasses
Repack
Instance Attribute Summary
Attributes inherited from Base
#service_integration
Instance Method Summary
collapse
Methods inherited from Base
#conn_params, #debug?, #initialize
Instance Method Details
#command_list ⇒ Object
72
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 72
def command_list = raise NotImplementedError
|
#command_strings ⇒ Object
96
97
98
99
100
101
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 96
def command_strings
c = []
c << self.shelex(self.create_extension_command_list) if self.extension
c << self.shelex(self.command_list)
return c
end
|
#create_extension_command_list ⇒ Object
88
89
90
91
92
93
94
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 88
def create_extension_command_list
a = ["PGPASSWORD=#{self.conn_params[:password]}", "psql"]
a += self.psql_conn_params
a << "-c"
a << "'CREATE EXTENSION IF NOT EXISTS #{self.extension}'"
return a
end
|
#docker_image ⇒ Object
73
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 73
def docker_image = raise NotImplementedError
|
#docker_preamble ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 76
def docker_preamble
return [
"docker",
"run",
"-e",
"PGPASSWORD=#{self.conn_params[:password]}",
"-it",
"--rm",
self.docker_image,
]
end
|
#extension ⇒ Object
74
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 74
def extension = nil
|
#psql_conn_params ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 61
def psql_conn_params
h = self.conn_params
return [
"--no-password",
"-U", h[:user],
"-h", h[:host],
"-p", h[:port],
"--dbname", h[:database],
]
end
|
#shelex(a) ⇒ Object
103
104
105
|
# File 'lib/webhookdb/postgres/maintenance.rb', line 103
def shelex(a)
return a.join(" ")
end
|