crowbar-client 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/crowbar/client/app.rb +3 -0
  4. data/lib/crowbar/client/app/entry.rb +4 -0
  5. data/lib/crowbar/client/app/services.rb +85 -0
  6. data/lib/crowbar/client/command.rb +3 -0
  7. data/lib/crowbar/client/command/services.rb +31 -0
  8. data/lib/crowbar/client/command/services/clear_restart.rb +42 -0
  9. data/lib/crowbar/client/command/services/disable_restart.rb +42 -0
  10. data/lib/crowbar/client/command/services/list_restarts.rb +57 -0
  11. data/lib/crowbar/client/command/services/restart_flags.rb +57 -0
  12. data/lib/crowbar/client/request.rb +3 -0
  13. data/lib/crowbar/client/request/services.rb +31 -0
  14. data/lib/crowbar/client/request/services/clear_restart.rb +71 -0
  15. data/lib/crowbar/client/request/services/disable_restart.rb +71 -0
  16. data/lib/crowbar/client/request/services/list_restarts.rb +59 -0
  17. data/lib/crowbar/client/request/services/restart_flags.rb +59 -0
  18. data/lib/crowbar/client/version.rb +1 -1
  19. data/spec/crowbar/client/command/services/clear_restart_spec.rb +33 -0
  20. data/spec/crowbar/client/command/services/disable_restart_spec.rb +33 -0
  21. data/spec/crowbar/client/command/services/list_restarts_spec.rb +31 -0
  22. data/spec/crowbar/client/command/services/restart_flags_spec.rb +31 -0
  23. data/spec/crowbar/client/request/services/clear_restart_spec.rb +35 -0
  24. data/spec/crowbar/client/request/services/disable_restart_spec.rb +35 -0
  25. data/spec/crowbar/client/request/services/list_restarts_spec.rb +50 -0
  26. data/spec/crowbar/client/request/services/restart_flags_spec.rb +50 -0
  27. metadata +30 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83d51fd825a3ef94b457cf16266f10ba16818937
4
- data.tar.gz: c3e8ac129f825621c7934a91af226338b57cd1e6
3
+ metadata.gz: 0cb6df7f08aa6f28deb61db78bbe516ecb1e6b69
4
+ data.tar.gz: 6cf5ccf3a8615e0dc14dad2d4be8c1701c55c092
5
5
  SHA512:
6
- metadata.gz: 4f5cbb5e078d5714216ffb28518b54aad3578b22765b68fb12f2770c366ce8a7d4c6ba7c8117f738185873725196f02e4bdeacd778deb4c1c7f4eae43155967b
7
- data.tar.gz: d1fedb5e476b78620907e30ae047b8222ab7467e2516a56af5835a1076af6db3edca9b0e6b04980b6c2157566e14342afe6bee7f0e8acfa4a1b0c42b1fa887e1
6
+ metadata.gz: c3039b22d3902c1ac33d07f2afa80bb425543171a1eccd985b8d1b415f8933e30f3ec216e1963537c36b52add90ab577f44379ab205256a6d776eec96bc48e05
7
+ data.tar.gz: 3810af05f1754c429cec7df47dd28ea3edc7622d0b98e982468f3f532cfa45469090c9de0242abfba88efe306a15e28d40671d5d3f1878140ee5c8f3f5043264
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.5.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.5.0) - 2017-10-13
4
+
5
+ * ENHANCEMENT
6
+ * Add new service command and subcommands
7
+
3
8
  ## [3.4.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.4.0) - 2017-10-08
4
9
 
5
10
  * BUGFIX
@@ -70,6 +70,9 @@ module Crowbar
70
70
 
71
71
  autoload :VirtualIP,
72
72
  File.expand_path("../app/virtual_ip", __FILE__)
73
+
74
+ autoload :Services,
75
+ File.expand_path("../app/services", __FILE__)
73
76
  end
74
77
  end
75
78
  end
@@ -162,6 +162,10 @@ module Crowbar
162
162
  desc "database [COMMANDS]",
163
163
  "Database specific commands, call without params for help"
164
164
  subcommand "database", Crowbar::Client::App::Database
165
+
166
+ desc "services [COMMANDS]",
167
+ "Services specific commands, call without params for help"
168
+ subcommand "services", Crowbar::Client::App::Services
165
169
  end
166
170
  end
167
171
  end
@@ -0,0 +1,85 @@
1
+ #
2
+ # Copyright 2017, 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 Services commands
22
+ #
23
+ class Services < Base
24
+ desc "list_restarts",
25
+ "List services that require a restart"
26
+
27
+ long_desc <<-LONGDESC
28
+ `list_restarts` will print out a list of the services requiring restart.
29
+ You can display the list in different output formats.
30
+ LONGDESC
31
+
32
+ def list_restarts
33
+ Command::Services::ListServiceRestarts.new(*command_params).execute
34
+ rescue => e
35
+ catch_errors(e)
36
+ end
37
+
38
+ desc "clear_restart NODE SERVICE",
39
+ "Clear the restart flag for a service on a node"
40
+
41
+ long_desc <<-LONGDESC
42
+ `clear_restart NODE SERVICE` will clear the 'restart needed' flag
43
+ for the given SERVICE on the NODE.
44
+ LONGDESC
45
+ def clear_restart(node, service)
46
+ Command::Services::ClearServiceRestart.new(
47
+ *command_params(
48
+ node: node,
49
+ service: service
50
+ )
51
+ ).execute
52
+ rescue => e
53
+ catch_errors(e)
54
+ end
55
+
56
+ desc "restart_flags",
57
+ "List cookbooks and their restart status (allowed/disallowed)"
58
+
59
+ def restart_flags
60
+ Command::Services::ListRestartFlags.new(*command_params).execute
61
+ rescue => e
62
+ catch_errors(e)
63
+ end
64
+
65
+ desc "disable_restart COOKBOOK VALUE",
66
+ "Set the restart disallowed for a cookbook to true/false"
67
+ def disable_restart(cookbook, value)
68
+ unless ["true", "false"].include? value.downcase
69
+ msg = "#{value} is not a valid value for this command. Please use true or false"
70
+ raise SimpleCatchableError(msg)
71
+ end
72
+ value = value.casecmp("true").zero? ? true : false
73
+ Command::Services::SetRestartFlag.new(
74
+ *command_params(
75
+ cookbook: cookbook,
76
+ disallow_restart: value
77
+ )
78
+ ).execute
79
+ rescue => e
80
+ catch_errors(e)
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -64,6 +64,9 @@ module Crowbar
64
64
 
65
65
  autoload :VirtualIP,
66
66
  File.expand_path("../command/virtual_ip", __FILE__)
67
+
68
+ autoload :Services,
69
+ File.expand_path("../command/services", __FILE__)
67
70
  end
68
71
  end
69
72
  end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright 2017, 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 List Restarts command implementations
22
+ #
23
+ module Services
24
+ autoload :ListServiceRestarts, File.expand_path("../services/list_restarts", __FILE__)
25
+ autoload :ClearServiceRestart, File.expand_path("../services/clear_restart", __FILE__)
26
+ autoload :ListRestartFlags, File.expand_path("../services/restart_flags", __FILE__)
27
+ autoload :SetRestartFlag, File.expand_path("../services/disable_restart", __FILE__)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Copyright 2017, 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
+ module Services
21
+ #
22
+ # Implementation for the List Restarts command
23
+ #
24
+ class ClearServiceRestart < Base
25
+ include Mixin::Format
26
+
27
+ def request
28
+ @request ||= Request::Services::ClearServiceRestart.new(
29
+ args
30
+ )
31
+ end
32
+
33
+ def execute
34
+ request.process do |request|
35
+ err request.parsed_response["error"] if request.code != 200
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Copyright 2017, 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
+ module Services
21
+ #
22
+ # Implementation for the List Restarts command
23
+ #
24
+ class SetRestartFlag < Base
25
+ include Mixin::Format
26
+
27
+ def request
28
+ @request ||= Request::Services::SetRestartFlag.new(
29
+ args
30
+ )
31
+ end
32
+
33
+ def execute
34
+ request.process do |request|
35
+ err request.parsed_response["error"] if request.code != 200
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,57 @@
1
+ #
2
+ # Copyright 2017, 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
+ module Services
21
+ #
22
+ # Implementation for the List Restarts command
23
+ #
24
+ class ListServiceRestarts < Base
25
+ include Mixin::Format
26
+
27
+ def request
28
+ @request ||= Request::Services::ListServiceRestarts.new(
29
+ *args
30
+ )
31
+ end
32
+
33
+ def execute
34
+ request.process do |request|
35
+ case request.code
36
+ when 200
37
+ formatter = Formatter::Hash.new(
38
+ format: "json",
39
+ headings: ["Node"],
40
+ values: request.parsed_response
41
+ )
42
+
43
+ if formatter.empty?
44
+ err "No restarts"
45
+ else
46
+ say formatter.result
47
+ end
48
+ else
49
+ err request.parsed_response["error"]
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,57 @@
1
+ #
2
+ # Copyright 2017, 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
+ module Services
21
+ #
22
+ # Implementation for the List Restarts command
23
+ #
24
+ class ListRestartFlags < Base
25
+ include Mixin::Format
26
+
27
+ def request
28
+ @request ||= Request::Services::ListRestartFlags.new(
29
+ *args
30
+ )
31
+ end
32
+
33
+ def execute
34
+ request.process do |request|
35
+ case request.code
36
+ when 200
37
+ formatter = Formatter::Hash.new(
38
+ format: "json",
39
+ headings: ["Barclamp"],
40
+ values: request.parsed_response
41
+ )
42
+
43
+ if formatter.empty?
44
+ err "No flags set"
45
+ else
46
+ say formatter.result
47
+ end
48
+ else
49
+ err request.parsed_response["error"]
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -70,6 +70,9 @@ module Crowbar
70
70
 
71
71
  autoload :VirtualIP,
72
72
  File.expand_path("../request/virtual_ip", __FILE__)
73
+
74
+ autoload :Services,
75
+ File.expand_path("../request/services", __FILE__)
73
76
  end
74
77
  end
75
78
  end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright 2017, 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 Request
20
+ #
21
+ # Module for the List Restarts request implementations
22
+ #
23
+ module Services
24
+ autoload :ListServiceRestarts, File.expand_path("../services/list_restarts", __FILE__)
25
+ autoload :ClearServiceRestart, File.expand_path("../services/clear_restart", __FILE__)
26
+ autoload :ListRestartFlags, File.expand_path("../services/restart_flags", __FILE__)
27
+ autoload :SetRestartFlag, File.expand_path("../services/disable_restart", __FILE__)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,71 @@
1
+ #
2
+ # Copyright 2017, 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 Services
23
+ #
24
+ # Implementation for the Clear Restarts request
25
+ #
26
+ class ClearServiceRestart < 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
+ node: attrs.node,
46
+ service: attrs.service
47
+ )
48
+ end
49
+
50
+ #
51
+ # HTTP method that gets used by the request
52
+ #
53
+ # @return [Symbol] the method for the request
54
+ #
55
+ def method
56
+ :post
57
+ end
58
+
59
+ #
60
+ # Path to the API endpoint for the request
61
+ #
62
+ # @return [String] path to the API endpoint
63
+ #
64
+ def url
65
+ ["api", "restart_management", "restarts"].join("/")
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,71 @@
1
+ #
2
+ # Copyright 2017, 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 Services
23
+ #
24
+ # Implementation for the Disable Restarts request
25
+ #
26
+ class SetRestartFlag < 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
+ cookbook: attrs.cookbook,
46
+ disallow_restart: attrs.disallow_restart
47
+ )
48
+ end
49
+
50
+ #
51
+ # HTTP method that gets used by the request
52
+ #
53
+ # @return [Symbol] the method for the request
54
+ #
55
+ def method
56
+ :post
57
+ end
58
+
59
+ #
60
+ # Path to the API endpoint for the request
61
+ #
62
+ # @return [String] path to the API endpoint
63
+ #
64
+ def url
65
+ ["api", "restart_management", "configuration"].join("/")
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,59 @@
1
+ #
2
+ # Copyright 2017, 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 Services
23
+ #
24
+ # Implementation for the List Restarts request
25
+ #
26
+ class ListServiceRestarts < 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
+ # HTTP method that gets used by the request
40
+ #
41
+ # @return [Symbol] the method for the request
42
+ #
43
+ def method
44
+ :get
45
+ end
46
+
47
+ #
48
+ # Path to the API endpoint for the request
49
+ #
50
+ # @return [String] path to the API endpoint
51
+ #
52
+ def url
53
+ ["api", "restart_management", "restarts"].join("/")
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,59 @@
1
+ #
2
+ # Copyright 2017, 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 Services
23
+ #
24
+ # Implementation for the Restarts Flags request
25
+ #
26
+ class ListRestartFlags < 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
+ # HTTP method that gets used by the request
40
+ #
41
+ # @return [Symbol] the method for the request
42
+ #
43
+ def method
44
+ :get
45
+ end
46
+
47
+ #
48
+ # Path to the API endpoint for the request
49
+ #
50
+ # @return [String] path to the API endpoint
51
+ #
52
+ def url
53
+ ["api", "restart_management", "configuration"].join("/")
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -28,7 +28,7 @@ module Crowbar
28
28
  #
29
29
  # Minor version
30
30
  #
31
- MINOR = 4
31
+ MINOR = 5
32
32
 
33
33
  #
34
34
  # Patch version
@@ -0,0 +1,33 @@
1
+ #
2
+ # Copyright 2017, 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::Services::ClearServiceRestart" do
20
+ include_context "command_context"
21
+
22
+ it_behaves_like "a command class", true do
23
+ subject do
24
+ ::Crowbar::Client::Command::Services::ClearServiceRestart.new(
25
+ stdin,
26
+ stdout,
27
+ stderr,
28
+ node: "test",
29
+ service: "test"
30
+ )
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # Copyright 2017, 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::Services::SetRestartFlag" do
20
+ include_context "command_context"
21
+
22
+ it_behaves_like "a command class", true do
23
+ subject do
24
+ ::Crowbar::Client::Command::Services::SetRestartFlag.new(
25
+ stdin,
26
+ stdout,
27
+ stderr,
28
+ cookbook: "test",
29
+ disallow_restart: "false"
30
+ )
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright 2017, 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::Services::ListServiceRestarts" do
20
+ include_context "command_context"
21
+
22
+ it_behaves_like "a command class", true do
23
+ subject do
24
+ ::Crowbar::Client::Command::Services::ListServiceRestarts.new(
25
+ stdin,
26
+ stdout,
27
+ stderr
28
+ )
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright 2017, 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::Services::ListRestartFlags" do
20
+ include_context "command_context"
21
+
22
+ it_behaves_like "a command class", true do
23
+ subject do
24
+ ::Crowbar::Client::Command::Services::ListRestartFlags.new(
25
+ stdin,
26
+ stdout,
27
+ stderr
28
+ )
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Copyright 2017, 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
+ header = "application/vnd.crowbar.v2.0+json"
20
+
21
+ describe "Crowbar::Client::Request::Services::ClearServiceRestart" do
22
+ it_behaves_like "a request class", true do
23
+ subject do
24
+ ::Crowbar::Client::Request::Services::ClearServiceRestart.new(
25
+ attrs
26
+ )
27
+ end
28
+
29
+ let!(:attrs) { { node: "test", service: "test" } }
30
+ let!(:params) { { node: "test", service: "test" } }
31
+ let!(:method) { :post }
32
+ let!(:url) { "api/restart_management/restarts" }
33
+ let!(:headers) { { "Accept" => header, "Content-Type" => header } }
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Copyright 2017, 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
+ header = "application/vnd.crowbar.v2.0+json"
20
+
21
+ describe "Crowbar::Client::Request::Services::SetRestartFlag" do
22
+ it_behaves_like "a request class", true do
23
+ subject do
24
+ ::Crowbar::Client::Request::Services::SetRestartFlag.new(
25
+ attrs
26
+ )
27
+ end
28
+
29
+ let!(:attrs) { { cookbook: "test", disallow_restart: "false" } }
30
+ let!(:params) { { cookbook: "test", disallow_restart: "false" } }
31
+ let!(:method) { :post }
32
+ let!(:url) { "api/restart_management/configuration" }
33
+ let!(:headers) { { "Accept" => header, "Content-Type" => header } }
34
+ end
35
+ end
@@ -0,0 +1,50 @@
1
+ #
2
+ # Copyright 2017, 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::Request::Services::ListServiceRestarts" do
20
+ it_behaves_like "a request class", true do
21
+ subject do
22
+ ::Crowbar::Client::Request::Services::ListServiceRestarts.new(
23
+ *attrs
24
+ )
25
+ end
26
+
27
+ let!(:attrs) do
28
+ {}
29
+ end
30
+
31
+ let!(:params) do
32
+ {}
33
+ end
34
+
35
+ let!(:method) do
36
+ :get
37
+ end
38
+
39
+ let!(:url) do
40
+ "api/restart_management/restarts"
41
+ end
42
+
43
+ let!(:headers) do
44
+ {
45
+ "Accept" => "application/vnd.crowbar.v2.0+json",
46
+ "Content-Type" => "application/vnd.crowbar.v2.0+json"
47
+ }
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ #
2
+ # Copyright 2017, 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::Request::Services::ListRestartFlags" do
20
+ it_behaves_like "a request class", true do
21
+ subject do
22
+ ::Crowbar::Client::Request::Services::ListRestartFlags.new(
23
+ *attrs
24
+ )
25
+ end
26
+
27
+ let!(:attrs) do
28
+ {}
29
+ end
30
+
31
+ let!(:params) do
32
+ {}
33
+ end
34
+
35
+ let!(:method) do
36
+ :get
37
+ end
38
+
39
+ let!(:url) do
40
+ "api/restart_management/configuration"
41
+ end
42
+
43
+ let!(:headers) do
44
+ {
45
+ "Accept" => "application/vnd.crowbar.v2.0+json",
46
+ "Content-Type" => "application/vnd.crowbar.v2.0+json"
47
+ }
48
+ end
49
+ end
50
+ end
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.4.0
4
+ version: 3.5.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: 2017-10-06 00:00:00.000000000 Z
13
+ date: 2017-10-13 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/repository.rb
248
248
  - lib/crowbar/client/app/role.rb
249
249
  - lib/crowbar/client/app/server.rb
250
+ - lib/crowbar/client/app/services.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
@@ -315,6 +316,11 @@ files:
315
316
  - lib/crowbar/client/command/server.rb
316
317
  - lib/crowbar/client/command/server/api.rb
317
318
  - lib/crowbar/client/command/server/check.rb
319
+ - lib/crowbar/client/command/services.rb
320
+ - lib/crowbar/client/command/services/clear_restart.rb
321
+ - lib/crowbar/client/command/services/disable_restart.rb
322
+ - lib/crowbar/client/command/services/list_restarts.rb
323
+ - lib/crowbar/client/command/services/restart_flags.rb
318
324
  - lib/crowbar/client/command/upgrade.rb
319
325
  - lib/crowbar/client/command/upgrade/admin.rb
320
326
  - lib/crowbar/client/command/upgrade/backup.rb
@@ -420,6 +426,11 @@ files:
420
426
  - lib/crowbar/client/request/server.rb
421
427
  - lib/crowbar/client/request/server/api.rb
422
428
  - lib/crowbar/client/request/server/check.rb
429
+ - lib/crowbar/client/request/services.rb
430
+ - lib/crowbar/client/request/services/clear_restart.rb
431
+ - lib/crowbar/client/request/services/disable_restart.rb
432
+ - lib/crowbar/client/request/services/list_restarts.rb
433
+ - lib/crowbar/client/request/services/restart_flags.rb
423
434
  - lib/crowbar/client/request/upgrade.rb
424
435
  - lib/crowbar/client/request/upgrade/admin.rb
425
436
  - lib/crowbar/client/request/upgrade/backup.rb
@@ -493,6 +504,10 @@ files:
493
504
  - spec/crowbar/client/command/role/show_spec.rb
494
505
  - spec/crowbar/client/command/server/api_spec.rb
495
506
  - spec/crowbar/client/command/server/check_spec.rb
507
+ - spec/crowbar/client/command/services/clear_restart_spec.rb
508
+ - spec/crowbar/client/command/services/disable_restart_spec.rb
509
+ - spec/crowbar/client/command/services/list_restarts_spec.rb
510
+ - spec/crowbar/client/command/services/restart_flags_spec.rb
496
511
  - spec/crowbar/client/command/upgrade/admin_spec.rb
497
512
  - spec/crowbar/client/command/upgrade/backup_spec.rb
498
513
  - spec/crowbar/client/command/upgrade/cancel_spec.rb
@@ -559,6 +574,10 @@ files:
559
574
  - spec/crowbar/client/request/role/show_spec.rb
560
575
  - spec/crowbar/client/request/server/api_spec.rb
561
576
  - spec/crowbar/client/request/server/check_spec.rb
577
+ - spec/crowbar/client/request/services/clear_restart_spec.rb
578
+ - spec/crowbar/client/request/services/disable_restart_spec.rb
579
+ - spec/crowbar/client/request/services/list_restarts_spec.rb
580
+ - spec/crowbar/client/request/services/restart_flags_spec.rb
562
581
  - spec/crowbar/client/request/upgrade/admin_spec.rb
563
582
  - spec/crowbar/client/request/upgrade/backup_spec.rb
564
583
  - spec/crowbar/client/request/upgrade/cancel_spec.rb
@@ -602,7 +621,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
602
621
  version: '0'
603
622
  requirements: []
604
623
  rubyforge_project:
605
- rubygems_version: 2.6.13
624
+ rubygems_version: 2.6.14
606
625
  signing_key:
607
626
  specification_version: 4
608
627
  summary: Crowbar commandline client
@@ -660,6 +679,10 @@ test_files:
660
679
  - spec/crowbar/client/command/role/show_spec.rb
661
680
  - spec/crowbar/client/command/server/api_spec.rb
662
681
  - spec/crowbar/client/command/server/check_spec.rb
682
+ - spec/crowbar/client/command/services/clear_restart_spec.rb
683
+ - spec/crowbar/client/command/services/disable_restart_spec.rb
684
+ - spec/crowbar/client/command/services/list_restarts_spec.rb
685
+ - spec/crowbar/client/command/services/restart_flags_spec.rb
663
686
  - spec/crowbar/client/command/upgrade/admin_spec.rb
664
687
  - spec/crowbar/client/command/upgrade/backup_spec.rb
665
688
  - spec/crowbar/client/command/upgrade/cancel_spec.rb
@@ -726,6 +749,10 @@ test_files:
726
749
  - spec/crowbar/client/request/role/show_spec.rb
727
750
  - spec/crowbar/client/request/server/api_spec.rb
728
751
  - spec/crowbar/client/request/server/check_spec.rb
752
+ - spec/crowbar/client/request/services/clear_restart_spec.rb
753
+ - spec/crowbar/client/request/services/disable_restart_spec.rb
754
+ - spec/crowbar/client/request/services/list_restarts_spec.rb
755
+ - spec/crowbar/client/request/services/restart_flags_spec.rb
729
756
  - spec/crowbar/client/request/upgrade/admin_spec.rb
730
757
  - spec/crowbar/client/request/upgrade/backup_spec.rb
731
758
  - spec/crowbar/client/request/upgrade/cancel_spec.rb