crowbar-client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +6 -0
- data/LICENSE +202 -0
- data/README.md +49 -0
- data/bin/crowbar +37 -0
- data/lib/crowbar-client.rb +17 -0
- data/lib/crowbar/client.rb +82 -0
- data/lib/crowbar/client/app.rb +60 -0
- data/lib/crowbar/client/app/barclamp.rb +77 -0
- data/lib/crowbar/client/app/base.rb +97 -0
- data/lib/crowbar/client/app/batch.rb +100 -0
- data/lib/crowbar/client/app/entry.rb +121 -0
- data/lib/crowbar/client/app/host_ip.rb +65 -0
- data/lib/crowbar/client/app/interface.rb +63 -0
- data/lib/crowbar/client/app/network.rb +35 -0
- data/lib/crowbar/client/app/node.rb +451 -0
- data/lib/crowbar/client/app/proposal.rb +300 -0
- data/lib/crowbar/client/app/repository.rb +149 -0
- data/lib/crowbar/client/app/reset.rb +58 -0
- data/lib/crowbar/client/app/role.rb +140 -0
- data/lib/crowbar/client/app/virtual_ip.rb +65 -0
- data/lib/crowbar/client/command.rb +54 -0
- data/lib/crowbar/client/command/barclamp.rb +26 -0
- data/lib/crowbar/client/command/barclamp/list.rb +64 -0
- data/lib/crowbar/client/command/base.rb +55 -0
- data/lib/crowbar/client/command/batch.rb +29 -0
- data/lib/crowbar/client/command/batch/build.rb +36 -0
- data/lib/crowbar/client/command/batch/export.rb +36 -0
- data/lib/crowbar/client/command/host_ip.rb +29 -0
- data/lib/crowbar/client/command/host_ip/allocate.rb +50 -0
- data/lib/crowbar/client/command/host_ip/deallocate.rb +42 -0
- data/lib/crowbar/client/command/interface.rb +29 -0
- data/lib/crowbar/client/command/interface/disable.rb +42 -0
- data/lib/crowbar/client/command/interface/enable.rb +50 -0
- data/lib/crowbar/client/command/node.rb +74 -0
- data/lib/crowbar/client/command/node/allocate.rb +48 -0
- data/lib/crowbar/client/command/node/delete.rb +44 -0
- data/lib/crowbar/client/command/node/hardware.rb +48 -0
- data/lib/crowbar/client/command/node/identify.rb +48 -0
- data/lib/crowbar/client/command/node/list.rb +71 -0
- data/lib/crowbar/client/command/node/powercycle.rb +48 -0
- data/lib/crowbar/client/command/node/poweroff.rb +48 -0
- data/lib/crowbar/client/command/node/poweron.rb +48 -0
- data/lib/crowbar/client/command/node/reboot.rb +48 -0
- data/lib/crowbar/client/command/node/reinstall.rb +48 -0
- data/lib/crowbar/client/command/node/rename.rb +44 -0
- data/lib/crowbar/client/command/node/reset.rb +48 -0
- data/lib/crowbar/client/command/node/role.rb +44 -0
- data/lib/crowbar/client/command/node/show.rb +67 -0
- data/lib/crowbar/client/command/node/shutdown.rb +48 -0
- data/lib/crowbar/client/command/node/status.rb +71 -0
- data/lib/crowbar/client/command/node/transition.rb +44 -0
- data/lib/crowbar/client/command/proposal.rb +44 -0
- data/lib/crowbar/client/command/proposal/commit.rb +50 -0
- data/lib/crowbar/client/command/proposal/create.rb +130 -0
- data/lib/crowbar/client/command/proposal/delete.rb +48 -0
- data/lib/crowbar/client/command/proposal/dequeue.rb +48 -0
- data/lib/crowbar/client/command/proposal/edit.rb +129 -0
- data/lib/crowbar/client/command/proposal/list.rb +68 -0
- data/lib/crowbar/client/command/proposal/show.rb +71 -0
- data/lib/crowbar/client/command/repository.rb +38 -0
- data/lib/crowbar/client/command/repository/activate.rb +44 -0
- data/lib/crowbar/client/command/repository/activate_all.rb +42 -0
- data/lib/crowbar/client/command/repository/deactivate.rb +44 -0
- data/lib/crowbar/client/command/repository/deactivate_all.rb +42 -0
- data/lib/crowbar/client/command/repository/list.rb +71 -0
- data/lib/crowbar/client/command/reset.rb +29 -0
- data/lib/crowbar/client/command/reset/nodes.rb +36 -0
- data/lib/crowbar/client/command/reset/proposal.rb +36 -0
- data/lib/crowbar/client/command/role.rb +29 -0
- data/lib/crowbar/client/command/role/list.rb +70 -0
- data/lib/crowbar/client/command/role/show.rb +70 -0
- data/lib/crowbar/client/command/virtual_ip.rb +29 -0
- data/lib/crowbar/client/command/virtual_ip/allocate.rb +50 -0
- data/lib/crowbar/client/command/virtual_ip/deallocate.rb +42 -0
- data/lib/crowbar/client/config.rb +178 -0
- data/lib/crowbar/client/filter.rb +33 -0
- data/lib/crowbar/client/filter/array.rb +29 -0
- data/lib/crowbar/client/filter/base.rb +41 -0
- data/lib/crowbar/client/filter/hash.rb +33 -0
- data/lib/crowbar/client/filter/subset.rb +45 -0
- data/lib/crowbar/client/formatter.rb +33 -0
- data/lib/crowbar/client/formatter/array.rb +49 -0
- data/lib/crowbar/client/formatter/base.rb +47 -0
- data/lib/crowbar/client/formatter/hash.rb +51 -0
- data/lib/crowbar/client/formatter/nested.rb +134 -0
- data/lib/crowbar/client/mixin.rb +30 -0
- data/lib/crowbar/client/mixin/barclamp.rb +41 -0
- data/lib/crowbar/client/mixin/filter.rb +33 -0
- data/lib/crowbar/client/mixin/format.rb +56 -0
- data/lib/crowbar/client/request.rb +57 -0
- data/lib/crowbar/client/request/barclamp.rb +26 -0
- data/lib/crowbar/client/request/barclamp/list.rb +35 -0
- data/lib/crowbar/client/request/base.rb +71 -0
- data/lib/crowbar/client/request/batch.rb +29 -0
- data/lib/crowbar/client/request/batch/build.rb +33 -0
- data/lib/crowbar/client/request/batch/export.rb +33 -0
- data/lib/crowbar/client/request/host_ip.rb +29 -0
- data/lib/crowbar/client/request/host_ip/allocate.rb +50 -0
- data/lib/crowbar/client/request/host_ip/deallocate.rb +48 -0
- data/lib/crowbar/client/request/interface.rb +29 -0
- data/lib/crowbar/client/request/interface/disable.rb +48 -0
- data/lib/crowbar/client/request/interface/enable.rb +48 -0
- data/lib/crowbar/client/request/node.rb +47 -0
- data/lib/crowbar/client/request/node/action.rb +39 -0
- data/lib/crowbar/client/request/node/delete.rb +38 -0
- data/lib/crowbar/client/request/node/list.rb +37 -0
- data/lib/crowbar/client/request/node/rename.rb +47 -0
- data/lib/crowbar/client/request/node/role.rb +47 -0
- data/lib/crowbar/client/request/node/show.rb +38 -0
- data/lib/crowbar/client/request/node/status.rb +36 -0
- data/lib/crowbar/client/request/node/transition.rb +48 -0
- data/lib/crowbar/client/request/party.rb +79 -0
- data/lib/crowbar/client/request/proposal.rb +47 -0
- data/lib/crowbar/client/request/proposal/commit.rb +40 -0
- data/lib/crowbar/client/request/proposal/create.rb +46 -0
- data/lib/crowbar/client/request/proposal/delete.rb +39 -0
- data/lib/crowbar/client/request/proposal/dequeue.rb +40 -0
- data/lib/crowbar/client/request/proposal/edit.rb +47 -0
- data/lib/crowbar/client/request/proposal/list.rb +38 -0
- data/lib/crowbar/client/request/proposal/show.rb +39 -0
- data/lib/crowbar/client/request/proposal/template.rb +39 -0
- data/lib/crowbar/client/request/repository.rb +38 -0
- data/lib/crowbar/client/request/repository/activate.rb +46 -0
- data/lib/crowbar/client/request/repository/activate_all.rb +37 -0
- data/lib/crowbar/client/request/repository/deactivate.rb +46 -0
- data/lib/crowbar/client/request/repository/deactivate_all.rb +37 -0
- data/lib/crowbar/client/request/repository/list.rb +36 -0
- data/lib/crowbar/client/request/reset.rb +29 -0
- data/lib/crowbar/client/request/reset/nodes.rb +33 -0
- data/lib/crowbar/client/request/reset/proposal.rb +33 -0
- data/lib/crowbar/client/request/role.rb +29 -0
- data/lib/crowbar/client/request/role/list.rb +38 -0
- data/lib/crowbar/client/request/role/show.rb +39 -0
- data/lib/crowbar/client/request/virtual_ip.rb +29 -0
- data/lib/crowbar/client/request/virtual_ip/allocate.rb +50 -0
- data/lib/crowbar/client/request/virtual_ip/deallocate.rb +48 -0
- data/lib/crowbar/client/util.rb +27 -0
- data/lib/crowbar/client/util/editor.rb +107 -0
- data/lib/crowbar/client/util/runner.rb +77 -0
- data/lib/crowbar/client/version.rb +33 -0
- data/spec/crowbar/client/app_spec.rb +21 -0
- data/spec/crowbar/client/command/barclamp/list_spec.rb +39 -0
- data/spec/crowbar/client/command/batch/build_spec.rb +39 -0
- data/spec/crowbar/client/command/batch/export_spec.rb +39 -0
- data/spec/crowbar/client/command/host_ip/allocate_spec.rb +39 -0
- data/spec/crowbar/client/command/host_ip/deallocate_spec.rb +39 -0
- data/spec/crowbar/client/command/interface/disable_spec.rb +39 -0
- data/spec/crowbar/client/command/interface/enable_spec.rb +39 -0
- data/spec/crowbar/client/command/node/allocate_spec.rb +39 -0
- data/spec/crowbar/client/command/node/delete_spec.rb +39 -0
- data/spec/crowbar/client/command/node/hardware_spec.rb +39 -0
- data/spec/crowbar/client/command/node/identify_spec.rb +39 -0
- data/spec/crowbar/client/command/node/list_spec.rb +39 -0
- data/spec/crowbar/client/command/node/powercycle_spec.rb +39 -0
- data/spec/crowbar/client/command/node/poweroff_spec.rb +39 -0
- data/spec/crowbar/client/command/node/poweron_spec.rb +39 -0
- data/spec/crowbar/client/command/node/reboot_spec.rb +39 -0
- data/spec/crowbar/client/command/node/reinstall_spec.rb +39 -0
- data/spec/crowbar/client/command/node/rename_spec.rb +39 -0
- data/spec/crowbar/client/command/node/reset_spec.rb +39 -0
- data/spec/crowbar/client/command/node/role_spec.rb +39 -0
- data/spec/crowbar/client/command/node/show_spec.rb +39 -0
- data/spec/crowbar/client/command/node/shutdown_spec.rb +39 -0
- data/spec/crowbar/client/command/node/status_spec.rb +39 -0
- data/spec/crowbar/client/command/node/transition_spec.rb +39 -0
- data/spec/crowbar/client/command/proposal/commit_spec.rb +39 -0
- data/spec/crowbar/client/command/proposal/create_spec.rb +61 -0
- data/spec/crowbar/client/command/proposal/delete_spec.rb +39 -0
- data/spec/crowbar/client/command/proposal/dequeue_spec.rb +39 -0
- data/spec/crowbar/client/command/proposal/edit_spec.rb +62 -0
- data/spec/crowbar/client/command/proposal/list_spec.rb +39 -0
- data/spec/crowbar/client/command/proposal/show_spec.rb +39 -0
- data/spec/crowbar/client/command/repository/activate_all_spec.rb +39 -0
- data/spec/crowbar/client/command/repository/activate_spec.rb +39 -0
- data/spec/crowbar/client/command/repository/deactivate_all_spec.rb +39 -0
- data/spec/crowbar/client/command/repository/deactivate_spec.rb +39 -0
- data/spec/crowbar/client/command/repository/list_spec.rb +39 -0
- data/spec/crowbar/client/command/reset/nodes_spec.rb +39 -0
- data/spec/crowbar/client/command/reset/proposal_spec.rb +39 -0
- data/spec/crowbar/client/command/role/list_spec.rb +39 -0
- data/spec/crowbar/client/command/role/show_spec.rb +39 -0
- data/spec/crowbar/client/command/virtual_ip/allocate_spec.rb +39 -0
- data/spec/crowbar/client/command/virtual_ip/deallocate_spec.rb +39 -0
- data/spec/crowbar/client/filter/array_spec.rb +65 -0
- data/spec/crowbar/client/filter/hash_spec.rb +65 -0
- data/spec/crowbar/client/filter/subset_spec.rb +77 -0
- data/spec/crowbar/client/formatter/array_spec.rb +102 -0
- data/spec/crowbar/client/formatter/hash_spec.rb +108 -0
- data/spec/crowbar/client/formatter/nested_spec.rb +106 -0
- data/spec/crowbar/client/request/barclamp/list_spec.rb +50 -0
- data/spec/crowbar/client/request/batch/build_spec.rb +64 -0
- data/spec/crowbar/client/request/batch/export_spec.rb +64 -0
- data/spec/crowbar/client/request/host_ip/allocate_spec.rb +61 -0
- data/spec/crowbar/client/request/host_ip/deallocate_spec.rb +57 -0
- data/spec/crowbar/client/request/interface/disable_spec.rb +57 -0
- data/spec/crowbar/client/request/interface/enable_spec.rb +57 -0
- data/spec/crowbar/client/request/node/action_spec.rb +53 -0
- data/spec/crowbar/client/request/node/delete_spec.rb +52 -0
- data/spec/crowbar/client/request/node/list_spec.rb +50 -0
- data/spec/crowbar/client/request/node/rename_spec.rb +55 -0
- data/spec/crowbar/client/request/node/role_spec.rb +55 -0
- data/spec/crowbar/client/request/node/show_spec.rb +52 -0
- data/spec/crowbar/client/request/node/status_spec.rb +50 -0
- data/spec/crowbar/client/request/node/transition_spec.rb +56 -0
- data/spec/crowbar/client/request/party_spec.rb +24 -0
- data/spec/crowbar/client/request/proposal/commit_spec.rb +53 -0
- data/spec/crowbar/client/request/proposal/create_spec.rb +56 -0
- data/spec/crowbar/client/request/proposal/delete_spec.rb +53 -0
- data/spec/crowbar/client/request/proposal/dequeue_spec.rb +53 -0
- data/spec/crowbar/client/request/proposal/edit_spec.rb +56 -0
- data/spec/crowbar/client/request/proposal/list_spec.rb +52 -0
- data/spec/crowbar/client/request/proposal/show_spec.rb +53 -0
- data/spec/crowbar/client/request/proposal/template_spec.rb +52 -0
- data/spec/crowbar/client/request/repository/activate_all_spec.rb +50 -0
- data/spec/crowbar/client/request/repository/activate_spec.rb +56 -0
- data/spec/crowbar/client/request/repository/deactivate_all_spec.rb +50 -0
- data/spec/crowbar/client/request/repository/deactivate_spec.rb +56 -0
- data/spec/crowbar/client/request/repository/list_spec.rb +50 -0
- data/spec/crowbar/client/request/reset/nodes_spec.rb +55 -0
- data/spec/crowbar/client/request/reset/proposal_spec.rb +55 -0
- data/spec/crowbar/client/request/role/list_spec.rb +52 -0
- data/spec/crowbar/client/request/role/show_spec.rb +53 -0
- data/spec/crowbar/client/request/virtual_ip/allocate_spec.rb +61 -0
- data/spec/crowbar/client/request/virtual_ip/deallocate_spec.rb +57 -0
- data/spec/crowbar/client/util/editor_spec.rb +108 -0
- data/spec/crowbar/client/util/runner_spec.rb +24 -0
- data/spec/crowbar/client_spec.rb +21 -0
- data/spec/spec_helper.rb +55 -0
- data/spec/support/command_context.rb +37 -0
- data/spec/support/request_examples.rb +55 -0
- metadata +549 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, 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
|
+
class Interface < Base
|
21
|
+
desc "enable PROPOSAL NODE NETWORK",
|
22
|
+
"Enable a network interface"
|
23
|
+
|
24
|
+
long_desc <<-LONGDESC
|
25
|
+
`enable PROPOSAL NODE NETWORK` will try to enable the
|
26
|
+
specified network interface on the specified node.
|
27
|
+
LONGDESC
|
28
|
+
|
29
|
+
def enable(proposal, node, network)
|
30
|
+
Command::Interface::Enable.new(
|
31
|
+
*command_params(
|
32
|
+
proposal: proposal,
|
33
|
+
node: node,
|
34
|
+
network: network
|
35
|
+
)
|
36
|
+
).execute
|
37
|
+
rescue SimpleCatchableError => e
|
38
|
+
err e.message, 1
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "disable PROPOSAL NODE NETWORK",
|
42
|
+
"Disable a network interface"
|
43
|
+
|
44
|
+
long_desc <<-LONGDESC
|
45
|
+
`disable PROPOSAL NODE NETWORK` will try to disable the
|
46
|
+
specified network interface on the specified node.
|
47
|
+
LONGDESC
|
48
|
+
|
49
|
+
def disable(proposal, node, network)
|
50
|
+
Command::Interface::Disable.new(
|
51
|
+
*command_params(
|
52
|
+
proposal: proposal,
|
53
|
+
node: node,
|
54
|
+
network: network
|
55
|
+
)
|
56
|
+
).execute
|
57
|
+
rescue SimpleCatchableError => e
|
58
|
+
err e.message, 1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, 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
|
+
class Network < Base
|
21
|
+
desc "virtualip [COMMANDS]",
|
22
|
+
"Actions for virtual IP addresses, call without params for help"
|
23
|
+
subcommand "virtualip", Crowbar::Client::App::VirtualIP
|
24
|
+
|
25
|
+
desc "hostip [COMMANDS]",
|
26
|
+
"Actions for host IP addresses, call without params for help"
|
27
|
+
subcommand "hostip", Crowbar::Client::App::HostIP
|
28
|
+
|
29
|
+
desc "interface [COMMANDS]",
|
30
|
+
"Actions for network interfaces, call without params for help"
|
31
|
+
subcommand "interface", Crowbar::Client::App::Interface
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,451 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, 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
|
+
class Node < Base
|
21
|
+
desc "status",
|
22
|
+
"Show current nodes status"
|
23
|
+
|
24
|
+
long_desc <<-LONGDESC
|
25
|
+
`status` will print out a list of nodes and will display some
|
26
|
+
information about the current status if it gets installed or
|
27
|
+
if it is in a ready state. You can display the list in different
|
28
|
+
output formats and you can filter the list by any search criteria.
|
29
|
+
|
30
|
+
With --format <format> option you can choose an output format
|
31
|
+
with the available options table, json or plain. You can also
|
32
|
+
use the shortcut options --table, --json or --plain.
|
33
|
+
|
34
|
+
With --filter <filter> option you can limit the result of
|
35
|
+
printed out elements. You can use any substring that is part
|
36
|
+
of the found elements.
|
37
|
+
LONGDESC
|
38
|
+
|
39
|
+
method_option :format,
|
40
|
+
type: :string,
|
41
|
+
default: "table",
|
42
|
+
banner: "<format>",
|
43
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
44
|
+
|
45
|
+
class_option :table,
|
46
|
+
type: :boolean,
|
47
|
+
default: false,
|
48
|
+
aliases: [],
|
49
|
+
desc: "Format output as table, a shortcut for --format table option"
|
50
|
+
|
51
|
+
class_option :json,
|
52
|
+
type: :boolean,
|
53
|
+
default: false,
|
54
|
+
aliases: [],
|
55
|
+
desc: "Format output as table, a shortcut for --format table option"
|
56
|
+
|
57
|
+
class_option :plain,
|
58
|
+
type: :boolean,
|
59
|
+
default: false,
|
60
|
+
aliases: [],
|
61
|
+
desc: "Format output as table, a shortcut for --format table option"
|
62
|
+
|
63
|
+
method_option :filter,
|
64
|
+
type: :string,
|
65
|
+
default: nil,
|
66
|
+
banner: "<filter>",
|
67
|
+
desc: "Filter by criteria, display only data that contains filter"
|
68
|
+
|
69
|
+
def status
|
70
|
+
Command::Node::Status.new(
|
71
|
+
*command_params
|
72
|
+
).execute
|
73
|
+
rescue SimpleCatchableError => e
|
74
|
+
err e.message, 1
|
75
|
+
end
|
76
|
+
|
77
|
+
desc "list",
|
78
|
+
"Show a list of available nodes"
|
79
|
+
|
80
|
+
long_desc <<-LONGDESC
|
81
|
+
`list` will print out a list of all available nodes as a
|
82
|
+
pretty simple and parseable list. You can display the list
|
83
|
+
in different output formats and you can filter the list by
|
84
|
+
any search criteria.
|
85
|
+
|
86
|
+
With --format <format> option you can choose an output format
|
87
|
+
with the available options table, json or plain. You can also
|
88
|
+
use the shortcut options --table, --json or --plain.
|
89
|
+
|
90
|
+
With --filter <filter> option you can limit the result of
|
91
|
+
printed out elements. You can use any substring that is part
|
92
|
+
of the found elements.
|
93
|
+
LONGDESC
|
94
|
+
|
95
|
+
method_option :format,
|
96
|
+
type: :string,
|
97
|
+
default: "table",
|
98
|
+
banner: "<format>",
|
99
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
100
|
+
|
101
|
+
class_option :table,
|
102
|
+
type: :boolean,
|
103
|
+
default: false,
|
104
|
+
aliases: [],
|
105
|
+
desc: "Format output as table, a shortcut for --format table option"
|
106
|
+
|
107
|
+
class_option :json,
|
108
|
+
type: :boolean,
|
109
|
+
default: false,
|
110
|
+
aliases: [],
|
111
|
+
desc: "Format output as table, a shortcut for --format json option"
|
112
|
+
|
113
|
+
class_option :plain,
|
114
|
+
type: :boolean,
|
115
|
+
default: false,
|
116
|
+
aliases: [],
|
117
|
+
desc: "Format output as table, a shortcut for --format plain option"
|
118
|
+
|
119
|
+
method_option :filter,
|
120
|
+
type: :string,
|
121
|
+
default: nil,
|
122
|
+
banner: "<filter>",
|
123
|
+
desc: "Filter by criteria, display only data that contains filter"
|
124
|
+
|
125
|
+
def list
|
126
|
+
Command::Node::List.new(
|
127
|
+
*command_params
|
128
|
+
).execute
|
129
|
+
rescue SimpleCatchableError => e
|
130
|
+
err e.message, 1
|
131
|
+
end
|
132
|
+
|
133
|
+
desc "show NAME_OR_ALIAS",
|
134
|
+
"Show a specific node config"
|
135
|
+
|
136
|
+
long_desc <<-LONGDESC
|
137
|
+
`show NAME_OR_ALIAS` will try to fetch the configuration
|
138
|
+
for the specified node. If you just want to see a specific
|
139
|
+
subset of the configuration you can provide the --filter
|
140
|
+
option separated by a dot for every element. If you want
|
141
|
+
to get into details of array structures you can use the
|
142
|
+
array index starting at 0 as a path segment to get further
|
143
|
+
details.
|
144
|
+
|
145
|
+
With --format <format> option you can choose an output format
|
146
|
+
with the available options table, json or plain. You can also
|
147
|
+
use the shortcut options --table, --json or --plain.
|
148
|
+
|
149
|
+
With --filter <filter> option you can limit the result of
|
150
|
+
printed out elements. You can use any substring that is part
|
151
|
+
of the found elements.
|
152
|
+
LONGDESC
|
153
|
+
|
154
|
+
method_option :format,
|
155
|
+
type: :string,
|
156
|
+
default: "table",
|
157
|
+
banner: "<format>",
|
158
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
159
|
+
|
160
|
+
class_option :table,
|
161
|
+
type: :boolean,
|
162
|
+
default: false,
|
163
|
+
aliases: [],
|
164
|
+
desc: "Format output as table, a shortcut for --format table option"
|
165
|
+
|
166
|
+
class_option :json,
|
167
|
+
type: :boolean,
|
168
|
+
default: false,
|
169
|
+
aliases: [],
|
170
|
+
desc: "Format output as table, a shortcut for --format table option"
|
171
|
+
|
172
|
+
class_option :plain,
|
173
|
+
type: :boolean,
|
174
|
+
default: false,
|
175
|
+
aliases: [],
|
176
|
+
desc: "Format output as table, a shortcut for --format table option"
|
177
|
+
|
178
|
+
method_option :filter,
|
179
|
+
type: :string,
|
180
|
+
default: nil,
|
181
|
+
banner: "<filter>",
|
182
|
+
desc: "Filter by criteria, display only data that contains filter"
|
183
|
+
|
184
|
+
def show(name)
|
185
|
+
Command::Node::Show.new(
|
186
|
+
*command_params(
|
187
|
+
name: name
|
188
|
+
)
|
189
|
+
).execute
|
190
|
+
rescue SimpleCatchableError => e
|
191
|
+
err e.message, 1
|
192
|
+
end
|
193
|
+
|
194
|
+
desc "hardware NAME_OR_ALIAS",
|
195
|
+
"Hardware update a node"
|
196
|
+
|
197
|
+
long_desc <<-LONGDESC
|
198
|
+
`hardware NAME_OR_ALIAS` will try to invoke a hardware update
|
199
|
+
for the specified node.
|
200
|
+
LONGDESC
|
201
|
+
|
202
|
+
def hardware(name)
|
203
|
+
Command::Node::Hardware.new(
|
204
|
+
*command_params(
|
205
|
+
name: name
|
206
|
+
)
|
207
|
+
).execute
|
208
|
+
rescue SimpleCatchableError => e
|
209
|
+
err e.message, 1
|
210
|
+
end
|
211
|
+
|
212
|
+
desc "identify NAME_OR_ALIAS",
|
213
|
+
"Identify the specified node"
|
214
|
+
|
215
|
+
long_desc <<-LONGDESC
|
216
|
+
`identify NAME_OR_ALIAS` will try to indentify the specified
|
217
|
+
node.
|
218
|
+
LONGDESC
|
219
|
+
|
220
|
+
def identify(name)
|
221
|
+
Command::Node::Identify.new(
|
222
|
+
*command_params(
|
223
|
+
name: name
|
224
|
+
)
|
225
|
+
).execute
|
226
|
+
rescue SimpleCatchableError => e
|
227
|
+
err e.message, 1
|
228
|
+
end
|
229
|
+
|
230
|
+
desc "delete NAME_OR_ALIAS",
|
231
|
+
"Delete the specified node"
|
232
|
+
|
233
|
+
long_desc <<-LONGDESC
|
234
|
+
`delete NAME_OR_ALIAS` will try to remove the specified
|
235
|
+
node.
|
236
|
+
LONGDESC
|
237
|
+
|
238
|
+
def delete(name)
|
239
|
+
Command::Node::Delete.new(
|
240
|
+
*command_params(
|
241
|
+
name: name
|
242
|
+
)
|
243
|
+
).execute
|
244
|
+
rescue SimpleCatchableError => e
|
245
|
+
err e.message, 1
|
246
|
+
end
|
247
|
+
|
248
|
+
desc "reinstall NAME_OR_ALIAS",
|
249
|
+
"Reinstall the specified node"
|
250
|
+
|
251
|
+
long_desc <<-LONGDESC
|
252
|
+
`reinstall NAME_OR_ALIAS` will try to reinstall the specified
|
253
|
+
node.
|
254
|
+
LONGDESC
|
255
|
+
|
256
|
+
def reinstall(name)
|
257
|
+
Command::Node::Reinstall.new(
|
258
|
+
*command_params(
|
259
|
+
name: name
|
260
|
+
)
|
261
|
+
).execute
|
262
|
+
rescue SimpleCatchableError => e
|
263
|
+
err e.message, 1
|
264
|
+
end
|
265
|
+
|
266
|
+
desc "reset NAME_OR_ALIAS",
|
267
|
+
"Reset the specified node"
|
268
|
+
|
269
|
+
long_desc <<-LONGDESC
|
270
|
+
`reset NAME_OR_ALIAS` will try to reset the specified
|
271
|
+
node.
|
272
|
+
LONGDESC
|
273
|
+
|
274
|
+
def reset(name)
|
275
|
+
Command::Node::Reset.new(
|
276
|
+
*command_params(
|
277
|
+
name: name
|
278
|
+
)
|
279
|
+
).execute
|
280
|
+
rescue SimpleCatchableError => e
|
281
|
+
err e.message, 1
|
282
|
+
end
|
283
|
+
|
284
|
+
desc "shutdown NAME_OR_ALIAS",
|
285
|
+
"Shutdown the specified node"
|
286
|
+
|
287
|
+
long_desc <<-LONGDESC
|
288
|
+
`shutdown NAME_OR_ALIAS` will try to shutdown the specified
|
289
|
+
node.
|
290
|
+
LONGDESC
|
291
|
+
|
292
|
+
def shutdown(name)
|
293
|
+
Command::Node::Shutdown.new(
|
294
|
+
*command_params(
|
295
|
+
name: name
|
296
|
+
)
|
297
|
+
).execute
|
298
|
+
rescue SimpleCatchableError => e
|
299
|
+
err e.message, 1
|
300
|
+
end
|
301
|
+
|
302
|
+
desc "reboot NAME_OR_ALIAS",
|
303
|
+
"Reboot the specified node"
|
304
|
+
|
305
|
+
long_desc <<-LONGDESC
|
306
|
+
`reboot NAME_OR_ALIAS` will try to reboot the specified
|
307
|
+
node.
|
308
|
+
LONGDESC
|
309
|
+
|
310
|
+
def reboot(name)
|
311
|
+
Command::Node::Reboot.new(
|
312
|
+
*command_params(
|
313
|
+
name: name
|
314
|
+
)
|
315
|
+
).execute
|
316
|
+
rescue SimpleCatchableError => e
|
317
|
+
err e.message, 1
|
318
|
+
end
|
319
|
+
|
320
|
+
desc "powercycle NAME_OR_ALIAS",
|
321
|
+
"Powercycle the specified node"
|
322
|
+
|
323
|
+
long_desc <<-LONGDESC
|
324
|
+
`powercycle NAME_OR_ALIAS` will try to powercycle the specified
|
325
|
+
node.
|
326
|
+
LONGDESC
|
327
|
+
|
328
|
+
def powercycle(name)
|
329
|
+
Command::Node::Powercycle.new(
|
330
|
+
*command_params(
|
331
|
+
name: name
|
332
|
+
)
|
333
|
+
).execute
|
334
|
+
rescue SimpleCatchableError => e
|
335
|
+
err e.message, 1
|
336
|
+
end
|
337
|
+
|
338
|
+
desc "poweroff NAME_OR_ALIAS",
|
339
|
+
"Poweroff the specified node"
|
340
|
+
|
341
|
+
long_desc <<-LONGDESC
|
342
|
+
`poweroff NAME_OR_ALIAS` will try to poweroff the specified
|
343
|
+
node.
|
344
|
+
LONGDESC
|
345
|
+
|
346
|
+
def poweroff(name)
|
347
|
+
Command::Node::Poweroff.new(
|
348
|
+
*command_params(
|
349
|
+
name: name
|
350
|
+
)
|
351
|
+
).execute
|
352
|
+
rescue SimpleCatchableError => e
|
353
|
+
err e.message, 1
|
354
|
+
end
|
355
|
+
|
356
|
+
desc "poweron NAME_OR_ALIAS",
|
357
|
+
"Poweron the specified node"
|
358
|
+
|
359
|
+
long_desc <<-LONGDESC
|
360
|
+
`poweron NAME_OR_ALIAS` will try to poweron the specified
|
361
|
+
node.
|
362
|
+
LONGDESC
|
363
|
+
|
364
|
+
def poweron(name)
|
365
|
+
Command::Node::Poweron.new(
|
366
|
+
*command_params(
|
367
|
+
name: name
|
368
|
+
)
|
369
|
+
).execute
|
370
|
+
rescue SimpleCatchableError => e
|
371
|
+
err e.message, 1
|
372
|
+
end
|
373
|
+
|
374
|
+
desc "allocate NAME_OR_ALIAS",
|
375
|
+
"Allocate the specified node"
|
376
|
+
|
377
|
+
long_desc <<-LONGDESC
|
378
|
+
`allocate NAME_OR_ALIAS` will try to allocate the specified
|
379
|
+
node.
|
380
|
+
LONGDESC
|
381
|
+
|
382
|
+
def allocate(name)
|
383
|
+
Command::Node::Allocate.new(
|
384
|
+
*command_params(
|
385
|
+
name: name
|
386
|
+
)
|
387
|
+
).execute
|
388
|
+
rescue SimpleCatchableError => e
|
389
|
+
err e.message, 1
|
390
|
+
end
|
391
|
+
|
392
|
+
desc "role NAME_OR_ALIAS ROLE",
|
393
|
+
"Assign an intended role to a node"
|
394
|
+
|
395
|
+
long_desc <<-LONGDESC
|
396
|
+
`role NAME_OR_ALIAS ROLE` will try to assign a intended role
|
397
|
+
to the specified node.
|
398
|
+
LONGDESC
|
399
|
+
|
400
|
+
def role(name, value)
|
401
|
+
Command::Node::Role.new(
|
402
|
+
*command_params(
|
403
|
+
name: name,
|
404
|
+
value: value
|
405
|
+
)
|
406
|
+
).execute
|
407
|
+
rescue SimpleCatchableError => e
|
408
|
+
err e.message, 1
|
409
|
+
end
|
410
|
+
|
411
|
+
desc "rename NAME_OR_ALIAS ALIAS",
|
412
|
+
"Assign an alias for a node"
|
413
|
+
|
414
|
+
long_desc <<-LONGDESC
|
415
|
+
`rename NAME_OR_ALIAS ALIAS` will try to assign an alias to
|
416
|
+
the specified node.
|
417
|
+
LONGDESC
|
418
|
+
|
419
|
+
def rename(name, value)
|
420
|
+
Command::Node::Rename.new(
|
421
|
+
*command_params(
|
422
|
+
name: name,
|
423
|
+
value: value
|
424
|
+
)
|
425
|
+
).execute
|
426
|
+
rescue SimpleCatchableError => e
|
427
|
+
err e.message, 1
|
428
|
+
end
|
429
|
+
|
430
|
+
desc "transition NAME_OR_ALIAS STATE",
|
431
|
+
"Transition a node to a specific state"
|
432
|
+
|
433
|
+
long_desc <<-LONGDESC
|
434
|
+
`transition NAME_OR_ALIAS STATE` will try totransition the
|
435
|
+
specified node into a specified state.
|
436
|
+
LONGDESC
|
437
|
+
|
438
|
+
def transition(name, state)
|
439
|
+
Command::Node::Transition.new(
|
440
|
+
*command_params(
|
441
|
+
name: name,
|
442
|
+
state: state
|
443
|
+
)
|
444
|
+
).execute
|
445
|
+
rescue SimpleCatchableError => e
|
446
|
+
err e.message, 1
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|