crowbar-client 1.0.0
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 +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,300 @@
|
|
|
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 Proposal < Base
|
|
21
|
+
desc "list BARCLAMP",
|
|
22
|
+
"Show a list of available proposals"
|
|
23
|
+
|
|
24
|
+
long_desc <<-LONGDESC
|
|
25
|
+
`list BARCLAMP` will print out a list of all available proposals
|
|
26
|
+
for a specific barclamp as a pretty simple and parseable list.
|
|
27
|
+
You can display the list in different output formats and you
|
|
28
|
+
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 json option"
|
|
56
|
+
|
|
57
|
+
class_option :plain,
|
|
58
|
+
type: :boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
aliases: [],
|
|
61
|
+
desc: "Format output as table, a shortcut for --format plain 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 list(barclamp)
|
|
70
|
+
Command::Proposal::List.new(
|
|
71
|
+
*command_params(
|
|
72
|
+
barclamp: barclamp
|
|
73
|
+
)
|
|
74
|
+
).execute
|
|
75
|
+
rescue SimpleCatchableError => e
|
|
76
|
+
err e.message, 1
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
desc "show BARCLAMP PROPOSAL",
|
|
80
|
+
"Show a proposal for specific barclamp"
|
|
81
|
+
|
|
82
|
+
long_desc <<-LONGDESC
|
|
83
|
+
`show BARCLAMP PROPOSAL` will try to fetch the configuration
|
|
84
|
+
for the specified proposal of the specified barclamp. If you
|
|
85
|
+
just want to see a specific subset of the configuration you
|
|
86
|
+
can provide the --filter option separated by a dot for every
|
|
87
|
+
element. If you want to get into details of array structures
|
|
88
|
+
you can use the array index starting at 0 as a path segment
|
|
89
|
+
to get further details.
|
|
90
|
+
|
|
91
|
+
With --format <format> option you can choose an output format
|
|
92
|
+
with the available options table, json or plain. You can also
|
|
93
|
+
use the shortcut options --table, --json or --plain.
|
|
94
|
+
|
|
95
|
+
With --filter <filter> option you can limit the result of
|
|
96
|
+
printed out elements. You can use any substring that is part
|
|
97
|
+
of the found elements.
|
|
98
|
+
LONGDESC
|
|
99
|
+
|
|
100
|
+
method_option :format,
|
|
101
|
+
type: :string,
|
|
102
|
+
default: "table",
|
|
103
|
+
banner: "<format>",
|
|
104
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
|
105
|
+
|
|
106
|
+
class_option :table,
|
|
107
|
+
type: :boolean,
|
|
108
|
+
default: false,
|
|
109
|
+
aliases: [],
|
|
110
|
+
desc: "Format output as table, a shortcut for --format table option"
|
|
111
|
+
|
|
112
|
+
class_option :json,
|
|
113
|
+
type: :boolean,
|
|
114
|
+
default: false,
|
|
115
|
+
aliases: [],
|
|
116
|
+
desc: "Format output as table, a shortcut for --format json option"
|
|
117
|
+
|
|
118
|
+
class_option :plain,
|
|
119
|
+
type: :boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
aliases: [],
|
|
122
|
+
desc: "Format output as table, a shortcut for --format plain option"
|
|
123
|
+
|
|
124
|
+
method_option :filter,
|
|
125
|
+
type: :string,
|
|
126
|
+
default: nil,
|
|
127
|
+
banner: "<filter>",
|
|
128
|
+
desc: "Filter by criteria, display only data that contains filter"
|
|
129
|
+
|
|
130
|
+
def show(barclamp, proposal)
|
|
131
|
+
Command::Proposal::Show.new(
|
|
132
|
+
*command_params(
|
|
133
|
+
barclamp: barclamp,
|
|
134
|
+
proposal: proposal
|
|
135
|
+
)
|
|
136
|
+
).execute
|
|
137
|
+
rescue SimpleCatchableError => e
|
|
138
|
+
err e.message, 1
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
desc "create BARCLAMP PROPOSAL",
|
|
142
|
+
"Create a proposal for specific barclamp"
|
|
143
|
+
|
|
144
|
+
long_desc <<-LONGDESC
|
|
145
|
+
`create BARCLAMP PROPOSAL` will create a new proposal for the
|
|
146
|
+
specified barclamp. There are multiple options how you can
|
|
147
|
+
provide the content. If you provide the data with the --data
|
|
148
|
+
or --file option the action is non interactive. If you provide
|
|
149
|
+
no option an editor will start automatically and loads a
|
|
150
|
+
template from the server.
|
|
151
|
+
|
|
152
|
+
With --data <json> option you can provide the proposal content
|
|
153
|
+
in JSON formatted as a string.
|
|
154
|
+
|
|
155
|
+
With --file <file> option you can provide a path to a file
|
|
156
|
+
which includes the content for the proposal in JSON format.
|
|
157
|
+
|
|
158
|
+
With --merge option you can deep merge the provided data with
|
|
159
|
+
the preloaded template.
|
|
160
|
+
LONGDESC
|
|
161
|
+
|
|
162
|
+
method_option :data,
|
|
163
|
+
type: :string,
|
|
164
|
+
default: nil,
|
|
165
|
+
banner: "<json>",
|
|
166
|
+
desc: "Reading proposal data from this json string"
|
|
167
|
+
|
|
168
|
+
method_option :file,
|
|
169
|
+
type: :string,
|
|
170
|
+
default: nil,
|
|
171
|
+
banner: "<file>",
|
|
172
|
+
desc: "Reading proposal data from this json file"
|
|
173
|
+
|
|
174
|
+
class_option :merge,
|
|
175
|
+
type: :boolean,
|
|
176
|
+
default: false,
|
|
177
|
+
aliases: ["-m"],
|
|
178
|
+
desc: "Merge input loaded from server with proposal data"
|
|
179
|
+
|
|
180
|
+
def create(barclamp, proposal)
|
|
181
|
+
Command::Proposal::Create.new(
|
|
182
|
+
*command_params(
|
|
183
|
+
barclamp: barclamp,
|
|
184
|
+
proposal: proposal
|
|
185
|
+
)
|
|
186
|
+
).execute
|
|
187
|
+
rescue SimpleCatchableError => e
|
|
188
|
+
err e.message, 1
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
desc "edit BARCLAMP PROPOSAL",
|
|
192
|
+
"Edit a proposal for specific barclamp"
|
|
193
|
+
|
|
194
|
+
long_desc <<-LONGDESC
|
|
195
|
+
`edit BARCLAMP PROPOSAL` will update an existing proposal for
|
|
196
|
+
the specified barclamp. There are multiple options how you can
|
|
197
|
+
provide the content. If you provide the data with the --data
|
|
198
|
+
or --file option the action is non interactive. If you provide
|
|
199
|
+
no option an editor will start automatically and loads the
|
|
200
|
+
existing proposal from the server.
|
|
201
|
+
|
|
202
|
+
With --data <json> option you can provide the proposal content
|
|
203
|
+
in JSON formatted as a string.
|
|
204
|
+
|
|
205
|
+
With --file <file> option you can provide a path to a file
|
|
206
|
+
which includes the content for the proposal in JSON format.
|
|
207
|
+
|
|
208
|
+
With --merge option you can deep merge the provided data with
|
|
209
|
+
the preloaded proposal.
|
|
210
|
+
LONGDESC
|
|
211
|
+
|
|
212
|
+
method_option :data,
|
|
213
|
+
type: :string,
|
|
214
|
+
default: nil,
|
|
215
|
+
banner: "<json>",
|
|
216
|
+
desc: "Reading proposal data from this json string"
|
|
217
|
+
|
|
218
|
+
method_option :file,
|
|
219
|
+
type: :string,
|
|
220
|
+
default: nil,
|
|
221
|
+
banner: "<file>",
|
|
222
|
+
desc: "Reading proposal data from this json file"
|
|
223
|
+
|
|
224
|
+
class_option :merge,
|
|
225
|
+
type: :boolean,
|
|
226
|
+
default: false,
|
|
227
|
+
aliases: ["-m"],
|
|
228
|
+
desc: "Merge input loaded from server with proposal data"
|
|
229
|
+
|
|
230
|
+
def edit(barclamp, proposal)
|
|
231
|
+
Command::Proposal::Edit.new(
|
|
232
|
+
*command_params(
|
|
233
|
+
barclamp: barclamp,
|
|
234
|
+
proposal: proposal
|
|
235
|
+
)
|
|
236
|
+
).execute
|
|
237
|
+
rescue SimpleCatchableError => e
|
|
238
|
+
err e.message, 1
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
desc "delete BARCLAMP PROPOSAL",
|
|
242
|
+
"Delete a proposal for specific barclamp"
|
|
243
|
+
|
|
244
|
+
long_desc <<-LONGDESC
|
|
245
|
+
`delete BARCLAMP PROPOSAL` will try to remove the specified
|
|
246
|
+
proposal for the specified barclamp.
|
|
247
|
+
LONGDESC
|
|
248
|
+
|
|
249
|
+
def delete(barclamp, proposal)
|
|
250
|
+
Command::Proposal::Delete.new(
|
|
251
|
+
*command_params(
|
|
252
|
+
barclamp: barclamp,
|
|
253
|
+
proposal: proposal
|
|
254
|
+
)
|
|
255
|
+
).execute
|
|
256
|
+
rescue SimpleCatchableError => e
|
|
257
|
+
err e.message, 1
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
desc "dequeue BARCLAMP PROPOSAL",
|
|
261
|
+
"Dequeue a proposal for specific barclamp"
|
|
262
|
+
|
|
263
|
+
long_desc <<-LONGDESC
|
|
264
|
+
`dequeue BARCLAMP PROPOSAL` will try to dequeue the specified
|
|
265
|
+
proposal for the specified barclamp.
|
|
266
|
+
LONGDESC
|
|
267
|
+
|
|
268
|
+
def dequeue(barclamp, proposal)
|
|
269
|
+
Command::Proposal::Dequeue.new(
|
|
270
|
+
*command_params(
|
|
271
|
+
barclamp: barclamp,
|
|
272
|
+
proposal: proposal
|
|
273
|
+
)
|
|
274
|
+
).execute
|
|
275
|
+
rescue SimpleCatchableError => e
|
|
276
|
+
err e.message, 1
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
desc "commit BARCLAMP PROPOSAL",
|
|
280
|
+
"Commit a proposal for specific barclamp"
|
|
281
|
+
|
|
282
|
+
long_desc <<-LONGDESC
|
|
283
|
+
`commit BARCLAMP PROPOSAL` will try to commit the specified
|
|
284
|
+
proposal for the specified barclamp.
|
|
285
|
+
LONGDESC
|
|
286
|
+
|
|
287
|
+
def commit(barclamp, proposal)
|
|
288
|
+
Command::Proposal::Commit.new(
|
|
289
|
+
*command_params(
|
|
290
|
+
barclamp: barclamp,
|
|
291
|
+
proposal: proposal
|
|
292
|
+
)
|
|
293
|
+
).execute
|
|
294
|
+
rescue SimpleCatchableError => e
|
|
295
|
+
err e.message, 1
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
end
|
|
@@ -0,0 +1,149 @@
|
|
|
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 Repository < Base
|
|
21
|
+
desc "list",
|
|
22
|
+
"List all available repositories"
|
|
23
|
+
|
|
24
|
+
long_desc <<-LONGDESC
|
|
25
|
+
`list` will print out a list of the available repositories
|
|
26
|
+
including the information for which platform it is available.
|
|
27
|
+
You can display the list in different output formats and you
|
|
28
|
+
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 json option"
|
|
56
|
+
|
|
57
|
+
class_option :plain,
|
|
58
|
+
type: :boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
aliases: [],
|
|
61
|
+
desc: "Format output as table, a shortcut for --format plain 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 list
|
|
70
|
+
Command::Repository::List.new(
|
|
71
|
+
*command_params
|
|
72
|
+
).execute
|
|
73
|
+
rescue SimpleCatchableError => e
|
|
74
|
+
err e.message, 1
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
desc "activate PLATFORM REPO",
|
|
78
|
+
"Activate a repository for a platform"
|
|
79
|
+
|
|
80
|
+
long_desc <<-LONGDESC
|
|
81
|
+
`activate PLATFORM REPO` will try to activate the
|
|
82
|
+
specified repository for the specified platform.
|
|
83
|
+
LONGDESC
|
|
84
|
+
|
|
85
|
+
def activate(platform, repo)
|
|
86
|
+
Command::Repository::Activate.new(
|
|
87
|
+
*command_params(
|
|
88
|
+
platform: platform,
|
|
89
|
+
repo: repo
|
|
90
|
+
)
|
|
91
|
+
).execute
|
|
92
|
+
rescue SimpleCatchableError => e
|
|
93
|
+
err e.message, 1
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
desc "activate-all",
|
|
97
|
+
"Activate all repositories"
|
|
98
|
+
|
|
99
|
+
long_desc <<-LONGDESC
|
|
100
|
+
`activate-all` will try to activate all available
|
|
101
|
+
repositories.
|
|
102
|
+
LONGDESC
|
|
103
|
+
|
|
104
|
+
def activate_all
|
|
105
|
+
Command::Repository::ActivateAll.new(
|
|
106
|
+
*command_params
|
|
107
|
+
).execute
|
|
108
|
+
rescue SimpleCatchableError => e
|
|
109
|
+
err e.message, 1
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
desc "deactivate PLATFORM REPO",
|
|
113
|
+
"Deactivate a repository for a platform"
|
|
114
|
+
|
|
115
|
+
long_desc <<-LONGDESC
|
|
116
|
+
`deactivate PLATFORM REPO` will try to deactivate the
|
|
117
|
+
specified repository for the specified platform.
|
|
118
|
+
LONGDESC
|
|
119
|
+
|
|
120
|
+
def deactivate(platform, repo)
|
|
121
|
+
Command::Repository::Deactivate.new(
|
|
122
|
+
*command_params(
|
|
123
|
+
platform: platform,
|
|
124
|
+
repo: repo
|
|
125
|
+
)
|
|
126
|
+
).execute
|
|
127
|
+
rescue SimpleCatchableError => e
|
|
128
|
+
err e.message, 1
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
desc "deactivate-all",
|
|
132
|
+
"Deactivate all repositories"
|
|
133
|
+
|
|
134
|
+
long_desc <<-LONGDESC
|
|
135
|
+
`deactivate-all` will try to deactivate all available
|
|
136
|
+
repositories.
|
|
137
|
+
LONGDESC
|
|
138
|
+
|
|
139
|
+
def deactivate_all
|
|
140
|
+
Command::Repository::DeactivateAll.new(
|
|
141
|
+
*command_params
|
|
142
|
+
).execute
|
|
143
|
+
rescue SimpleCatchableError => e
|
|
144
|
+
err e.message, 1
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
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 Reset < Base
|
|
21
|
+
desc "proposal BARCLAMP [PROPOSAL]",
|
|
22
|
+
"Reset specific proposal"
|
|
23
|
+
|
|
24
|
+
long_desc <<-LONGDESC
|
|
25
|
+
`proposal BARCLAMP [PROPOSAL]` will try to reset the state
|
|
26
|
+
for the specified barclamp or optional proposal.
|
|
27
|
+
LONGDESC
|
|
28
|
+
|
|
29
|
+
def proposal(barclamp, proposal = nil)
|
|
30
|
+
Command::Reset::Proposal.new(
|
|
31
|
+
*command_params(
|
|
32
|
+
barclamp: barclamp,
|
|
33
|
+
proposal: proposal
|
|
34
|
+
)
|
|
35
|
+
).execute
|
|
36
|
+
rescue SimpleCatchableError => e
|
|
37
|
+
err e.message, 1
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
desc "nodes",
|
|
41
|
+
"Reset all nodes state"
|
|
42
|
+
|
|
43
|
+
long_desc <<-LONGDESC
|
|
44
|
+
`nodes` will try to reset the state of all known nodes within
|
|
45
|
+
the cluster.
|
|
46
|
+
LONGDESC
|
|
47
|
+
|
|
48
|
+
def nodes
|
|
49
|
+
Command::Reset::Nodes.new(
|
|
50
|
+
*command_params
|
|
51
|
+
).execute
|
|
52
|
+
rescue SimpleCatchableError => e
|
|
53
|
+
err e.message, 1
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|