crowbar-client 3.1.0 → 3.1.1
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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +9 -0
- data/lib/crowbar/client.rb +9 -0
- data/lib/crowbar/client/app/upgrade.rb +88 -6
- data/lib/crowbar/client/command/upgrade.rb +3 -0
- data/lib/crowbar/client/command/upgrade/database.rb +79 -0
- data/lib/crowbar/client/config.rb +1 -1
- data/lib/crowbar/client/mixin.rb +3 -0
- data/lib/crowbar/client/mixin/database.rb +73 -0
- data/lib/crowbar/client/request/upgrade.rb +3 -0
- data/lib/crowbar/client/request/upgrade/backup.rb +2 -0
- data/lib/crowbar/client/request/upgrade/database.rb +85 -0
- data/lib/crowbar/client/request/upgrade/repocheck.rb +5 -5
- data/lib/crowbar/client/util/apiversion.rb +16 -0
- data/lib/crowbar/client/version.rb +1 -1
- data/spec/crowbar/client/command/upgrade/database_spec.rb +34 -0
- data/spec/crowbar/client/command/upgrade/repocheck_spec.rb +4 -4
- data/spec/crowbar/client/request/upgrade/database_spec.rb +66 -0
- data/spec/crowbar/client/request/upgrade/repocheck_spec.rb +3 -3
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDA1YWE1MmY0ZDQxNzNiNjA4ZTg2MTc3ZjgxMTYzZTg2OWRmNDVkYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWU2MTU5ZDIzYTdkNzg3MDhjNGQ5ZDQwMTcwM2I5MmZhZjNkMzc5NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmE4ZWFlZTcwZTlhNWM0N2M1MWQ5NDQ2M2NlMGI2Mjg4ZTYxMTcyYzk3YmUx
|
10
|
+
NzdkNmM5NjY2YzJjNjE1ZWQ4NTI3ZTdhMTg2Y2E4ZjIxYjJmYmQxMjVjYzlk
|
11
|
+
ODJiYTdiZTI3NjhmMTcwODE4ZWQyNTM0MTcyNDFiNjMyNjk3MmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmFiODI3M2YxMjI4ZjgzZTE0ZmI4YTA5NGVmOTJhZDAzYTA1ZDIxMzIyNDZm
|
14
|
+
NGE2ZTIyNzJkYWU4YTBkYjA5Y2VhYzY2ZTM0OGY3MzQyNThmOGFlMzQ0NjI4
|
15
|
+
OTM4YzM2OGU4M2JhOWNlZjg4YjFkYjA0MWIxOWZhNWUyNWIyYTg=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.1.1](https://github.com/crowbar/crowbar-client/releases/tag/v3.1.1) - 2016-09-16
|
4
|
+
|
5
|
+
* BUGFIX
|
6
|
+
* Use the new API version by default on SP2 (@rsalevsky)
|
7
|
+
* ENHANCEMENT
|
8
|
+
* Add upgrade database subcommand (@MaximilianMeister)
|
9
|
+
* Add upgrade admin server repocheck subcommand (@MaximilianMeister)
|
10
|
+
* Drop ha and ceph repocheck in favor of nodes repocheck (@MaximilianMeister)
|
11
|
+
|
3
12
|
## [3.1.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.1.0) - 2016-08-23
|
4
13
|
|
5
14
|
* BUGFIX
|
data/lib/crowbar/client.rb
CHANGED
@@ -115,6 +115,15 @@ module Crowbar
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
+
#
|
119
|
+
# Error class to catch invalid database parameters
|
120
|
+
#
|
121
|
+
class InvalidDatabaseParameterError < SimpleCatchableError
|
122
|
+
def initialize(field)
|
123
|
+
super("#{field.capitalize} is not valid. Please check <database subcommand> help")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
118
127
|
autoload :App,
|
119
128
|
File.expand_path("../client/app", __FILE__)
|
120
129
|
|
@@ -219,12 +219,19 @@ module Crowbar
|
|
219
219
|
catch_errors(e)
|
220
220
|
end
|
221
221
|
|
222
|
-
desc "repocheck
|
223
|
-
"Check for existing repositories for
|
222
|
+
desc "repocheck COMPONENT",
|
223
|
+
"Check for existing repositories for a component (crowbar|nodes)"
|
224
224
|
|
225
225
|
long_desc <<-LONGDESC
|
226
|
-
`repocheck
|
227
|
-
for a
|
226
|
+
`repocheck COMPONENT` will check for existing repositories
|
227
|
+
for a specific component. COMPONENT can be 'crowbar' or 'nodes'
|
228
|
+
|
229
|
+
crowbar: checks for the repositories required to upgrade the crowbar
|
230
|
+
server
|
231
|
+
|
232
|
+
nodes: checks for the repositories required to upgrade the nodes, plus
|
233
|
+
an optional check if the SUSE Enterprise Storage or/and the SUSE Linux
|
234
|
+
Enterprise High Availability Addon is installed
|
228
235
|
|
229
236
|
With --format <format> option you can choose an output format
|
230
237
|
with the available options table, json or plain. You can also
|
@@ -265,10 +272,85 @@ module Crowbar
|
|
265
272
|
banner: "<filter>",
|
266
273
|
desc: "Filter by criteria, display only data that contains filter"
|
267
274
|
|
268
|
-
def repocheck(
|
275
|
+
def repocheck(component)
|
269
276
|
Command::Upgrade::Repocheck.new(
|
270
277
|
*command_params(
|
271
|
-
|
278
|
+
component: component
|
279
|
+
)
|
280
|
+
).execute
|
281
|
+
rescue => e
|
282
|
+
catch_errors(e)
|
283
|
+
end
|
284
|
+
|
285
|
+
desc "database MODE",
|
286
|
+
"Initialize Crowbar database"
|
287
|
+
|
288
|
+
long_desc <<-LONGDESC
|
289
|
+
`database MODE` will set up the Crowbar database and perform the necessary migrations
|
290
|
+
|
291
|
+
MODE can be either 'new' or 'connect'
|
292
|
+
|
293
|
+
'new': Create a new PostgreSQL database and migrate the old data
|
294
|
+
|
295
|
+
'connect': Connect to a remote PostgreSQL database and migrate the old data
|
296
|
+
|
297
|
+
LONGDESC
|
298
|
+
|
299
|
+
method_option :db_username,
|
300
|
+
type: :string,
|
301
|
+
default: "crowbar",
|
302
|
+
banner: "<db_username>",
|
303
|
+
desc: "Username for the Crowbar database user
|
304
|
+
Min length: 4
|
305
|
+
Max length: 63
|
306
|
+
Only alphanumeric characters or underscores
|
307
|
+
Must begin with a letter [a-zA-Z] or underscore"
|
308
|
+
|
309
|
+
method_option :db_password,
|
310
|
+
type: :string,
|
311
|
+
default: "crowbar",
|
312
|
+
banner: "<db_password>",
|
313
|
+
desc: "Password for the Crowbar database password
|
314
|
+
Min length: 4
|
315
|
+
Max length: 63
|
316
|
+
Alphanumeric and special characters
|
317
|
+
Must begin with any alphanumeric character or underscore"
|
318
|
+
|
319
|
+
method_option :database,
|
320
|
+
type: :string,
|
321
|
+
default: "crowbar_production",
|
322
|
+
banner: "<database>",
|
323
|
+
desc: "Name of the Crowbar database
|
324
|
+
Min length: 4
|
325
|
+
Max length: 63
|
326
|
+
Alphanumeric and special characters
|
327
|
+
Must begin with any alphanumeric character or underscore"
|
328
|
+
|
329
|
+
method_option :host,
|
330
|
+
type: :string,
|
331
|
+
default: "localhost",
|
332
|
+
banner: "<host>",
|
333
|
+
desc: "Host of the Crowbar database
|
334
|
+
Min length: 4
|
335
|
+
Max length: 63
|
336
|
+
Numbers and period characters (only IPv4)
|
337
|
+
Hostnames:
|
338
|
+
alphanumeric characters and hyphens
|
339
|
+
cannot start/end with digits or hyphen"
|
340
|
+
|
341
|
+
method_option :port,
|
342
|
+
type: :string,
|
343
|
+
default: "5432",
|
344
|
+
banner: "<port>",
|
345
|
+
desc: "Port of the Crowbar database
|
346
|
+
Min length: 1
|
347
|
+
Max length: 5
|
348
|
+
Only numbers"
|
349
|
+
|
350
|
+
def database(mode)
|
351
|
+
Command::Upgrade::Database.new(
|
352
|
+
*command_params(
|
353
|
+
mode: mode
|
272
354
|
)
|
273
355
|
).execute
|
274
356
|
rescue => e
|
@@ -0,0 +1,79 @@
|
|
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 Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade Database command
|
25
|
+
#
|
26
|
+
class Database < 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::Upgrade::Database.new(
|
41
|
+
args_with_options
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def execute
|
46
|
+
validate_params!(args_with_options)
|
47
|
+
|
48
|
+
request.process do |request|
|
49
|
+
response = JSON.parse(request.body)
|
50
|
+
|
51
|
+
case request.code
|
52
|
+
when !200
|
53
|
+
err request.parsed_response["error"]
|
54
|
+
end
|
55
|
+
|
56
|
+
steps_with_messages.each do |step, message|
|
57
|
+
next if response[step.to_s]["success"]
|
58
|
+
err "Failed to #{message}"
|
59
|
+
end
|
60
|
+
|
61
|
+
say "Successfully initialized Crowbar"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
|
67
|
+
def steps_with_messages
|
68
|
+
{
|
69
|
+
database_setup: "Setup the Crowbar database",
|
70
|
+
database_migration: "Migrate the Crowbar database",
|
71
|
+
schema_migration: "Migrate the schemas",
|
72
|
+
crowbar_init: "Initialize Crowbar"
|
73
|
+
}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/crowbar/client/mixin.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
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 "active_support/concern"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Mixin
|
22
|
+
#
|
23
|
+
# A mixin with barclamp related helpers
|
24
|
+
#
|
25
|
+
module Database
|
26
|
+
extend ActiveSupport::Concern
|
27
|
+
|
28
|
+
REGEX_HOSTNAME = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$".freeze
|
29
|
+
REGEX_IPV4 = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$".freeze
|
30
|
+
REGEX_USERNAME = "(?=^.{4,63}$)(?=^[a-zA-Z0-9_]*$)".freeze
|
31
|
+
REGEX_PASSWORD = "(?=^.{4,63}$)(?=^[a-zA-Z0-9_]*$)(?=[a-zA-Z0-9_$&+,:;=?@#|'<>.^*()%!-]*$)".freeze
|
32
|
+
REGEX_DATABASE = "(?=^.{1,63}$)(?=^[a-zA-Z0-9_]*$)(?=[a-zA-Z0-9_$&+,:;=?@#|'<>.^*()%!-]*$)".freeze
|
33
|
+
REGEX_PORT = "(?=^.{1,5}$)(?=^[0-9]*$)".freeze
|
34
|
+
|
35
|
+
included do
|
36
|
+
def validate_params!(params)
|
37
|
+
fields.each do |field|
|
38
|
+
next if valid?(field, params.send(field))
|
39
|
+
raise InvalidDatabaseParameterError, field
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def valid?(field, value)
|
44
|
+
case field
|
45
|
+
when :username
|
46
|
+
!value.match(/#{REGEX_USERNAME}/).nil?
|
47
|
+
when :password
|
48
|
+
!value.match(/#{REGEX_PASSWORD}/).nil?
|
49
|
+
when :database
|
50
|
+
!value.match(/#{REGEX_DATABASE}/).nil?
|
51
|
+
when :host
|
52
|
+
!value.match(/#{REGEX_HOSTNAME}|#{REGEX_IPV4}/).nil?
|
53
|
+
when :port
|
54
|
+
!value.match(/#{REGEX_PORT}/).nil?
|
55
|
+
else
|
56
|
+
false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def fields
|
61
|
+
[
|
62
|
+
:username,
|
63
|
+
:password,
|
64
|
+
:database,
|
65
|
+
:host,
|
66
|
+
:port
|
67
|
+
]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,85 @@
|
|
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 Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade prepare request
|
25
|
+
#
|
26
|
+
class Database < Base
|
27
|
+
#
|
28
|
+
# Override the request headers
|
29
|
+
#
|
30
|
+
# @return [Hash] the headers for the request
|
31
|
+
#
|
32
|
+
def headers
|
33
|
+
super.easy_merge!(
|
34
|
+
::Crowbar::Client::Util::ApiVersion.new(2.0).headers
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Override the request content
|
40
|
+
#
|
41
|
+
# @return [Hash] the content for the request
|
42
|
+
#
|
43
|
+
def content
|
44
|
+
super.easy_merge!(
|
45
|
+
username: attrs.username,
|
46
|
+
password: attrs.password,
|
47
|
+
database: attrs.database,
|
48
|
+
host: attrs.host,
|
49
|
+
port: attrs.port
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# HTTP method that gets used by the request
|
55
|
+
#
|
56
|
+
# @return [Symbol] the method for the request
|
57
|
+
#
|
58
|
+
def method
|
59
|
+
:post
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Path to the API endpoint for the request
|
64
|
+
#
|
65
|
+
# @return [String] path to the API endpoint
|
66
|
+
#
|
67
|
+
def url
|
68
|
+
case attrs.mode
|
69
|
+
when "connect"
|
70
|
+
[
|
71
|
+
"upgrade",
|
72
|
+
"connect"
|
73
|
+
].join("/")
|
74
|
+
when "new"
|
75
|
+
[
|
76
|
+
"upgrade",
|
77
|
+
"new"
|
78
|
+
].join("/")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -50,17 +50,17 @@ module Crowbar
|
|
50
50
|
# @return [String] path to the API endpoint
|
51
51
|
#
|
52
52
|
def url
|
53
|
-
case attrs.
|
54
|
-
when "
|
53
|
+
case attrs.component
|
54
|
+
when "crowbar"
|
55
55
|
[
|
56
56
|
"api",
|
57
|
-
"
|
57
|
+
"crowbar",
|
58
58
|
"repocheck"
|
59
59
|
].join("/")
|
60
|
-
when "
|
60
|
+
when "nodes"
|
61
61
|
[
|
62
62
|
"api",
|
63
|
-
"
|
63
|
+
"upgrade",
|
64
64
|
"repocheck"
|
65
65
|
].join("/")
|
66
66
|
end
|
@@ -37,6 +37,22 @@ module Crowbar
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
class << self
|
42
|
+
def default
|
43
|
+
os_release_file = "/etc/os-release"
|
44
|
+
|
45
|
+
if File.exist?(os_release_file)
|
46
|
+
os_release = Hash[
|
47
|
+
File.open(os_release_file).read.scan(/(\S+)\s*=\s*"([^"]+)/)
|
48
|
+
]
|
49
|
+
|
50
|
+
return 1.0 if os_release["VERSION_ID"] == "12.1" && os_release["ID"] == "sles"
|
51
|
+
end
|
52
|
+
|
53
|
+
2.0
|
54
|
+
end
|
55
|
+
end
|
40
56
|
end
|
41
57
|
end
|
42
58
|
end
|
@@ -0,0 +1,34 @@
|
|
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_relative "../../../../spec_helper"
|
18
|
+
|
19
|
+
describe "Crowbar::Client::Command::Upgrade::Database" do
|
20
|
+
include_context "command_context"
|
21
|
+
|
22
|
+
["connect", "new"].each do |mode|
|
23
|
+
it_behaves_like "a command class", true do
|
24
|
+
subject do
|
25
|
+
::Crowbar::Client::Command::Upgrade::Database.new(
|
26
|
+
stdin,
|
27
|
+
stdout,
|
28
|
+
stderr,
|
29
|
+
mode: mode
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -16,17 +16,17 @@
|
|
16
16
|
|
17
17
|
require_relative "../../../../spec_helper"
|
18
18
|
|
19
|
-
describe "Crowbar::Client::Command::Upgrade::
|
19
|
+
describe "Crowbar::Client::Command::Upgrade::Repocheck" do
|
20
20
|
include_context "command_context"
|
21
21
|
|
22
|
-
["
|
22
|
+
["crowbar", "nodes"].each do |component|
|
23
23
|
it_behaves_like "a command class", true do
|
24
24
|
subject do
|
25
|
-
::Crowbar::Client::Command::Upgrade::
|
25
|
+
::Crowbar::Client::Command::Upgrade::Repocheck.new(
|
26
26
|
stdin,
|
27
27
|
stdout,
|
28
28
|
stderr,
|
29
|
-
|
29
|
+
component: component
|
30
30
|
)
|
31
31
|
end
|
32
32
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Copyright 2016, SUSE Linux GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require_relative "../../../../spec_helper"
|
19
|
+
|
20
|
+
describe "Crowbar::Client::Request::Upgrade::Database" do
|
21
|
+
["connect", "new"].each do |mode|
|
22
|
+
it_behaves_like "a request class", true do
|
23
|
+
subject do
|
24
|
+
::Crowbar::Client::Request::Upgrade::Database.new(
|
25
|
+
attrs
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
let!(:attrs) do
|
30
|
+
{
|
31
|
+
mode: mode,
|
32
|
+
username: "crowbar",
|
33
|
+
password: "crowbar",
|
34
|
+
database: "crowbar_production",
|
35
|
+
host: "localhost",
|
36
|
+
port: "5432"
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
let!(:params) do
|
41
|
+
{
|
42
|
+
username: "crowbar",
|
43
|
+
password: "crowbar",
|
44
|
+
database: "crowbar_production",
|
45
|
+
host: "localhost",
|
46
|
+
port: "5432"
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
let!(:method) do
|
51
|
+
:post
|
52
|
+
end
|
53
|
+
|
54
|
+
let!(:url) do
|
55
|
+
"upgrade/#{mode}"
|
56
|
+
end
|
57
|
+
|
58
|
+
let!(:headers) do
|
59
|
+
{
|
60
|
+
"Content-Type" => "application/vnd.crowbar.v2.0+json",
|
61
|
+
"Accept" => "application/vnd.crowbar.v2.0+json"
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
require_relative "../../../../spec_helper"
|
19
19
|
|
20
20
|
describe "Crowbar::Client::Request::Upgrade::Repocheck" do
|
21
|
-
[["
|
21
|
+
[["crowbar", "crowbar"], ["upgrade", "nodes"]].each do |component|
|
22
22
|
it_behaves_like "a request class", true do
|
23
23
|
subject do
|
24
24
|
::Crowbar::Client::Request::Upgrade::Repocheck.new(
|
@@ -28,7 +28,7 @@ describe "Crowbar::Client::Request::Upgrade::Repocheck" do
|
|
28
28
|
|
29
29
|
let!(:attrs) do
|
30
30
|
{
|
31
|
-
|
31
|
+
component: component.last
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -42,7 +42,7 @@ describe "Crowbar::Client::Request::Upgrade::Repocheck" do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
let!(:url) do
|
45
|
-
"api/#{
|
45
|
+
"api/#{component.first}/repocheck"
|
46
46
|
end
|
47
47
|
|
48
48
|
let!(:headers) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowbar-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Boerger
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -315,6 +315,7 @@ files:
|
|
315
315
|
- lib/crowbar/client/command/upgrade.rb
|
316
316
|
- lib/crowbar/client/command/upgrade/backup.rb
|
317
317
|
- lib/crowbar/client/command/upgrade/crowbar.rb
|
318
|
+
- lib/crowbar/client/command/upgrade/database.rb
|
318
319
|
- lib/crowbar/client/command/upgrade/node.rb
|
319
320
|
- lib/crowbar/client/command/upgrade/prechecks.rb
|
320
321
|
- lib/crowbar/client/command/upgrade/prepare.rb
|
@@ -337,6 +338,7 @@ files:
|
|
337
338
|
- lib/crowbar/client/formatter/nested.rb
|
338
339
|
- lib/crowbar/client/mixin.rb
|
339
340
|
- lib/crowbar/client/mixin/barclamp.rb
|
341
|
+
- lib/crowbar/client/mixin/database.rb
|
340
342
|
- lib/crowbar/client/mixin/filter.rb
|
341
343
|
- lib/crowbar/client/mixin/format.rb
|
342
344
|
- lib/crowbar/client/request.rb
|
@@ -408,6 +410,7 @@ files:
|
|
408
410
|
- lib/crowbar/client/request/upgrade.rb
|
409
411
|
- lib/crowbar/client/request/upgrade/backup.rb
|
410
412
|
- lib/crowbar/client/request/upgrade/crowbar.rb
|
413
|
+
- lib/crowbar/client/request/upgrade/database.rb
|
411
414
|
- lib/crowbar/client/request/upgrade/node.rb
|
412
415
|
- lib/crowbar/client/request/upgrade/prechecks.rb
|
413
416
|
- lib/crowbar/client/request/upgrade/prepare.rb
|
@@ -475,6 +478,7 @@ files:
|
|
475
478
|
- spec/crowbar/client/command/server/check_spec.rb
|
476
479
|
- spec/crowbar/client/command/upgrade/backup_spec.rb
|
477
480
|
- spec/crowbar/client/command/upgrade/crowbar_spec.rb
|
481
|
+
- spec/crowbar/client/command/upgrade/database_spec.rb
|
478
482
|
- spec/crowbar/client/command/upgrade/node_spec.rb
|
479
483
|
- spec/crowbar/client/command/upgrade/prechecks_spec.rb
|
480
484
|
- spec/crowbar/client/command/upgrade/prepare_spec.rb
|
@@ -534,6 +538,7 @@ files:
|
|
534
538
|
- spec/crowbar/client/request/server/check_spec.rb
|
535
539
|
- spec/crowbar/client/request/upgrade/backup_spec.rb
|
536
540
|
- spec/crowbar/client/request/upgrade/crowbar_spec.rb
|
541
|
+
- spec/crowbar/client/request/upgrade/database_spec.rb
|
537
542
|
- spec/crowbar/client/request/upgrade/node_spec.rb
|
538
543
|
- spec/crowbar/client/request/upgrade/prechecks_spec.rb
|
539
544
|
- spec/crowbar/client/request/upgrade/prepare_spec.rb
|
@@ -630,6 +635,7 @@ test_files:
|
|
630
635
|
- spec/crowbar/client/command/server/check_spec.rb
|
631
636
|
- spec/crowbar/client/command/upgrade/backup_spec.rb
|
632
637
|
- spec/crowbar/client/command/upgrade/crowbar_spec.rb
|
638
|
+
- spec/crowbar/client/command/upgrade/database_spec.rb
|
633
639
|
- spec/crowbar/client/command/upgrade/node_spec.rb
|
634
640
|
- spec/crowbar/client/command/upgrade/prechecks_spec.rb
|
635
641
|
- spec/crowbar/client/command/upgrade/prepare_spec.rb
|
@@ -689,6 +695,7 @@ test_files:
|
|
689
695
|
- spec/crowbar/client/request/server/check_spec.rb
|
690
696
|
- spec/crowbar/client/request/upgrade/backup_spec.rb
|
691
697
|
- spec/crowbar/client/request/upgrade/crowbar_spec.rb
|
698
|
+
- spec/crowbar/client/request/upgrade/database_spec.rb
|
692
699
|
- spec/crowbar/client/request/upgrade/node_spec.rb
|
693
700
|
- spec/crowbar/client/request/upgrade/prechecks_spec.rb
|
694
701
|
- spec/crowbar/client/request/upgrade/prepare_spec.rb
|