crowbar-client 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +7 -0
- data/lib/crowbar/client/app.rb +3 -0
- data/lib/crowbar/client/app/database.rb +220 -0
- data/lib/crowbar/client/app/entry.rb +4 -0
- data/lib/crowbar/client/app/upgrade.rb +4 -4
- data/lib/crowbar/client/command.rb +3 -0
- data/lib/crowbar/client/command/database.rb +35 -0
- data/lib/crowbar/client/command/database/connect.rb +59 -0
- data/lib/crowbar/client/command/database/create.rb +56 -0
- data/lib/crowbar/client/command/database/test.rb +59 -0
- data/lib/crowbar/client/command/upgrade/prechecks.rb +28 -4
- data/lib/crowbar/client/mixin/database.rb +1 -1
- data/lib/crowbar/client/request.rb +3 -0
- data/lib/crowbar/client/request/database.rb +35 -0
- data/lib/crowbar/client/request/database/connect.rb +78 -0
- data/lib/crowbar/client/request/database/create.rb +75 -0
- data/lib/crowbar/client/request/database/test.rb +78 -0
- data/lib/crowbar/client/request/upgrade/backup.rb +2 -2
- data/lib/crowbar/client/version.rb +1 -1
- data/spec/crowbar/client/command/database/connect_spec.rb +31 -0
- data/spec/crowbar/client/command/database/create_spec.rb +31 -0
- data/spec/crowbar/client/command/database/test_spec.rb +31 -0
- data/spec/crowbar/client/request/database/connect_spec.rb +62 -0
- data/spec/crowbar/client/request/database/create_spec.rb +56 -0
- data/spec/crowbar/client/request/database/test_spec.rb +62 -0
- data/spec/spec_helper.rb +0 -1
- metadata +55 -35
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZThlYjkwYWRkMmVhOWZjNjMyZGU4OTkwM2JiZDI2N2RkYzE0MDM5MQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67b522e56f1722b1a071200b46b86f0313a58ccc
|
4
|
+
data.tar.gz: 5112008338561b41b1e53dd419158d3e0b94e556
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MzUwNjVlNWY4ZGQwOWU5MmFhZjk4YjIyMDcwMzUxMWUyMTE0ZjhlYzJhOTE2
|
11
|
-
YzFiYTNjMDM0OGRkYjg5OGYwMDg2NWI4M2NjMjczNjk5ZTRiNGI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTAyMzA2ZjBmNTRkMmMzYTZlOTNmOTI3ZWMzMDZiMjM4MzAxYTg2YTNlNzZi
|
14
|
-
Mzg3OGE0MjEwYzVlZGYxOTRmODk1ZjA1MzEwMmMzM2VjNzg1YjQ4ZWQzNzQ2
|
15
|
-
ODhhMGM1OWE5OWNiOTE5MDQ2OTJkMTU5OTgwMmI4NTRhZGJhNTE=
|
6
|
+
metadata.gz: 2c4c4877c600883ec6e62e8c9de99d2c8def38e4715e0ff7c6bd64da0c6d20ae0b280e6e49ff01312be85580a6a4611aad881233a01e0ba6629346df1a407246
|
7
|
+
data.tar.gz: 11ccc7610a80b03102f42c320fc6d7b9c060e8da676d89e5d999d7c1202b62d8f77cd1627b78b801cdacdebd75a89648a2f52971f1f942fcdc8403a713263c89
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.1.4](https://github.com/crowbar/crowbar-client/releases/tag/v3.1.4) - 2016-11-14
|
4
|
+
|
5
|
+
* ENHANCEMENT
|
6
|
+
* Add database subcommand for fresh cloud installations (@MaximilianMeister)
|
7
|
+
* Update database parameter validations (@MaximilianMeister)
|
8
|
+
* Adapting request url's to various API changes (@MaximilianMeister)
|
9
|
+
|
3
10
|
## [3.1.3](https://github.com/crowbar/crowbar-client/releases/tag/v3.1.3) - 2016-10-18
|
4
11
|
|
5
12
|
* BUGFIX
|
data/lib/crowbar/client/app.rb
CHANGED
@@ -0,0 +1,220 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, SUSE Linux GmbH
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Crowbar
|
18
|
+
module Client
|
19
|
+
module App
|
20
|
+
#
|
21
|
+
# A Thor based CLI wrapper for batch commands
|
22
|
+
#
|
23
|
+
class Database < Base
|
24
|
+
desc "create",
|
25
|
+
"Create a new Crowbar database"
|
26
|
+
|
27
|
+
long_desc <<-LONGDESC
|
28
|
+
`create` will set up a new Crowbar database before Crowbar installation.
|
29
|
+
This command only works if Crowbar is not yet installed.
|
30
|
+
LONGDESC
|
31
|
+
|
32
|
+
method_option :db_username,
|
33
|
+
type: :string,
|
34
|
+
default: "crowbar",
|
35
|
+
banner: "<db_username>",
|
36
|
+
desc: "Username for the Crowbar database user
|
37
|
+
Min length: 4
|
38
|
+
Max length: 63
|
39
|
+
Only alphanumeric characters and/or underscores
|
40
|
+
Must begin with a letter [a-zA-Z] or underscore"
|
41
|
+
|
42
|
+
method_option :db_password,
|
43
|
+
type: :string,
|
44
|
+
default: "crowbar",
|
45
|
+
banner: "<db_password>",
|
46
|
+
desc: "Password for the Crowbar database password
|
47
|
+
Min length: 4
|
48
|
+
Max length: 63
|
49
|
+
Alphanumeric and special characters
|
50
|
+
Must begin with any alphanumeric character or underscore"
|
51
|
+
|
52
|
+
#
|
53
|
+
# Database create command
|
54
|
+
#
|
55
|
+
# it will set up a new Crowbar database before Crowbar installation.
|
56
|
+
# This command only works if Crowbar is not yet installed.
|
57
|
+
#
|
58
|
+
# @return [String] a formatted response from the server
|
59
|
+
#
|
60
|
+
def create
|
61
|
+
Command::Database::Create.new(
|
62
|
+
*command_params
|
63
|
+
).execute
|
64
|
+
rescue => e
|
65
|
+
catch_errors(e)
|
66
|
+
end
|
67
|
+
|
68
|
+
desc "connect",
|
69
|
+
"Connect to a remote Crowbar database"
|
70
|
+
|
71
|
+
long_desc <<-LONGDESC
|
72
|
+
`connect` will connect to a remote Crowbar database before Crowbar installation.
|
73
|
+
This command only works if Crowbar is not yet installed.
|
74
|
+
LONGDESC
|
75
|
+
|
76
|
+
method_option :db_username,
|
77
|
+
type: :string,
|
78
|
+
default: "crowbar",
|
79
|
+
banner: "<db_username>",
|
80
|
+
desc: "Username for the Crowbar database user
|
81
|
+
Min length: 4
|
82
|
+
Max length: 63
|
83
|
+
Only alphanumeric characters and/or underscores
|
84
|
+
Must begin with a letter [a-zA-Z] or underscore"
|
85
|
+
|
86
|
+
method_option :db_password,
|
87
|
+
type: :string,
|
88
|
+
default: "crowbar",
|
89
|
+
banner: "<db_password>",
|
90
|
+
desc: "Password for the Crowbar database password
|
91
|
+
Min length: 4
|
92
|
+
Max length: 63
|
93
|
+
Alphanumeric and special characters
|
94
|
+
Must begin with any alphanumeric character or underscore"
|
95
|
+
|
96
|
+
method_option :database,
|
97
|
+
type: :string,
|
98
|
+
default: "crowbar_production",
|
99
|
+
banner: "<database>",
|
100
|
+
desc: "Name of the Crowbar database
|
101
|
+
Min length: 4
|
102
|
+
Max length: 63
|
103
|
+
Alphanumeric characters and underscores
|
104
|
+
Must begin with any alphanumeric character or underscore"
|
105
|
+
|
106
|
+
method_option :host,
|
107
|
+
type: :string,
|
108
|
+
default: "localhost",
|
109
|
+
banner: "<host>",
|
110
|
+
desc: "Host of the Crowbar database
|
111
|
+
Min length: 4
|
112
|
+
Max length: 253
|
113
|
+
Numbers and period characters (only IPv4)
|
114
|
+
Hostnames/FQDNs:
|
115
|
+
alphanumeric characters, hyphens and dots
|
116
|
+
cannot start/end with digits or hyphen"
|
117
|
+
|
118
|
+
method_option :port,
|
119
|
+
type: :string,
|
120
|
+
default: "5432",
|
121
|
+
banner: "<port>",
|
122
|
+
desc: "Port of the Crowbar database
|
123
|
+
Min length: 1
|
124
|
+
Max length: 5
|
125
|
+
Only numbers"
|
126
|
+
|
127
|
+
#
|
128
|
+
# Database connect command
|
129
|
+
#
|
130
|
+
# it will connect to a remote Crowbar database before Crowbar installation.
|
131
|
+
# This command only works if Crowbar is not yet installed.
|
132
|
+
#
|
133
|
+
# @return [String] a formatted response from the server
|
134
|
+
#
|
135
|
+
def connect
|
136
|
+
Command::Database::Connect.new(
|
137
|
+
*command_params
|
138
|
+
).execute
|
139
|
+
rescue => e
|
140
|
+
catch_errors(e)
|
141
|
+
end
|
142
|
+
|
143
|
+
desc "test",
|
144
|
+
"Test the connection to a remote Crowbar database"
|
145
|
+
|
146
|
+
long_desc <<-LONGDESC
|
147
|
+
`test` will test the connection to a remote Crowbar database before Crowbar installation.
|
148
|
+
This command only works if Crowbar is not yet installed.
|
149
|
+
LONGDESC
|
150
|
+
|
151
|
+
method_option :db_username,
|
152
|
+
type: :string,
|
153
|
+
default: "crowbar",
|
154
|
+
banner: "<db_username>",
|
155
|
+
desc: "Username for the Crowbar database user
|
156
|
+
Min length: 4
|
157
|
+
Max length: 63
|
158
|
+
Only alphanumeric characters and/or underscores
|
159
|
+
Must begin with a letter [a-zA-Z] or underscore"
|
160
|
+
|
161
|
+
method_option :db_password,
|
162
|
+
type: :string,
|
163
|
+
default: "crowbar",
|
164
|
+
banner: "<db_password>",
|
165
|
+
desc: "Password for the Crowbar database password
|
166
|
+
Min length: 4
|
167
|
+
Max length: 63
|
168
|
+
Alphanumeric and special characters
|
169
|
+
Must begin with any alphanumeric character or underscore"
|
170
|
+
|
171
|
+
method_option :database,
|
172
|
+
type: :string,
|
173
|
+
default: "crowbar_production",
|
174
|
+
banner: "<database>",
|
175
|
+
desc: "Name of the Crowbar database
|
176
|
+
Min length: 4
|
177
|
+
Max length: 63
|
178
|
+
Alphanumeric characters and underscores
|
179
|
+
Must begin with any alphanumeric character or underscore"
|
180
|
+
|
181
|
+
method_option :host,
|
182
|
+
type: :string,
|
183
|
+
default: "localhost",
|
184
|
+
banner: "<host>",
|
185
|
+
desc: "Host of the Crowbar database
|
186
|
+
Min length: 4
|
187
|
+
Max length: 253
|
188
|
+
Numbers and period characters (only IPv4)
|
189
|
+
Hostnames/FQDNs:
|
190
|
+
alphanumeric characters, hyphens and dots
|
191
|
+
cannot start/end with digits or hyphen"
|
192
|
+
|
193
|
+
method_option :port,
|
194
|
+
type: :string,
|
195
|
+
default: "5432",
|
196
|
+
banner: "<port>",
|
197
|
+
desc: "Port of the Crowbar database
|
198
|
+
Min length: 1
|
199
|
+
Max length: 5
|
200
|
+
Only numbers"
|
201
|
+
|
202
|
+
#
|
203
|
+
# Database test command
|
204
|
+
#
|
205
|
+
# it will test the connection to a remote Crowbar database before Crowbar installation.
|
206
|
+
# This command only works if Crowbar is not yet installed.
|
207
|
+
#
|
208
|
+
# @return [String] a formatted response from the server
|
209
|
+
#
|
210
|
+
def test
|
211
|
+
Command::Database::Test.new(
|
212
|
+
*command_params
|
213
|
+
).execute
|
214
|
+
rescue => e
|
215
|
+
catch_errors(e)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
@@ -152,6 +152,10 @@ module Crowbar
|
|
152
152
|
desc "upgrade [COMMANDS]",
|
153
153
|
"Upgrade specific commands, call without params for help"
|
154
154
|
subcommand "upgrade", Crowbar::Client::App::Upgrade
|
155
|
+
|
156
|
+
desc "database [COMMANDS]",
|
157
|
+
"Database specific commands, call without params for help"
|
158
|
+
subcommand "database", Crowbar::Client::App::Database
|
155
159
|
end
|
156
160
|
end
|
157
161
|
end
|
@@ -321,7 +321,7 @@ module Crowbar
|
|
321
321
|
desc: "Name of the Crowbar database
|
322
322
|
Min length: 4
|
323
323
|
Max length: 63
|
324
|
-
Alphanumeric and
|
324
|
+
Alphanumeric characters and underscores
|
325
325
|
Must begin with any alphanumeric character or underscore"
|
326
326
|
|
327
327
|
method_option :host,
|
@@ -330,10 +330,10 @@ module Crowbar
|
|
330
330
|
banner: "<host>",
|
331
331
|
desc: "Host of the Crowbar database
|
332
332
|
Min length: 4
|
333
|
-
Max length:
|
333
|
+
Max length: 253
|
334
334
|
Numbers and period characters (only IPv4)
|
335
|
-
Hostnames:
|
336
|
-
alphanumeric characters and hyphens
|
335
|
+
Hostnames/FQDNs:
|
336
|
+
alphanumeric characters, dots and hyphens
|
337
337
|
cannot start/end with digits or hyphen"
|
338
338
|
|
339
339
|
method_option :port,
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, SUSE Linux GmbH
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Crowbar
|
18
|
+
module Client
|
19
|
+
module Command
|
20
|
+
#
|
21
|
+
# Module for the database command implementations
|
22
|
+
#
|
23
|
+
module Database
|
24
|
+
autoload :Connect,
|
25
|
+
File.expand_path("../database/connect", __FILE__)
|
26
|
+
|
27
|
+
autoload :Create,
|
28
|
+
File.expand_path("../database/create", __FILE__)
|
29
|
+
|
30
|
+
autoload :Test,
|
31
|
+
File.expand_path("../database/test", __FILE__)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, SUSE Linux GmbH
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Command
|
22
|
+
module Database
|
23
|
+
#
|
24
|
+
# Implementation for the database connect command
|
25
|
+
#
|
26
|
+
class Connect < Base
|
27
|
+
include Mixin::Database
|
28
|
+
|
29
|
+
def args_with_options
|
30
|
+
args.easy_merge!(
|
31
|
+
username: options.db_username,
|
32
|
+
password: options.db_password,
|
33
|
+
database: options.database,
|
34
|
+
host: options.host,
|
35
|
+
port: options.port
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def request
|
40
|
+
@request ||= Request::Database::Connect.new(
|
41
|
+
args_with_options
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def execute
|
46
|
+
request.process do |request|
|
47
|
+
case request.code
|
48
|
+
when 200
|
49
|
+
say "Successfully connected to database"
|
50
|
+
else
|
51
|
+
err request.parsed_response["error"]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, SUSE Linux GmbH
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Command
|
22
|
+
module Database
|
23
|
+
#
|
24
|
+
# Implementation for the database create command
|
25
|
+
#
|
26
|
+
class Create < Base
|
27
|
+
include Mixin::Database
|
28
|
+
|
29
|
+
def args_with_options
|
30
|
+
args.easy_merge!(
|
31
|
+
username: options.db_username,
|
32
|
+
password: options.db_password
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def request
|
37
|
+
@request ||= Request::Database::Create.new(
|
38
|
+
args_with_options
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def execute
|
43
|
+
request.process do |request|
|
44
|
+
case request.code
|
45
|
+
when 200
|
46
|
+
say "Successfully created database"
|
47
|
+
else
|
48
|
+
err request.parsed_response["error"]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|