crowbar-client 2.4.1 → 2.4.2
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 +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +18 -6
- data/lib/crowbar/client.rb +54 -0
- data/lib/crowbar/client/app.rb +3 -0
- data/lib/crowbar/client/app/backup.rb +62 -1
- data/lib/crowbar/client/app/barclamp.rb +10 -0
- data/lib/crowbar/client/app/base.rb +50 -0
- data/lib/crowbar/client/app/batch.rb +25 -0
- data/lib/crowbar/client/app/entry.rb +26 -1
- data/lib/crowbar/client/app/host_ip.rb +24 -0
- data/lib/crowbar/client/app/installer.rb +16 -1
- data/lib/crowbar/client/app/interface.rb +21 -0
- data/lib/crowbar/client/app/network.rb +3 -0
- data/lib/crowbar/client/app/node.rb +3 -0
- data/lib/crowbar/client/app/proposal.rb +3 -0
- data/lib/crowbar/client/app/repository.rb +3 -0
- data/lib/crowbar/client/app/role.rb +3 -0
- data/lib/crowbar/client/app/server.rb +56 -0
- data/lib/crowbar/client/app/virtual_ip.rb +24 -0
- data/lib/crowbar/client/command.rb +3 -0
- data/lib/crowbar/client/command/backup.rb +3 -0
- data/lib/crowbar/client/command/backup/create.rb +3 -0
- data/lib/crowbar/client/command/backup/delete.rb +3 -0
- data/lib/crowbar/client/command/backup/download.rb +3 -0
- data/lib/crowbar/client/command/backup/list.rb +3 -0
- data/lib/crowbar/client/command/backup/restore.rb +3 -0
- data/lib/crowbar/client/command/backup/upload.rb +3 -0
- data/lib/crowbar/client/command/barclamp.rb +3 -0
- data/lib/crowbar/client/command/barclamp/list.rb +3 -0
- data/lib/crowbar/client/command/base.rb +3 -0
- data/lib/crowbar/client/command/batch.rb +3 -0
- data/lib/crowbar/client/command/batch/build.rb +3 -0
- data/lib/crowbar/client/command/batch/export.rb +3 -0
- data/lib/crowbar/client/command/host_ip.rb +3 -0
- data/lib/crowbar/client/command/host_ip/allocate.rb +3 -0
- data/lib/crowbar/client/command/host_ip/deallocate.rb +3 -0
- data/lib/crowbar/client/command/installer.rb +3 -0
- data/lib/crowbar/client/command/installer/start.rb +3 -0
- data/lib/crowbar/client/command/installer/status.rb +3 -0
- data/lib/crowbar/client/command/interface.rb +3 -0
- data/lib/crowbar/client/command/interface/disable.rb +3 -0
- data/lib/crowbar/client/command/interface/enable.rb +3 -0
- data/lib/crowbar/client/command/node.rb +3 -0
- data/lib/crowbar/client/command/node/allocate.rb +4 -1
- data/lib/crowbar/client/command/node/delete.rb +3 -0
- data/lib/crowbar/client/command/node/group.rb +3 -0
- data/lib/crowbar/client/command/node/hardware.rb +4 -1
- data/lib/crowbar/client/command/node/identify.rb +4 -1
- data/lib/crowbar/client/command/node/list.rb +3 -0
- data/lib/crowbar/client/command/node/powercycle.rb +4 -1
- data/lib/crowbar/client/command/node/poweroff.rb +4 -1
- data/lib/crowbar/client/command/node/poweron.rb +4 -1
- data/lib/crowbar/client/command/node/reboot.rb +4 -1
- data/lib/crowbar/client/command/node/reinstall.rb +4 -1
- data/lib/crowbar/client/command/node/rename.rb +3 -0
- data/lib/crowbar/client/command/node/reset.rb +4 -1
- data/lib/crowbar/client/command/node/role.rb +3 -0
- data/lib/crowbar/client/command/node/show.rb +3 -0
- data/lib/crowbar/client/command/node/shutdown.rb +4 -1
- data/lib/crowbar/client/command/node/status.rb +3 -0
- data/lib/crowbar/client/command/node/transition.rb +3 -0
- data/lib/crowbar/client/command/proposal.rb +3 -0
- data/lib/crowbar/client/command/proposal/commit.rb +3 -0
- data/lib/crowbar/client/command/proposal/create.rb +3 -0
- data/lib/crowbar/client/command/proposal/delete.rb +3 -0
- data/lib/crowbar/client/command/proposal/dequeue.rb +3 -0
- data/lib/crowbar/client/command/proposal/edit.rb +3 -0
- data/lib/crowbar/client/command/proposal/list.rb +3 -0
- data/lib/crowbar/client/command/proposal/reset.rb +3 -0
- data/lib/crowbar/client/command/proposal/show.rb +3 -0
- data/lib/crowbar/client/command/repository.rb +3 -0
- data/lib/crowbar/client/command/repository/activate.rb +3 -0
- data/lib/crowbar/client/command/repository/activate_all.rb +3 -0
- data/lib/crowbar/client/command/repository/deactivate.rb +3 -0
- data/lib/crowbar/client/command/repository/deactivate_all.rb +3 -0
- data/lib/crowbar/client/command/repository/list.rb +3 -0
- data/lib/crowbar/client/command/role.rb +3 -0
- data/lib/crowbar/client/command/role/list.rb +3 -0
- data/lib/crowbar/client/command/role/show.rb +3 -0
- data/lib/crowbar/client/command/server.rb +5 -0
- data/lib/crowbar/client/command/server/api.rb +3 -0
- data/lib/crowbar/client/command/server/check.rb +75 -0
- data/lib/crowbar/client/command/virtual_ip.rb +3 -0
- data/lib/crowbar/client/command/virtual_ip/allocate.rb +3 -0
- data/lib/crowbar/client/command/virtual_ip/deallocate.rb +3 -0
- data/lib/crowbar/client/config.rb +128 -1
- data/lib/crowbar/client/filter.rb +3 -0
- data/lib/crowbar/client/filter/array.rb +3 -0
- data/lib/crowbar/client/filter/base.rb +3 -0
- data/lib/crowbar/client/filter/hash.rb +3 -0
- data/lib/crowbar/client/filter/subset.rb +3 -0
- data/lib/crowbar/client/formatter.rb +3 -0
- data/lib/crowbar/client/formatter/array.rb +3 -0
- data/lib/crowbar/client/formatter/base.rb +3 -0
- data/lib/crowbar/client/formatter/hash.rb +3 -0
- data/lib/crowbar/client/formatter/nested.rb +3 -0
- data/lib/crowbar/client/mixin.rb +3 -0
- data/lib/crowbar/client/mixin/barclamp.rb +3 -0
- data/lib/crowbar/client/mixin/filter.rb +3 -0
- data/lib/crowbar/client/mixin/format.rb +3 -0
- data/lib/crowbar/client/request.rb +3 -0
- data/lib/crowbar/client/request/backup.rb +3 -0
- data/lib/crowbar/client/request/backup/create.rb +18 -0
- data/lib/crowbar/client/request/backup/delete.rb +13 -0
- data/lib/crowbar/client/request/backup/download.rb +13 -0
- data/lib/crowbar/client/request/backup/list.rb +13 -0
- data/lib/crowbar/client/request/backup/restore.rb +13 -0
- data/lib/crowbar/client/request/backup/upload.rb +13 -0
- data/lib/crowbar/client/request/barclamp.rb +3 -0
- data/lib/crowbar/client/request/barclamp/list.rb +13 -0
- data/lib/crowbar/client/request/base.rb +42 -11
- data/lib/crowbar/client/request/batch.rb +3 -0
- data/lib/crowbar/client/request/batch/build.rb +13 -0
- data/lib/crowbar/client/request/batch/export.rb +18 -0
- data/lib/crowbar/client/request/host_ip.rb +3 -0
- data/lib/crowbar/client/request/host_ip/allocate.rb +18 -0
- data/lib/crowbar/client/request/host_ip/deallocate.rb +18 -0
- data/lib/crowbar/client/request/installer.rb +3 -0
- data/lib/crowbar/client/request/installer/start.rb +18 -0
- data/lib/crowbar/client/request/installer/status.rb +13 -0
- data/lib/crowbar/client/request/interface.rb +3 -0
- data/lib/crowbar/client/request/interface/disable.rb +18 -0
- data/lib/crowbar/client/request/interface/enable.rb +18 -0
- data/lib/crowbar/client/request/node.rb +33 -0
- data/lib/crowbar/client/request/node/action.rb +13 -0
- data/lib/crowbar/client/request/node/allocate.rb +29 -0
- data/lib/crowbar/client/request/node/delete.rb +13 -0
- data/lib/crowbar/client/request/node/group.rb +13 -0
- data/lib/crowbar/client/request/node/hardware.rb +29 -0
- data/lib/crowbar/client/request/node/identify.rb +29 -0
- data/lib/crowbar/client/request/node/list.rb +13 -0
- data/lib/crowbar/client/request/node/powercycle.rb +29 -0
- data/lib/crowbar/client/request/node/poweroff.rb +29 -0
- data/lib/crowbar/client/request/node/poweron.rb +29 -0
- data/lib/crowbar/client/request/node/reboot.rb +29 -0
- data/lib/crowbar/client/request/node/reinstall.rb +29 -0
- data/lib/crowbar/client/request/node/rename.rb +18 -0
- data/lib/crowbar/client/request/node/reset.rb +29 -0
- data/lib/crowbar/client/request/node/role.rb +18 -0
- data/lib/crowbar/client/request/node/show.rb +13 -0
- data/lib/crowbar/client/request/node/shutdown.rb +29 -0
- data/lib/crowbar/client/request/node/status.rb +13 -0
- data/lib/crowbar/client/request/node/transition.rb +18 -0
- data/lib/crowbar/client/request/party.rb +3 -0
- data/lib/crowbar/client/request/proposal.rb +3 -0
- data/lib/crowbar/client/request/proposal/commit.rb +13 -0
- data/lib/crowbar/client/request/proposal/create.rb +18 -0
- data/lib/crowbar/client/request/proposal/delete.rb +13 -0
- data/lib/crowbar/client/request/proposal/dequeue.rb +13 -0
- data/lib/crowbar/client/request/proposal/edit.rb +18 -0
- data/lib/crowbar/client/request/proposal/list.rb +13 -0
- data/lib/crowbar/client/request/proposal/reset.rb +13 -0
- data/lib/crowbar/client/request/proposal/show.rb +13 -0
- data/lib/crowbar/client/request/proposal/template.rb +13 -0
- data/lib/crowbar/client/request/repository.rb +3 -0
- data/lib/crowbar/client/request/repository/activate.rb +18 -0
- data/lib/crowbar/client/request/repository/activate_all.rb +13 -0
- data/lib/crowbar/client/request/repository/deactivate.rb +18 -0
- data/lib/crowbar/client/request/repository/deactivate_all.rb +13 -0
- data/lib/crowbar/client/request/repository/list.rb +13 -0
- data/lib/crowbar/client/request/role.rb +3 -0
- data/lib/crowbar/client/request/role/list.rb +13 -0
- data/lib/crowbar/client/request/role/show.rb +13 -0
- data/lib/crowbar/client/request/server.rb +5 -0
- data/lib/crowbar/client/request/server/api.rb +13 -0
- data/lib/crowbar/client/request/server/check.rb +49 -0
- data/lib/crowbar/client/request/virtual_ip.rb +3 -0
- data/lib/crowbar/client/request/virtual_ip/allocate.rb +18 -0
- data/lib/crowbar/client/request/virtual_ip/deallocate.rb +18 -0
- data/lib/crowbar/client/util.rb +3 -0
- data/lib/crowbar/client/util/editor.rb +3 -0
- data/lib/crowbar/client/util/runner.rb +3 -0
- data/lib/crowbar/client/version.rb +23 -1
- data/spec/crowbar/client/command/backup/create_spec.rb +8 -16
- data/spec/crowbar/client/command/backup/delete_spec.rb +8 -16
- data/spec/crowbar/client/command/backup/download_spec.rb +8 -16
- data/spec/crowbar/client/command/backup/list_spec.rb +7 -15
- data/spec/crowbar/client/command/backup/restore_spec.rb +8 -16
- data/spec/crowbar/client/command/backup/upload_spec.rb +11 -19
- data/spec/crowbar/client/command/barclamp/list_spec.rb +7 -15
- data/spec/crowbar/client/command/batch/build_spec.rb +11 -19
- data/spec/crowbar/client/command/batch/export_spec.rb +7 -15
- data/spec/crowbar/client/command/host_ip/allocate_spec.rb +7 -15
- data/spec/crowbar/client/command/host_ip/deallocate_spec.rb +7 -15
- data/spec/crowbar/client/command/installer/start_spec.rb +8 -16
- data/spec/crowbar/client/command/installer/status_spec.rb +7 -15
- data/spec/crowbar/client/command/interface/disable_spec.rb +7 -15
- data/spec/crowbar/client/command/interface/enable_spec.rb +7 -15
- data/spec/crowbar/client/command/node/allocate_spec.rb +7 -15
- data/spec/crowbar/client/command/node/delete_spec.rb +7 -15
- data/spec/crowbar/client/command/node/group_spec.rb +7 -15
- data/spec/crowbar/client/command/node/hardware_spec.rb +7 -15
- data/spec/crowbar/client/command/node/identify_spec.rb +7 -15
- data/spec/crowbar/client/command/node/list_spec.rb +9 -17
- data/spec/crowbar/client/command/node/powercycle_spec.rb +7 -15
- data/spec/crowbar/client/command/node/poweroff_spec.rb +7 -15
- data/spec/crowbar/client/command/node/poweron_spec.rb +7 -15
- data/spec/crowbar/client/command/node/reboot_spec.rb +7 -15
- data/spec/crowbar/client/command/node/reinstall_spec.rb +7 -15
- data/spec/crowbar/client/command/node/rename_spec.rb +7 -15
- data/spec/crowbar/client/command/node/reset_spec.rb +7 -15
- data/spec/crowbar/client/command/node/role_spec.rb +7 -15
- data/spec/crowbar/client/command/node/show_spec.rb +7 -15
- data/spec/crowbar/client/command/node/shutdown_spec.rb +7 -15
- data/spec/crowbar/client/command/node/status_spec.rb +7 -15
- data/spec/crowbar/client/command/node/transition_spec.rb +7 -15
- data/spec/crowbar/client/command/proposal/commit_spec.rb +7 -15
- data/spec/crowbar/client/command/proposal/delete_spec.rb +7 -15
- data/spec/crowbar/client/command/proposal/dequeue_spec.rb +7 -15
- data/spec/crowbar/client/command/proposal/list_spec.rb +7 -15
- data/spec/crowbar/client/command/proposal/reset_spec.rb +7 -15
- data/spec/crowbar/client/command/proposal/show_spec.rb +7 -15
- data/spec/crowbar/client/command/repository/activate_all_spec.rb +7 -15
- data/spec/crowbar/client/command/repository/activate_spec.rb +7 -15
- data/spec/crowbar/client/command/repository/deactivate_all_spec.rb +7 -15
- data/spec/crowbar/client/command/repository/deactivate_spec.rb +7 -15
- data/spec/crowbar/client/command/repository/list_spec.rb +7 -15
- data/spec/crowbar/client/command/role/list_spec.rb +7 -15
- data/spec/crowbar/client/command/role/show_spec.rb +7 -15
- data/spec/crowbar/client/command/server/api_spec.rb +7 -15
- data/spec/crowbar/client/command/server/check_spec.rb +31 -0
- data/spec/crowbar/client/command/virtual_ip/allocate_spec.rb +7 -15
- data/spec/crowbar/client/command/virtual_ip/deallocate_spec.rb +7 -15
- data/spec/crowbar/client/request/server/check_spec.rb +50 -0
- data/spec/support/command_examples.rb +59 -0
- metadata +117 -95
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1c168edc28fee98083d4a8fa4e2241956b79cec
|
4
|
+
data.tar.gz: cbb8ea40deeb4a95c12ca7113fdcde04878631a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba3640b9f7d4828acde6300d6324b5856f818eee8b99859b9827b5f25a4caa90929882a4b2cf4e5287ae7b3a9f5f2e09df13a17a7bcb887e20442a0810a1735
|
7
|
+
data.tar.gz: 1243a8524c37791076b30e09d15e36dc7a60f13558a99ca9e407acc3f656c59ed2d424919550cea4ac46842d99a81229df4405cb458a907be452dca939fa18b2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.4.2](https://github.com/crowbar/crowbar-client/releases/tag/v2.4.2) - 2015-05-04
|
4
|
+
|
5
|
+
* BUGFIX
|
6
|
+
* Fixed duplicate option, renamed --anonymous shorthand from -a to -A (@tboerger)
|
7
|
+
* Raised timeout default value to prevent timeouts on requests (@MaximilianMeister)
|
8
|
+
* Pin development dependency listen to ruby 2.1 compatible version (@tboerger)
|
9
|
+
* ENHANCEMENT
|
10
|
+
* Properly handle 502, 503 and 504 responses (@tboerger)
|
11
|
+
* Map -h and --help options properly to help subcommand (@tboerger)
|
12
|
+
* Extended the test suite (@MaximilianMeister)
|
13
|
+
* Enhanched the inline documentation (@tboerger)
|
14
|
+
* Added subcommand to check server sanity (@MaximilianMeister)
|
15
|
+
|
3
16
|
## [2.4.1](https://github.com/crowbar/crowbar-client/releases/tag/v2.4.1) - 2015-02-08
|
4
17
|
|
5
18
|
* BUGFIX
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Crowbar: Client
|
2
2
|
|
3
|
-
This is
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
This tool is a complete reimplementation of the old CLI scripts of Crowbar.
|
4
|
+
It is intended to be installable standalone on any machine with access to
|
5
|
+
the Crowbar admin network. It is the **recommended command line interface** to manage
|
6
|
+
Crowbar from remote or locally on the Crowbar server itself.
|
7
7
|
|
8
8
|
The [Crowbar Framework](https://github.com/crowbar/crowbar) is currently
|
9
9
|
maintained by [SUSE](http://www.suse.com/) as an [OpenStack](http://openstack.org)
|
@@ -16,18 +16,30 @@ was originally developed by the [Dell CloudEdge Solutions Team](http://dell.com/
|
|
16
16
|
[](https://codeclimate.com/github/crowbar/crowbar-client)
|
17
17
|
[](https://codeclimate.com/github/crowbar/crowbar-client)
|
18
18
|
[](https://gemnasium.com/crowbar/crowbar-client)
|
19
|
+
[](http://inch-ci.org/github/crowbar/crowbar-client)
|
19
20
|
[](https://gitter.im/crowbar/crowbar)
|
20
21
|
|
21
22
|
## Install
|
22
23
|
|
23
|
-
To install this simple
|
24
|
-
available for you,
|
24
|
+
To install this simple ruby gem you can check your package manager if it is
|
25
|
+
available for you, alternatively you can just install the ruby gem if you have a
|
25
26
|
running ruby stack on your machine with this command:
|
26
27
|
|
27
28
|
```
|
28
29
|
gem install crowbar-client
|
29
30
|
```
|
30
31
|
|
32
|
+
## Configuration
|
33
|
+
|
34
|
+
`crowbar-client` can be configured by placing a `.crowbarrc` file in your `$HOME` directory.
|
35
|
+
For details about the options see the [default configuration file](config/crowbarrc).
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
```
|
40
|
+
crowbarctl help
|
41
|
+
```
|
42
|
+
|
31
43
|
## Contributing
|
32
44
|
|
33
45
|
Fork -> Patch -> Spec -> Push -> Pull Request
|
data/lib/crowbar/client.rb
CHANGED
@@ -24,37 +24,91 @@ end
|
|
24
24
|
require "active_support/all"
|
25
25
|
|
26
26
|
module Crowbar
|
27
|
+
#
|
28
|
+
# Client for the Crowbar API
|
29
|
+
#
|
27
30
|
module Client
|
31
|
+
#
|
32
|
+
# Error class that always gets caught by the client
|
33
|
+
#
|
28
34
|
class SimpleCatchableError < StandardError
|
29
35
|
end
|
30
36
|
|
37
|
+
#
|
38
|
+
# Error class to catch invalid options
|
39
|
+
#
|
31
40
|
class BadOptionsError < SimpleCatchableError
|
32
41
|
end
|
33
42
|
|
43
|
+
#
|
44
|
+
# Error class to catch unsupported formatters
|
45
|
+
#
|
34
46
|
class BadFormatterError < SimpleCatchableError
|
35
47
|
end
|
36
48
|
|
49
|
+
#
|
50
|
+
# Error class to catch unsupported filters
|
51
|
+
#
|
37
52
|
class BadFilterError < SimpleCatchableError
|
38
53
|
end
|
39
54
|
|
55
|
+
#
|
56
|
+
# Error class to catch invalid formats
|
57
|
+
#
|
40
58
|
class InvalidFormatError < SimpleCatchableError
|
41
59
|
end
|
42
60
|
|
61
|
+
#
|
62
|
+
# Error class to catch a closed editor exception
|
63
|
+
#
|
43
64
|
class EditorAbortError < SimpleCatchableError
|
44
65
|
end
|
45
66
|
|
67
|
+
#
|
68
|
+
# Error class to catch a editor startup exception
|
69
|
+
#
|
46
70
|
class EditorStartupError < SimpleCatchableError
|
47
71
|
end
|
48
72
|
|
73
|
+
#
|
74
|
+
# Error class to catch JSON parsing errors
|
75
|
+
#
|
49
76
|
class InvalidJsonError < SimpleCatchableError
|
50
77
|
end
|
51
78
|
|
79
|
+
#
|
80
|
+
# Error class to catch internal server errors
|
81
|
+
#
|
52
82
|
class InternalServerError < SimpleCatchableError
|
53
83
|
end
|
54
84
|
|
85
|
+
#
|
86
|
+
# Error class to catch bad gateway responses
|
87
|
+
#
|
88
|
+
class BadGatewayError < SimpleCatchableError
|
89
|
+
end
|
90
|
+
|
91
|
+
#
|
92
|
+
# Error class to catch service unavailable responses
|
93
|
+
#
|
94
|
+
class ServiceUnavailableError < SimpleCatchableError
|
95
|
+
end
|
96
|
+
|
97
|
+
#
|
98
|
+
# Error class to catch gateway timeout responses
|
99
|
+
#
|
100
|
+
class GatewayTimeoutError < SimpleCatchableError
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# Error class to catch unauthorized responses
|
105
|
+
#
|
55
106
|
class NotAuthorizedError < SimpleCatchableError
|
56
107
|
end
|
57
108
|
|
109
|
+
#
|
110
|
+
# Error class to catch unavailable barclamps
|
111
|
+
#
|
58
112
|
class UnavailableBarclampError < SimpleCatchableError
|
59
113
|
def initialize(barclamp)
|
60
114
|
super("Barclamp #{barclamp} is not available")
|
data/lib/crowbar/client/app.rb
CHANGED
@@ -17,6 +17,9 @@
|
|
17
17
|
module Crowbar
|
18
18
|
module Client
|
19
19
|
module App
|
20
|
+
#
|
21
|
+
# A Thor based CLI wrapper for backup commands
|
22
|
+
#
|
20
23
|
class Backup < Base
|
21
24
|
desc "list",
|
22
25
|
"List existing backups"
|
@@ -65,6 +68,13 @@ module Crowbar
|
|
65
68
|
banner: "<filter>",
|
66
69
|
desc: "Filter by criteria, display only data that contains filter"
|
67
70
|
|
71
|
+
#
|
72
|
+
# Backup list command
|
73
|
+
#
|
74
|
+
# It will print out a list of existing backups on the server.
|
75
|
+
# You can display the list in different output formats and you
|
76
|
+
# can filter the list by any search criteria.
|
77
|
+
#
|
68
78
|
def list
|
69
79
|
Command::Backup::List.new(
|
70
80
|
*command_params
|
@@ -91,6 +101,14 @@ module Crowbar
|
|
91
101
|
aliases: [],
|
92
102
|
desc: "Force the restore without any confirmation message"
|
93
103
|
|
104
|
+
#
|
105
|
+
# Backup restore command
|
106
|
+
#
|
107
|
+
# It will trigger the restore process based on the specified backup
|
108
|
+
# name. This command will override the proposals of your server.
|
109
|
+
#
|
110
|
+
# @param name [String] the name of the backup
|
111
|
+
#
|
94
112
|
def restore(name)
|
95
113
|
unless accepts_restore?
|
96
114
|
say "Canceled restore"
|
@@ -112,9 +130,18 @@ module Crowbar
|
|
112
130
|
long_desc <<-LONGDESC
|
113
131
|
`create NAME` will trigger the creation of a new backup on the
|
114
132
|
server, to download the backup after processing you can use the
|
115
|
-
|
133
|
+
download command.
|
116
134
|
LONGDESC
|
117
135
|
|
136
|
+
#
|
137
|
+
# Backup create command
|
138
|
+
#
|
139
|
+
# It will trigger the creation of a new backup on the server, to
|
140
|
+
# download the backup after processing you can use the download
|
141
|
+
# command.
|
142
|
+
#
|
143
|
+
# @param name [String] the name of the backup
|
144
|
+
#
|
118
145
|
def create(name)
|
119
146
|
Command::Backup::Create.new(
|
120
147
|
*command_params(
|
@@ -134,6 +161,14 @@ module Crowbar
|
|
134
161
|
deletion.
|
135
162
|
LONGDESC
|
136
163
|
|
164
|
+
#
|
165
|
+
# Backup delete command
|
166
|
+
#
|
167
|
+
# It will delete a backup from the server. Be careful with that
|
168
|
+
# command, you are not able to restore this file after deletion.
|
169
|
+
#
|
170
|
+
# @param name [String] the name of the backup
|
171
|
+
#
|
137
172
|
def delete(name)
|
138
173
|
Command::Backup::Delete.new(
|
139
174
|
*command_params(
|
@@ -152,6 +187,14 @@ module Crowbar
|
|
152
187
|
this backup later to trigger a restore.
|
153
188
|
LONGDESC
|
154
189
|
|
190
|
+
#
|
191
|
+
# Backup upload command
|
192
|
+
#
|
193
|
+
# It will upload a backup to the server. You can use this backup
|
194
|
+
# later to trigger a restore.
|
195
|
+
#
|
196
|
+
# @param file [String] the path to the file
|
197
|
+
#
|
155
198
|
def upload(file)
|
156
199
|
Command::Backup::Upload.new(
|
157
200
|
*command_params(
|
@@ -175,6 +218,19 @@ module Crowbar
|
|
175
218
|
filename.
|
176
219
|
LONGDESC
|
177
220
|
|
221
|
+
#
|
222
|
+
# Backup download command
|
223
|
+
#
|
224
|
+
# It will download a backup from the server. If you specify a `file`
|
225
|
+
# the download gets written to that file, otherwise it gets saved
|
226
|
+
# to the current working directory with an automatically generated
|
227
|
+
# filename. You can directly provide a path to a file or just pipe
|
228
|
+
# the content to stdout. To pipe the content to stdout you should
|
229
|
+
# just write a `-` instead of a specific filename.
|
230
|
+
#
|
231
|
+
# @param name [String] the name of the backup
|
232
|
+
# @param file [String] the path of the file
|
233
|
+
#
|
178
234
|
def download(name, file = nil)
|
179
235
|
Command::Backup::Download.new(
|
180
236
|
*command_params(
|
@@ -187,6 +243,11 @@ module Crowbar
|
|
187
243
|
end
|
188
244
|
|
189
245
|
no_commands do
|
246
|
+
#
|
247
|
+
# Ask if the restore should be really down
|
248
|
+
#
|
249
|
+
# @return [Bool] allow or disallow a restore
|
250
|
+
#
|
190
251
|
def accepts_restore?
|
191
252
|
return true if options[:yes]
|
192
253
|
|
@@ -17,6 +17,9 @@
|
|
17
17
|
module Crowbar
|
18
18
|
module Client
|
19
19
|
module App
|
20
|
+
#
|
21
|
+
# A Thor based CLI wrapper for barclamp commands
|
22
|
+
#
|
20
23
|
class Barclamp < Base
|
21
24
|
desc "list",
|
22
25
|
"List available barclamps"
|
@@ -65,6 +68,13 @@ module Crowbar
|
|
65
68
|
banner: "<filter>",
|
66
69
|
desc: "Filter by criteria, display only data that contains filter"
|
67
70
|
|
71
|
+
#
|
72
|
+
# Barclamp list command
|
73
|
+
#
|
74
|
+
# It will print out a list of the available barclamps on the target
|
75
|
+
# cloud. You can display the list in different output formats and
|
76
|
+
# you can filter the list by any search criteria.
|
77
|
+
#
|
68
78
|
def list
|
69
79
|
Command::Barclamp::List.new(
|
70
80
|
*command_params
|
@@ -20,7 +20,18 @@ require "easy_diff"
|
|
20
20
|
module Crowbar
|
21
21
|
module Client
|
22
22
|
module App
|
23
|
+
#
|
24
|
+
# A base class that provides helper for the wrappers
|
25
|
+
#
|
23
26
|
class Base < Thor
|
27
|
+
#
|
28
|
+
# Initialize the Thor command
|
29
|
+
#
|
30
|
+
# @param args [Array] the arguments
|
31
|
+
# @param local_options [Hash] the local options
|
32
|
+
# @param config [Hash] the configuration
|
33
|
+
# @return [Crowbar::Client::App::Base]
|
34
|
+
#
|
24
35
|
def initialize(args = [], local_options = {}, config = {})
|
25
36
|
super
|
26
37
|
|
@@ -40,10 +51,21 @@ module Crowbar
|
|
40
51
|
no_commands do
|
41
52
|
include Mixin::Format
|
42
53
|
|
54
|
+
#
|
55
|
+
# Print a message to STDOUT
|
56
|
+
#
|
57
|
+
# @param message [String] the message to print
|
58
|
+
#
|
43
59
|
def say(message)
|
44
60
|
$stdout.puts message
|
45
61
|
end
|
46
62
|
|
63
|
+
#
|
64
|
+
# Print a message to STDERR
|
65
|
+
#
|
66
|
+
# @param message [String] the message to print
|
67
|
+
# @param exit_code [Integer] the exit code to use
|
68
|
+
#
|
47
69
|
def err(message, exit_code = nil)
|
48
70
|
case provide_format
|
49
71
|
when :json
|
@@ -57,6 +79,12 @@ module Crowbar
|
|
57
79
|
exit(exit_code) unless exit_code.nil?
|
58
80
|
end
|
59
81
|
|
82
|
+
#
|
83
|
+
# Standard parameters for commands
|
84
|
+
#
|
85
|
+
# @param args [Hash] the arguments to inject
|
86
|
+
# @return [Array]
|
87
|
+
#
|
60
88
|
def command_params(args = {})
|
61
89
|
[
|
62
90
|
$stdin,
|
@@ -67,6 +95,12 @@ module Crowbar
|
|
67
95
|
]
|
68
96
|
end
|
69
97
|
|
98
|
+
#
|
99
|
+
# General errors to catch properly
|
100
|
+
#
|
101
|
+
# @param error [StandardError] the error to catch
|
102
|
+
# @raise [StandardError] only raised if uncatchable
|
103
|
+
#
|
70
104
|
def catch_errors(error)
|
71
105
|
case error
|
72
106
|
when SimpleCatchableError
|
@@ -82,11 +116,27 @@ module Crowbar
|
|
82
116
|
end
|
83
117
|
|
84
118
|
class << self
|
119
|
+
#
|
120
|
+
# Properly print an error on invalid command
|
121
|
+
#
|
122
|
+
# @param command [String] the command that failed
|
123
|
+
# @param error [StandardError] the error class
|
124
|
+
# @param args [Array] the arguments that failed
|
125
|
+
# @param arity [Integer] the number of arguments
|
126
|
+
#
|
85
127
|
def handle_argument_error(command, error, args, arity)
|
86
128
|
$stderr.puts("Usage: #{banner(command)}")
|
87
129
|
exit(2)
|
88
130
|
end
|
89
131
|
|
132
|
+
#
|
133
|
+
# A banner that gets displayed on help and error
|
134
|
+
#
|
135
|
+
# @param command [String] the command for help output
|
136
|
+
# @param namespace [String] the namespace for help
|
137
|
+
# @param subcommand [Bool] the flag if it's a subcommand
|
138
|
+
# @return [String]
|
139
|
+
#
|
90
140
|
def banner(command, namespace = nil, subcommand = true)
|
91
141
|
addition = command.formatted_usage(
|
92
142
|
self,
|
@@ -17,6 +17,9 @@
|
|
17
17
|
module Crowbar
|
18
18
|
module Client
|
19
19
|
module App
|
20
|
+
#
|
21
|
+
# A Thor based CLI wrapper for batch commands
|
22
|
+
#
|
20
23
|
class Batch < Base
|
21
24
|
desc "build FILE",
|
22
25
|
"Build proposals from file or stdin"
|
@@ -53,6 +56,17 @@ module Crowbar
|
|
53
56
|
banner: "BARCLAMP[.PROPOSAL]",
|
54
57
|
desc: "Exclude a specific barclamp or proposal for processing"
|
55
58
|
|
59
|
+
#
|
60
|
+
# Batch build command
|
61
|
+
#
|
62
|
+
# It will create/edit/commit proposals defined in an YAML format. You
|
63
|
+
# can directly provide a path to a file or just pipe the content
|
64
|
+
# from stdin. To pipe the content from stdin you should just write
|
65
|
+
# a `-` instead of a specific filename.
|
66
|
+
#
|
67
|
+
# @param file [String] the path to the file
|
68
|
+
# @return [String] a formatted response from the server
|
69
|
+
#
|
56
70
|
def build(file)
|
57
71
|
Command::Batch::Build.new(
|
58
72
|
*command_params(
|
@@ -98,6 +112,17 @@ module Crowbar
|
|
98
112
|
banner: "BARCLAMP[.PROPOSAL]",
|
99
113
|
desc: "Exclude a specific barclamp or proposal for export"
|
100
114
|
|
115
|
+
#
|
116
|
+
# Batch export command
|
117
|
+
#
|
118
|
+
# It will collect the information of the proposals in a YAML format.
|
119
|
+
# You can directly provide a path to a file or just pipe the
|
120
|
+
# content into stdout. To pipe the content to stdout you should
|
121
|
+
# just write a `-` instead of a specific filename.
|
122
|
+
#
|
123
|
+
# @param file [String] the path of the file
|
124
|
+
# @return [String] a formatted response from the server
|
125
|
+
#
|
101
126
|
def export(file = nil)
|
102
127
|
Command::Batch::Export.new(
|
103
128
|
*command_params(
|