crowbar-client 3.6.1 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f96242929ff4f63474c38f48779c047d71c06674f51f73b6b48dd939f2de6c90
4
- data.tar.gz: bea1ac00753c5d93e682299bc66c9e375faba6384e0d08db72d59ad6ee0a7c93
3
+ metadata.gz: dde7d7523db4411363365404f5e439b292b78723488ae6a732de79ecb08ae200
4
+ data.tar.gz: a692fb4b07d250b28e317077cffb0d40166a70c870d74b8e16e398a97f57d6f0
5
5
  SHA512:
6
- metadata.gz: d279752db885d75556c6c4bb6d6c08793995fa67a07258da904bad1789769b47f223bd2074c0a18b20445eab7d3c9f80b37c39d14449e20d896745f77bbf266b
7
- data.tar.gz: 41976f4fc7189ac6cf208f1958fddb3db0919a8e6d4628c6d10ecbb93d70fc651c2461389b049522b7b724f3d17d32edb614e173f0f447e84030a4d924948080
6
+ metadata.gz: ed7acd0f36016af684a11e9c4968f687d96f27385e407c348f5e4edde299403cfbce83ff8245f2f85f4d0b6058a9844b61bbc67749aba7d33d90a6c28bf1fab5
7
+ data.tar.gz: e07e211190cd10599af16e18e3504833648150eec3dff9510245bf816912143345f6a2af941907700ce1a3ab0b5c8130f911cf10ea8615882707d50a5adfa50d
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.7.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.7.0) - 2018-12-14
4
+
5
+ * ENHANCEMENT
6
+ * Better upgrade repocheck output
7
+
3
8
  ## [3.6.1](https://github.com/crowbar/crowbar-client/releases/tag/v3.6.1) - 2018-12-07
4
9
 
5
10
  * BUGFIX
@@ -62,6 +62,9 @@ module Crowbar
62
62
  autoload :Role,
63
63
  File.expand_path("../app/role", __FILE__)
64
64
 
65
+ autoload :Ses,
66
+ File.expand_path("../app/ses", __FILE__)
67
+
65
68
  autoload :Server,
66
69
  File.expand_path("../app/server", __FILE__)
67
70
 
@@ -166,6 +166,13 @@ module Crowbar
166
166
  desc "services [COMMANDS]",
167
167
  "Services specific commands, call without params for help"
168
168
  subcommand "services", Crowbar::Client::App::Services
169
+
170
+ desc "ses [COMMANDS]",
171
+ "SES (Ceph) specific commands, call without params for help"
172
+ subcommand "ses", Crowbar::Client::App::Ses
173
+
174
+ # hide SES command in older versions
175
+ remove_command :ses unless Config.defaults[:cloud_version].to_i >= 9
169
176
  end
170
177
  end
171
178
  end
@@ -0,0 +1,54 @@
1
+ #
2
+ # Copyright 2019, SUSE
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 SES commands
22
+ #
23
+ class Ses < Base
24
+ desc "upload FILE",
25
+ "Upload SES configuration file"
26
+
27
+ long_desc <<-LONGDESC
28
+ `upload FILE` will upload yaml file with SES configuration to the
29
+ server. Data inside this file could be used later for integrating
30
+ SES cluster with other services.
31
+ LONGDESC
32
+
33
+ #
34
+ # SES config upload command
35
+ #
36
+ # It will upload yaml file with SES configuration to the server.
37
+ # Data inside this file could be used later for integrating SES
38
+ # cluster with other services.
39
+ #
40
+ # @param file [String] the path to the file
41
+ #
42
+ def upload(file)
43
+ Command::Ses::Upload.new(
44
+ *command_params(
45
+ file: file
46
+ )
47
+ ).execute
48
+ rescue => e
49
+ catch_errors(e)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -56,6 +56,9 @@ module Crowbar
56
56
  autoload :Role,
57
57
  File.expand_path("../command/role", __FILE__)
58
58
 
59
+ autoload :Ses,
60
+ File.expand_path("../command/ses", __FILE__)
61
+
59
62
  autoload :Server,
60
63
  File.expand_path("../command/server", __FILE__)
61
64
 
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright 2019, SUSE
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 SES command implementations
22
+ #
23
+ module Ses
24
+ autoload :Upload,
25
+ File.expand_path("../ses/upload", __FILE__)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,60 @@
1
+ # Copyright 2019, SUSE
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+
16
+ module Crowbar
17
+ module Client
18
+ module Command
19
+ module Ses
20
+ #
21
+ # Implementation for the SES config upload command
22
+ #
23
+ class Upload < Base
24
+ def request
25
+ args.file =
26
+ case args.file
27
+ when "-"
28
+ stdin.to_io
29
+ when File
30
+ args.file
31
+ else
32
+ unless File.exist?(args.file)
33
+ err "File #{args.file} does not exist."
34
+ end
35
+ File.new(
36
+ args.file,
37
+ File::RDONLY
38
+ )
39
+ end
40
+
41
+ @request ||= Request::Ses::Upload.new(
42
+ args
43
+ )
44
+ end
45
+
46
+ def execute
47
+ request.process do |request|
48
+ case request.code
49
+ when 200
50
+ say "Successfully uploaded SES configuration"
51
+ else
52
+ err request.parsed_response["error"]
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -100,7 +100,7 @@ module Crowbar
100
100
  )
101
101
  else
102
102
  err "No such component '#{args.component}'. " \
103
- "Only 'admin' and 'nodes' are valid components."
103
+ "Only 'crowbar' and 'nodes' are valid components."
104
104
  end
105
105
  end
106
106
  end
@@ -61,6 +61,7 @@ module Crowbar
61
61
  apiversion: default_apiversion,
62
62
  experimental: default_experimental,
63
63
  upgrade_versions: default_upgrade_versions,
64
+ cloud_version: default_cloud_version,
64
65
  debug: default_debug
65
66
  )
66
67
  end
@@ -108,18 +109,33 @@ module Crowbar
108
109
  return "7-to-8" if File.exist?("/var/lib/crowbar/upgrade/7-to-8-upgrade-running")
109
110
 
110
111
  # if upgrade has not been started, check the system version
111
- os_release_file = "/etc/os-release"
112
-
113
- if File.exist?(os_release_file)
114
- os_release = Hash[
115
- File.open(os_release_file).read.scan(/(\S+)\s*=\s*"([^"]+)/)
116
- ]
117
- return "6-to-7" if os_release["VERSION_ID"] == "12.1"
118
- end
112
+ return "6-to-7" if default_cloud_version == "6"
119
113
 
120
114
  "7-to-8"
121
115
  end
122
116
 
117
+ #
118
+ # Define a default cloud version value
119
+ # It is detected based on OS release for local machine or set by user via ENV variable.
120
+ #
121
+ # @return [String] the default cloud version value
122
+ #
123
+ def default_cloud_version
124
+ return ENV["CROWBAR_CLOUD_VERSION"] if ENV["CROWBAR_CLOUD_VERSION"].present?
125
+
126
+ os_release = Crowbar::Client::Util::OsRelease.fields
127
+ case os_release["VERSION_ID"]
128
+ when "12.1"
129
+ "6"
130
+ when "12.2"
131
+ "7"
132
+ when "12.3"
133
+ "8"
134
+ else
135
+ "9"
136
+ end
137
+ end
138
+
123
139
  #
124
140
  # Define a default alias value
125
141
  #
@@ -62,6 +62,9 @@ module Crowbar
62
62
  autoload :Role,
63
63
  File.expand_path("../request/role", __FILE__)
64
64
 
65
+ autoload :Ses,
66
+ File.expand_path("../request/ses", __FILE__)
67
+
65
68
  autoload :Server,
66
69
  File.expand_path("../request/server", __FILE__)
67
70
 
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright 2019, SUSE
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 Request
20
+ #
21
+ # Module for the SES request implementations
22
+ #
23
+ module Ses
24
+ autoload :Upload,
25
+ File.expand_path("../ses/upload", __FILE__)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,65 @@
1
+ #
2
+ # Copyright 2019, SUSE
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 Ses
23
+ #
24
+ # Implementation for the SES config upload request
25
+ #
26
+ class Upload < Base
27
+ #
28
+ # Override the request content
29
+ #
30
+ # @return [Hash] the content for the request
31
+ #
32
+ def content
33
+ super.easy_merge!(
34
+ sesconfig: {
35
+ file: attrs.file
36
+ }
37
+ )
38
+ end
39
+
40
+ #
41
+ # HTTP method that gets used by the request
42
+ #
43
+ # @return [Symbol] the method for the request
44
+ #
45
+ def method
46
+ :post
47
+ end
48
+
49
+ #
50
+ # Path to the API endpoint for the request
51
+ #
52
+ # @return [String] path to the API endpoint
53
+ #
54
+ def url
55
+ [
56
+ "ses",
57
+ "settings",
58
+ "upload"
59
+ ].join("/")
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -28,6 +28,9 @@ module Crowbar
28
28
 
29
29
  autoload :ApiVersion,
30
30
  File.expand_path("../util/apiversion", __FILE__)
31
+
32
+ autoload :OsRelease,
33
+ File.expand_path("../util/osrelease", __FILE__)
31
34
  end
32
35
  end
33
36
  end
@@ -40,15 +40,9 @@ module Crowbar
40
40
 
41
41
  class << self
42
42
  def default
43
- os_release_file = "/etc/os-release"
43
+ os_release = OsRelease.fields
44
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
45
+ return 1.0 if os_release["VERSION_ID"] == "12.1" && os_release["ID"] == "sles"
52
46
 
53
47
  2.0
54
48
  end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Copyright 2019, SUSE
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 Util
20
+ class OsRelease
21
+ class << self
22
+ def fields
23
+ os_release_file = "/etc/os-release"
24
+
25
+ if File.exist?(os_release_file)
26
+ return Hash[
27
+ File.open(os_release_file).read.scan(/(\S+)\s*=\s*"([^"]+)/)
28
+ ]
29
+ end
30
+
31
+ {}
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -28,12 +28,12 @@ module Crowbar
28
28
  #
29
29
  # Minor version
30
30
  #
31
- MINOR = 6
31
+ MINOR = 7
32
32
 
33
33
  #
34
34
  # Patch version
35
35
  #
36
- PATCH = 1
36
+ PATCH = 0
37
37
 
38
38
  #
39
39
  # Optional suffix
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.6.1
4
+ version: 3.7.0
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: 2018-12-14 00:00:00.000000000 Z
13
+ date: 2019-04-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -247,6 +247,7 @@ files:
247
247
  - lib/crowbar/client/app/role.rb
248
248
  - lib/crowbar/client/app/server.rb
249
249
  - lib/crowbar/client/app/services.rb
250
+ - lib/crowbar/client/app/ses.rb
250
251
  - lib/crowbar/client/app/upgrade.rb
251
252
  - lib/crowbar/client/app/virtual_ip.rb
252
253
  - lib/crowbar/client/command.rb
@@ -320,6 +321,8 @@ files:
320
321
  - lib/crowbar/client/command/services/disable_restart.rb
321
322
  - lib/crowbar/client/command/services/list_restarts.rb
322
323
  - lib/crowbar/client/command/services/restart_flags.rb
324
+ - lib/crowbar/client/command/ses.rb
325
+ - lib/crowbar/client/command/ses/upload.rb
323
326
  - lib/crowbar/client/command/upgrade.rb
324
327
  - lib/crowbar/client/command/upgrade/admin.rb
325
328
  - lib/crowbar/client/command/upgrade/backup.rb
@@ -430,6 +433,8 @@ files:
430
433
  - lib/crowbar/client/request/services/disable_restart.rb
431
434
  - lib/crowbar/client/request/services/list_restarts.rb
432
435
  - lib/crowbar/client/request/services/restart_flags.rb
436
+ - lib/crowbar/client/request/ses.rb
437
+ - lib/crowbar/client/request/ses/upload.rb
433
438
  - lib/crowbar/client/request/upgrade.rb
434
439
  - lib/crowbar/client/request/upgrade/admin.rb
435
440
  - lib/crowbar/client/request/upgrade/backup.rb
@@ -448,6 +453,7 @@ files:
448
453
  - lib/crowbar/client/util.rb
449
454
  - lib/crowbar/client/util/apiversion.rb
450
455
  - lib/crowbar/client/util/editor.rb
456
+ - lib/crowbar/client/util/osrelease.rb
451
457
  - lib/crowbar/client/util/runner.rb
452
458
  - lib/crowbar/client/version.rb
453
459
  - spec/crowbar/client/app_spec.rb
@@ -619,8 +625,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
619
625
  - !ruby/object:Gem::Version
620
626
  version: '0'
621
627
  requirements: []
622
- rubyforge_project:
623
- rubygems_version: 2.7.8
628
+ rubygems_version: 3.0.3
624
629
  signing_key:
625
630
  specification_version: 4
626
631
  summary: Crowbar commandline client