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.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +18 -6
  4. data/lib/crowbar/client.rb +54 -0
  5. data/lib/crowbar/client/app.rb +3 -0
  6. data/lib/crowbar/client/app/backup.rb +62 -1
  7. data/lib/crowbar/client/app/barclamp.rb +10 -0
  8. data/lib/crowbar/client/app/base.rb +50 -0
  9. data/lib/crowbar/client/app/batch.rb +25 -0
  10. data/lib/crowbar/client/app/entry.rb +26 -1
  11. data/lib/crowbar/client/app/host_ip.rb +24 -0
  12. data/lib/crowbar/client/app/installer.rb +16 -1
  13. data/lib/crowbar/client/app/interface.rb +21 -0
  14. data/lib/crowbar/client/app/network.rb +3 -0
  15. data/lib/crowbar/client/app/node.rb +3 -0
  16. data/lib/crowbar/client/app/proposal.rb +3 -0
  17. data/lib/crowbar/client/app/repository.rb +3 -0
  18. data/lib/crowbar/client/app/role.rb +3 -0
  19. data/lib/crowbar/client/app/server.rb +56 -0
  20. data/lib/crowbar/client/app/virtual_ip.rb +24 -0
  21. data/lib/crowbar/client/command.rb +3 -0
  22. data/lib/crowbar/client/command/backup.rb +3 -0
  23. data/lib/crowbar/client/command/backup/create.rb +3 -0
  24. data/lib/crowbar/client/command/backup/delete.rb +3 -0
  25. data/lib/crowbar/client/command/backup/download.rb +3 -0
  26. data/lib/crowbar/client/command/backup/list.rb +3 -0
  27. data/lib/crowbar/client/command/backup/restore.rb +3 -0
  28. data/lib/crowbar/client/command/backup/upload.rb +3 -0
  29. data/lib/crowbar/client/command/barclamp.rb +3 -0
  30. data/lib/crowbar/client/command/barclamp/list.rb +3 -0
  31. data/lib/crowbar/client/command/base.rb +3 -0
  32. data/lib/crowbar/client/command/batch.rb +3 -0
  33. data/lib/crowbar/client/command/batch/build.rb +3 -0
  34. data/lib/crowbar/client/command/batch/export.rb +3 -0
  35. data/lib/crowbar/client/command/host_ip.rb +3 -0
  36. data/lib/crowbar/client/command/host_ip/allocate.rb +3 -0
  37. data/lib/crowbar/client/command/host_ip/deallocate.rb +3 -0
  38. data/lib/crowbar/client/command/installer.rb +3 -0
  39. data/lib/crowbar/client/command/installer/start.rb +3 -0
  40. data/lib/crowbar/client/command/installer/status.rb +3 -0
  41. data/lib/crowbar/client/command/interface.rb +3 -0
  42. data/lib/crowbar/client/command/interface/disable.rb +3 -0
  43. data/lib/crowbar/client/command/interface/enable.rb +3 -0
  44. data/lib/crowbar/client/command/node.rb +3 -0
  45. data/lib/crowbar/client/command/node/allocate.rb +4 -1
  46. data/lib/crowbar/client/command/node/delete.rb +3 -0
  47. data/lib/crowbar/client/command/node/group.rb +3 -0
  48. data/lib/crowbar/client/command/node/hardware.rb +4 -1
  49. data/lib/crowbar/client/command/node/identify.rb +4 -1
  50. data/lib/crowbar/client/command/node/list.rb +3 -0
  51. data/lib/crowbar/client/command/node/powercycle.rb +4 -1
  52. data/lib/crowbar/client/command/node/poweroff.rb +4 -1
  53. data/lib/crowbar/client/command/node/poweron.rb +4 -1
  54. data/lib/crowbar/client/command/node/reboot.rb +4 -1
  55. data/lib/crowbar/client/command/node/reinstall.rb +4 -1
  56. data/lib/crowbar/client/command/node/rename.rb +3 -0
  57. data/lib/crowbar/client/command/node/reset.rb +4 -1
  58. data/lib/crowbar/client/command/node/role.rb +3 -0
  59. data/lib/crowbar/client/command/node/show.rb +3 -0
  60. data/lib/crowbar/client/command/node/shutdown.rb +4 -1
  61. data/lib/crowbar/client/command/node/status.rb +3 -0
  62. data/lib/crowbar/client/command/node/transition.rb +3 -0
  63. data/lib/crowbar/client/command/proposal.rb +3 -0
  64. data/lib/crowbar/client/command/proposal/commit.rb +3 -0
  65. data/lib/crowbar/client/command/proposal/create.rb +3 -0
  66. data/lib/crowbar/client/command/proposal/delete.rb +3 -0
  67. data/lib/crowbar/client/command/proposal/dequeue.rb +3 -0
  68. data/lib/crowbar/client/command/proposal/edit.rb +3 -0
  69. data/lib/crowbar/client/command/proposal/list.rb +3 -0
  70. data/lib/crowbar/client/command/proposal/reset.rb +3 -0
  71. data/lib/crowbar/client/command/proposal/show.rb +3 -0
  72. data/lib/crowbar/client/command/repository.rb +3 -0
  73. data/lib/crowbar/client/command/repository/activate.rb +3 -0
  74. data/lib/crowbar/client/command/repository/activate_all.rb +3 -0
  75. data/lib/crowbar/client/command/repository/deactivate.rb +3 -0
  76. data/lib/crowbar/client/command/repository/deactivate_all.rb +3 -0
  77. data/lib/crowbar/client/command/repository/list.rb +3 -0
  78. data/lib/crowbar/client/command/role.rb +3 -0
  79. data/lib/crowbar/client/command/role/list.rb +3 -0
  80. data/lib/crowbar/client/command/role/show.rb +3 -0
  81. data/lib/crowbar/client/command/server.rb +5 -0
  82. data/lib/crowbar/client/command/server/api.rb +3 -0
  83. data/lib/crowbar/client/command/server/check.rb +75 -0
  84. data/lib/crowbar/client/command/virtual_ip.rb +3 -0
  85. data/lib/crowbar/client/command/virtual_ip/allocate.rb +3 -0
  86. data/lib/crowbar/client/command/virtual_ip/deallocate.rb +3 -0
  87. data/lib/crowbar/client/config.rb +128 -1
  88. data/lib/crowbar/client/filter.rb +3 -0
  89. data/lib/crowbar/client/filter/array.rb +3 -0
  90. data/lib/crowbar/client/filter/base.rb +3 -0
  91. data/lib/crowbar/client/filter/hash.rb +3 -0
  92. data/lib/crowbar/client/filter/subset.rb +3 -0
  93. data/lib/crowbar/client/formatter.rb +3 -0
  94. data/lib/crowbar/client/formatter/array.rb +3 -0
  95. data/lib/crowbar/client/formatter/base.rb +3 -0
  96. data/lib/crowbar/client/formatter/hash.rb +3 -0
  97. data/lib/crowbar/client/formatter/nested.rb +3 -0
  98. data/lib/crowbar/client/mixin.rb +3 -0
  99. data/lib/crowbar/client/mixin/barclamp.rb +3 -0
  100. data/lib/crowbar/client/mixin/filter.rb +3 -0
  101. data/lib/crowbar/client/mixin/format.rb +3 -0
  102. data/lib/crowbar/client/request.rb +3 -0
  103. data/lib/crowbar/client/request/backup.rb +3 -0
  104. data/lib/crowbar/client/request/backup/create.rb +18 -0
  105. data/lib/crowbar/client/request/backup/delete.rb +13 -0
  106. data/lib/crowbar/client/request/backup/download.rb +13 -0
  107. data/lib/crowbar/client/request/backup/list.rb +13 -0
  108. data/lib/crowbar/client/request/backup/restore.rb +13 -0
  109. data/lib/crowbar/client/request/backup/upload.rb +13 -0
  110. data/lib/crowbar/client/request/barclamp.rb +3 -0
  111. data/lib/crowbar/client/request/barclamp/list.rb +13 -0
  112. data/lib/crowbar/client/request/base.rb +42 -11
  113. data/lib/crowbar/client/request/batch.rb +3 -0
  114. data/lib/crowbar/client/request/batch/build.rb +13 -0
  115. data/lib/crowbar/client/request/batch/export.rb +18 -0
  116. data/lib/crowbar/client/request/host_ip.rb +3 -0
  117. data/lib/crowbar/client/request/host_ip/allocate.rb +18 -0
  118. data/lib/crowbar/client/request/host_ip/deallocate.rb +18 -0
  119. data/lib/crowbar/client/request/installer.rb +3 -0
  120. data/lib/crowbar/client/request/installer/start.rb +18 -0
  121. data/lib/crowbar/client/request/installer/status.rb +13 -0
  122. data/lib/crowbar/client/request/interface.rb +3 -0
  123. data/lib/crowbar/client/request/interface/disable.rb +18 -0
  124. data/lib/crowbar/client/request/interface/enable.rb +18 -0
  125. data/lib/crowbar/client/request/node.rb +33 -0
  126. data/lib/crowbar/client/request/node/action.rb +13 -0
  127. data/lib/crowbar/client/request/node/allocate.rb +29 -0
  128. data/lib/crowbar/client/request/node/delete.rb +13 -0
  129. data/lib/crowbar/client/request/node/group.rb +13 -0
  130. data/lib/crowbar/client/request/node/hardware.rb +29 -0
  131. data/lib/crowbar/client/request/node/identify.rb +29 -0
  132. data/lib/crowbar/client/request/node/list.rb +13 -0
  133. data/lib/crowbar/client/request/node/powercycle.rb +29 -0
  134. data/lib/crowbar/client/request/node/poweroff.rb +29 -0
  135. data/lib/crowbar/client/request/node/poweron.rb +29 -0
  136. data/lib/crowbar/client/request/node/reboot.rb +29 -0
  137. data/lib/crowbar/client/request/node/reinstall.rb +29 -0
  138. data/lib/crowbar/client/request/node/rename.rb +18 -0
  139. data/lib/crowbar/client/request/node/reset.rb +29 -0
  140. data/lib/crowbar/client/request/node/role.rb +18 -0
  141. data/lib/crowbar/client/request/node/show.rb +13 -0
  142. data/lib/crowbar/client/request/node/shutdown.rb +29 -0
  143. data/lib/crowbar/client/request/node/status.rb +13 -0
  144. data/lib/crowbar/client/request/node/transition.rb +18 -0
  145. data/lib/crowbar/client/request/party.rb +3 -0
  146. data/lib/crowbar/client/request/proposal.rb +3 -0
  147. data/lib/crowbar/client/request/proposal/commit.rb +13 -0
  148. data/lib/crowbar/client/request/proposal/create.rb +18 -0
  149. data/lib/crowbar/client/request/proposal/delete.rb +13 -0
  150. data/lib/crowbar/client/request/proposal/dequeue.rb +13 -0
  151. data/lib/crowbar/client/request/proposal/edit.rb +18 -0
  152. data/lib/crowbar/client/request/proposal/list.rb +13 -0
  153. data/lib/crowbar/client/request/proposal/reset.rb +13 -0
  154. data/lib/crowbar/client/request/proposal/show.rb +13 -0
  155. data/lib/crowbar/client/request/proposal/template.rb +13 -0
  156. data/lib/crowbar/client/request/repository.rb +3 -0
  157. data/lib/crowbar/client/request/repository/activate.rb +18 -0
  158. data/lib/crowbar/client/request/repository/activate_all.rb +13 -0
  159. data/lib/crowbar/client/request/repository/deactivate.rb +18 -0
  160. data/lib/crowbar/client/request/repository/deactivate_all.rb +13 -0
  161. data/lib/crowbar/client/request/repository/list.rb +13 -0
  162. data/lib/crowbar/client/request/role.rb +3 -0
  163. data/lib/crowbar/client/request/role/list.rb +13 -0
  164. data/lib/crowbar/client/request/role/show.rb +13 -0
  165. data/lib/crowbar/client/request/server.rb +5 -0
  166. data/lib/crowbar/client/request/server/api.rb +13 -0
  167. data/lib/crowbar/client/request/server/check.rb +49 -0
  168. data/lib/crowbar/client/request/virtual_ip.rb +3 -0
  169. data/lib/crowbar/client/request/virtual_ip/allocate.rb +18 -0
  170. data/lib/crowbar/client/request/virtual_ip/deallocate.rb +18 -0
  171. data/lib/crowbar/client/util.rb +3 -0
  172. data/lib/crowbar/client/util/editor.rb +3 -0
  173. data/lib/crowbar/client/util/runner.rb +3 -0
  174. data/lib/crowbar/client/version.rb +23 -1
  175. data/spec/crowbar/client/command/backup/create_spec.rb +8 -16
  176. data/spec/crowbar/client/command/backup/delete_spec.rb +8 -16
  177. data/spec/crowbar/client/command/backup/download_spec.rb +8 -16
  178. data/spec/crowbar/client/command/backup/list_spec.rb +7 -15
  179. data/spec/crowbar/client/command/backup/restore_spec.rb +8 -16
  180. data/spec/crowbar/client/command/backup/upload_spec.rb +11 -19
  181. data/spec/crowbar/client/command/barclamp/list_spec.rb +7 -15
  182. data/spec/crowbar/client/command/batch/build_spec.rb +11 -19
  183. data/spec/crowbar/client/command/batch/export_spec.rb +7 -15
  184. data/spec/crowbar/client/command/host_ip/allocate_spec.rb +7 -15
  185. data/spec/crowbar/client/command/host_ip/deallocate_spec.rb +7 -15
  186. data/spec/crowbar/client/command/installer/start_spec.rb +8 -16
  187. data/spec/crowbar/client/command/installer/status_spec.rb +7 -15
  188. data/spec/crowbar/client/command/interface/disable_spec.rb +7 -15
  189. data/spec/crowbar/client/command/interface/enable_spec.rb +7 -15
  190. data/spec/crowbar/client/command/node/allocate_spec.rb +7 -15
  191. data/spec/crowbar/client/command/node/delete_spec.rb +7 -15
  192. data/spec/crowbar/client/command/node/group_spec.rb +7 -15
  193. data/spec/crowbar/client/command/node/hardware_spec.rb +7 -15
  194. data/spec/crowbar/client/command/node/identify_spec.rb +7 -15
  195. data/spec/crowbar/client/command/node/list_spec.rb +9 -17
  196. data/spec/crowbar/client/command/node/powercycle_spec.rb +7 -15
  197. data/spec/crowbar/client/command/node/poweroff_spec.rb +7 -15
  198. data/spec/crowbar/client/command/node/poweron_spec.rb +7 -15
  199. data/spec/crowbar/client/command/node/reboot_spec.rb +7 -15
  200. data/spec/crowbar/client/command/node/reinstall_spec.rb +7 -15
  201. data/spec/crowbar/client/command/node/rename_spec.rb +7 -15
  202. data/spec/crowbar/client/command/node/reset_spec.rb +7 -15
  203. data/spec/crowbar/client/command/node/role_spec.rb +7 -15
  204. data/spec/crowbar/client/command/node/show_spec.rb +7 -15
  205. data/spec/crowbar/client/command/node/shutdown_spec.rb +7 -15
  206. data/spec/crowbar/client/command/node/status_spec.rb +7 -15
  207. data/spec/crowbar/client/command/node/transition_spec.rb +7 -15
  208. data/spec/crowbar/client/command/proposal/commit_spec.rb +7 -15
  209. data/spec/crowbar/client/command/proposal/delete_spec.rb +7 -15
  210. data/spec/crowbar/client/command/proposal/dequeue_spec.rb +7 -15
  211. data/spec/crowbar/client/command/proposal/list_spec.rb +7 -15
  212. data/spec/crowbar/client/command/proposal/reset_spec.rb +7 -15
  213. data/spec/crowbar/client/command/proposal/show_spec.rb +7 -15
  214. data/spec/crowbar/client/command/repository/activate_all_spec.rb +7 -15
  215. data/spec/crowbar/client/command/repository/activate_spec.rb +7 -15
  216. data/spec/crowbar/client/command/repository/deactivate_all_spec.rb +7 -15
  217. data/spec/crowbar/client/command/repository/deactivate_spec.rb +7 -15
  218. data/spec/crowbar/client/command/repository/list_spec.rb +7 -15
  219. data/spec/crowbar/client/command/role/list_spec.rb +7 -15
  220. data/spec/crowbar/client/command/role/show_spec.rb +7 -15
  221. data/spec/crowbar/client/command/server/api_spec.rb +7 -15
  222. data/spec/crowbar/client/command/server/check_spec.rb +31 -0
  223. data/spec/crowbar/client/command/virtual_ip/allocate_spec.rb +7 -15
  224. data/spec/crowbar/client/command/virtual_ip/deallocate_spec.rb +7 -15
  225. data/spec/crowbar/client/request/server/check_spec.rb +50 -0
  226. data/spec/support/command_examples.rb +59 -0
  227. metadata +117 -95
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4b636e56d83e9730ca3c0673c16bf3b224da00b
4
- data.tar.gz: c0890e422cedfaae4323992edbbddecea89227da
3
+ metadata.gz: c1c168edc28fee98083d4a8fa4e2241956b79cec
4
+ data.tar.gz: cbb8ea40deeb4a95c12ca7113fdcde04878631a7
5
5
  SHA512:
6
- metadata.gz: ff7ebe7f47b711872f134a1741a4219469efbb88eab2dd6935ce76ab13bf5f05061693e540312aab02f1fee700ca23e5ab6e88c8d6f5eccaa462c9dab897c13f
7
- data.tar.gz: 38d95910370053dc116d07355c75c30bd8b66e7d6f55af623115983d5bc91ca02db27408a11967046f44b8fe3d588ed1717850c893fc4ebc4e7d8d7b0dcbea2b
6
+ metadata.gz: 3ba3640b9f7d4828acde6300d6324b5856f818eee8b99859b9827b5f25a4caa90929882a4b2cf4e5287ae7b3a9f5f2e09df13a17a7bcb887e20442a0810a1735
7
+ data.tar.gz: 1243a8524c37791076b30e09d15e36dc7a60f13558a99ca9e407acc3f656c59ed2d424919550cea4ac46842d99a81229df4405cb458a907be452dca939fa18b2
@@ -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 an experimental implementation to replace the current CLI scripts of
4
- the crowbar barclamps. This tool is intended to be installable standalone,
5
- that way everybody who got access to the Crowbar admin network should be able
6
- to manage Crowbar from remote.
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
  [![Code Climate](https://codeclimate.com/github/crowbar/crowbar-client.svg)](https://codeclimate.com/github/crowbar/crowbar-client)
17
17
  [![Test Coverage](https://codeclimate.com/github/crowbar/crowbar-client/badges/coverage.svg)](https://codeclimate.com/github/crowbar/crowbar-client)
18
18
  [![Dependency Status](https://gemnasium.com/crowbar/crowbar-client.svg)](https://gemnasium.com/crowbar/crowbar-client)
19
+ [![Inline Docs](http://inch-ci.org/github/crowbar/crowbar-client.svg?branch=master)](http://inch-ci.org/github/crowbar/crowbar-client)
19
20
  [![Join the chat at https://gitter.im/crowbar/crowbar](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/crowbar/crowbar)
20
21
 
21
22
  ## Install
22
23
 
23
- To install this simple rubygem you can check your package manager if it is
24
- available for you, alternativly you can just install the ruby gem if you have a
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
@@ -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")
@@ -16,6 +16,9 @@
16
16
 
17
17
  module Crowbar
18
18
  module Client
19
+ #
20
+ # Module for the Thor based CLI wrapper
21
+ #
19
22
  module App
20
23
  autoload :Backup,
21
24
  File.expand_path("../app/backup", __FILE__)
@@ -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
- download command.
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(