hammer_cli_foreman 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of hammer_cli_foreman might be problematic. Click here for more details.

Files changed (324) hide show
  1. checksums.yaml +4 -4
  2. data/config/foreman.yml +4 -0
  3. data/doc/host_create.md +4 -4
  4. data/doc/release_notes.md +24 -6
  5. data/lib/hammer_cli_foreman/associating_commands.rb +54 -0
  6. data/lib/hammer_cli_foreman/commands.rb +28 -7
  7. data/lib/hammer_cli_foreman/exception_handler.rb +18 -0
  8. data/lib/hammer_cli_foreman/exceptions.rb +1 -1
  9. data/lib/hammer_cli_foreman/host.rb +11 -6
  10. data/lib/hammer_cli_foreman/id_resolver.rb +10 -2
  11. data/lib/hammer_cli_foreman/partition_table.rb +1 -0
  12. data/lib/hammer_cli_foreman/smart_class_parameter.rb +5 -1
  13. data/lib/hammer_cli_foreman/smart_variable.rb +1 -1
  14. data/lib/hammer_cli_foreman/template.rb +29 -5
  15. data/lib/hammer_cli_foreman/testing/api_expectations.rb +6 -6
  16. data/lib/hammer_cli_foreman/user.rb +2 -1
  17. data/lib/hammer_cli_foreman/version.rb +1 -1
  18. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  19. data/locale/ca/hammer-cli-foreman.edit.po +2622 -0
  20. data/locale/ca/hammer-cli-foreman.po +2544 -0
  21. data/locale/ca/hammer-cli-foreman.po.time_stamp +0 -0
  22. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  23. data/locale/de/hammer-cli-foreman.edit.po +2613 -0
  24. data/locale/de/hammer-cli-foreman.po +132 -122
  25. data/locale/de/hammer-cli-foreman.po.time_stamp +0 -0
  26. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  27. data/locale/en/hammer-cli-foreman.edit.po +2575 -0
  28. data/locale/en/hammer-cli-foreman.po +157 -8
  29. data/locale/en/hammer-cli-foreman.po.time_stamp +0 -0
  30. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  31. data/locale/en_GB/hammer-cli-foreman.edit.po +2582 -0
  32. data/locale/en_GB/hammer-cli-foreman.po +151 -141
  33. data/locale/en_GB/hammer-cli-foreman.po.time_stamp +0 -0
  34. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  35. data/locale/es/hammer-cli-foreman.edit.po +2625 -0
  36. data/locale/es/hammer-cli-foreman.po +110 -100
  37. data/locale/es/hammer-cli-foreman.po.time_stamp +0 -0
  38. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  39. data/locale/fr/hammer-cli-foreman.edit.po +2626 -0
  40. data/locale/fr/hammer-cli-foreman.po +110 -100
  41. data/locale/fr/hammer-cli-foreman.po.time_stamp +0 -0
  42. data/locale/hammer-cli-foreman.pot +390 -190
  43. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  44. data/locale/it/hammer-cli-foreman.edit.po +2601 -0
  45. data/locale/it/hammer-cli-foreman.po +139 -129
  46. data/locale/it/hammer-cli-foreman.po.time_stamp +0 -0
  47. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  48. data/locale/ja/hammer-cli-foreman.edit.po +2601 -0
  49. data/locale/ja/hammer-cli-foreman.po +140 -130
  50. data/locale/ja/hammer-cli-foreman.po.time_stamp +0 -0
  51. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  52. data/locale/ko/hammer-cli-foreman.edit.po +2599 -0
  53. data/locale/ko/hammer-cli-foreman.po +138 -128
  54. data/locale/ko/hammer-cli-foreman.po.time_stamp +0 -0
  55. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  56. data/locale/pt_BR/hammer-cli-foreman.edit.po +2628 -0
  57. data/locale/pt_BR/hammer-cli-foreman.po +112 -102
  58. data/locale/pt_BR/hammer-cli-foreman.po.time_stamp +0 -0
  59. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  60. data/locale/ru/hammer-cli-foreman.edit.po +2602 -0
  61. data/locale/ru/hammer-cli-foreman.po +265 -254
  62. data/locale/ru/hammer-cli-foreman.po.time_stamp +0 -0
  63. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  64. data/locale/zh_CN/hammer-cli-foreman.edit.po +2599 -0
  65. data/locale/zh_CN/hammer-cli-foreman.po +136 -126
  66. data/locale/zh_CN/hammer-cli-foreman.po.time_stamp +0 -0
  67. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  68. data/locale/zh_TW/hammer-cli-foreman.edit.po +2599 -0
  69. data/locale/zh_TW/hammer-cli-foreman.po +137 -127
  70. data/locale/zh_TW/hammer-cli-foreman.po.time_stamp +0 -0
  71. data/test/data/README.md +6 -1
  72. data/test/functional/commands/list_test.rb +141 -0
  73. data/test/functional/organization_test.rb +71 -0
  74. data/test/functional/smart_class_parameter_test.rb +61 -0
  75. data/test/functional/template_test.rb +80 -0
  76. data/test/functional/test_helper.rb +3 -0
  77. data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand-parameters.xml +11 -0
  78. data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand.xml +7 -0
  79. data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand-parameters.xml +13 -0
  80. data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand.xml +7 -0
  81. data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-output.xml +13 -0
  82. data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-parameters.xml +13 -0
  83. data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand.xml +7 -0
  84. data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-output.xml +13 -0
  85. data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-parameters.xml +17 -0
  86. data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand.xml +7 -0
  87. data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand-parameters.xml +15 -0
  88. data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand.xml +7 -0
  89. data/test/reports/TEST-HammerCLIForeman-Architecture.xml +7 -0
  90. data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand-parameters.xml +11 -0
  91. data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand.xml +7 -0
  92. data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-output.xml +13 -0
  93. data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-parameters.xml +17 -0
  94. data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand.xml +7 -0
  95. data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand-parameters.xml +13 -0
  96. data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand.xml +7 -0
  97. data/test/reports/TEST-HammerCLIForeman-CommonParameter.xml +7 -0
  98. data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand-parameters.xml +15 -0
  99. data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand.xml +7 -0
  100. data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand-parameters.xml +13 -0
  101. data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand.xml +7 -0
  102. data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-output.xml +17 -0
  103. data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-parameters.xml +13 -0
  104. data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand.xml +7 -0
  105. data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-output.xml +15 -0
  106. data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-parameters.xml +17 -0
  107. data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand.xml +7 -0
  108. data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand-parameters.xml +15 -0
  109. data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand.xml +7 -0
  110. data/test/reports/TEST-HammerCLIForeman-ComputeResource.xml +7 -0
  111. data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand-parameters.xml +11 -0
  112. data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand.xml +7 -0
  113. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand-parameters.xml +13 -0
  114. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand.xml +7 -0
  115. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand-parameters.xml +15 -0
  116. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand.xml +7 -0
  117. data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-output.xml +21 -0
  118. data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-parameters.xml +13 -0
  119. data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand.xml +7 -0
  120. data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-output.xml +13 -0
  121. data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-parameters.xml +17 -0
  122. data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand.xml +7 -0
  123. data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand-parameters.xml +17 -0
  124. data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand.xml +7 -0
  125. data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand-parameters.xml +15 -0
  126. data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand.xml +7 -0
  127. data/test/reports/TEST-HammerCLIForeman-Domain.xml +7 -0
  128. data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand-parameters.xml +11 -0
  129. data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand.xml +7 -0
  130. data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand-parameters.xml +13 -0
  131. data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand.xml +7 -0
  132. data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-output.xml +17 -0
  133. data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-parameters.xml +13 -0
  134. data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand.xml +7 -0
  135. data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-output.xml +13 -0
  136. data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-parameters.xml +17 -0
  137. data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand.xml +7 -0
  138. data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand-parameters.xml +15 -0
  139. data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand.xml +7 -0
  140. data/test/reports/TEST-HammerCLIForeman-Environment.xml +7 -0
  141. data/test/reports/TEST-HammerCLIForeman-ExceptionHandler.xml +13 -0
  142. data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand-parameters.xml +46 -0
  143. data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand.xml +7 -0
  144. data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand-parameters.xml +13 -0
  145. data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand.xml +7 -0
  146. data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand-parameters.xml +15 -0
  147. data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand.xml +7 -0
  148. data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-output.xml +85 -0
  149. data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-parameters.xml +13 -0
  150. data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand.xml +7 -0
  151. data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-output.xml +21 -0
  152. data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-parameters.xml +17 -0
  153. data/test/reports/TEST-HammerCLIForeman-Host-ListCommand.xml +7 -0
  154. data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand-output.xml +9 -0
  155. data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand.xml +7 -0
  156. data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand-parameters.xml +17 -0
  157. data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand.xml +7 -0
  158. data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand-output.xml +9 -0
  159. data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand.xml +7 -0
  160. data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand-parameters.xml +40 -0
  161. data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand.xml +7 -0
  162. data/test/reports/TEST-HammerCLIForeman-Host.xml +7 -0
  163. data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand-parameters.xml +11 -0
  164. data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand.xml +7 -0
  165. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand-parameters.xml +11 -0
  166. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand.xml +7 -0
  167. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand-parameters.xml +13 -0
  168. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand.xml +7 -0
  169. data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-output.xml +29 -0
  170. data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-parameters.xml +11 -0
  171. data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand.xml +7 -0
  172. data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-output.xml +27 -0
  173. data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-parameters.xml +17 -0
  174. data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand.xml +7 -0
  175. data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand-parameters.xml +15 -0
  176. data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand.xml +7 -0
  177. data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand-parameters.xml +13 -0
  178. data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand.xml +7 -0
  179. data/test/reports/TEST-HammerCLIForeman-Hostgroup.xml +7 -0
  180. data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-parameters.xml +11 -0
  181. data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-resource-disabled.xml +11 -0
  182. data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand.xml +7 -0
  183. data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-parameters.xml +13 -0
  184. data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-resource-disabled.xml +11 -0
  185. data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand.xml +7 -0
  186. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-output.xml +17 -0
  187. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-parameters.xml +13 -0
  188. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-resource-disabled.xml +11 -0
  189. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand.xml +7 -0
  190. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-output.xml +13 -0
  191. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-parameters.xml +17 -0
  192. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-resource-disabled.xml +11 -0
  193. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand.xml +7 -0
  194. data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-parameters.xml +15 -0
  195. data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-resource-disabled.xml +11 -0
  196. data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand.xml +7 -0
  197. data/test/reports/TEST-HammerCLIForeman-Location.xml +7 -0
  198. data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand-parameters.xml +13 -0
  199. data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand.xml +7 -0
  200. data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand-parameters.xml +13 -0
  201. data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand.xml +7 -0
  202. data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-output.xml +23 -0
  203. data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-parameters.xml +13 -0
  204. data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand.xml +7 -0
  205. data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-output.xml +15 -0
  206. data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-parameters.xml +17 -0
  207. data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand.xml +7 -0
  208. data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand-parameters.xml +17 -0
  209. data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand.xml +7 -0
  210. data/test/reports/TEST-HammerCLIForeman-Medium.xml +7 -0
  211. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand-parameters.xml +11 -0
  212. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand.xml +7 -0
  213. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand-parameters.xml +13 -0
  214. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand.xml +7 -0
  215. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand-parameters.xml +13 -0
  216. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand.xml +7 -0
  217. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-output.xml +27 -0
  218. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-parameters.xml +13 -0
  219. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand.xml +7 -0
  220. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-output.xml +17 -0
  221. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-parameters.xml +17 -0
  222. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand.xml +7 -0
  223. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand-parameters.xml +15 -0
  224. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand.xml +7 -0
  225. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand-parameters.xml +17 -0
  226. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand.xml +7 -0
  227. data/test/reports/TEST-HammerCLIForeman-OperatingSystem.xml +7 -0
  228. data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-parameters.xml +11 -0
  229. data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-resource-disabled.xml +11 -0
  230. data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand.xml +7 -0
  231. data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-parameters.xml +13 -0
  232. data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-resource-disabled.xml +11 -0
  233. data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand.xml +7 -0
  234. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-output.xml +17 -0
  235. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-parameters.xml +13 -0
  236. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-resource-disabled.xml +11 -0
  237. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand.xml +7 -0
  238. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-output.xml +13 -0
  239. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-parameters.xml +17 -0
  240. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-resource-disabled.xml +11 -0
  241. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand.xml +7 -0
  242. data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-parameters.xml +15 -0
  243. data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-resource-disabled.xml +11 -0
  244. data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand.xml +7 -0
  245. data/test/reports/TEST-HammerCLIForeman-Organization.xml +7 -0
  246. data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand-parameters.xml +13 -0
  247. data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand.xml +7 -0
  248. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand-parameters.xml +13 -0
  249. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand.xml +7 -0
  250. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand-parameters.xml +15 -0
  251. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand.xml +7 -0
  252. data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-output.xml +19 -0
  253. data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-parameters.xml +13 -0
  254. data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand.xml +7 -0
  255. data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-output.xml +15 -0
  256. data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-parameters.xml +17 -0
  257. data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand.xml +7 -0
  258. data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand-parameters.xml +13 -0
  259. data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand.xml +7 -0
  260. data/test/reports/TEST-HammerCLIForeman-PartitionTable.xml +7 -0
  261. data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand-parameters.xml +13 -0
  262. data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand.xml +7 -0
  263. data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand-parameters.xml +13 -0
  264. data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand.xml +7 -0
  265. data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-output.xml +21 -0
  266. data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-parameters.xml +13 -0
  267. data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand.xml +7 -0
  268. data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-output.xml +15 -0
  269. data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-parameters.xml +11 -0
  270. data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand.xml +7 -0
  271. data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand-parameters.xml +15 -0
  272. data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand.xml +7 -0
  273. data/test/reports/TEST-HammerCLIForeman-SmartProxy.xml +7 -0
  274. data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand-parameters.xml +15 -0
  275. data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand.xml +7 -0
  276. data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand-parameters.xml +13 -0
  277. data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand.xml +7 -0
  278. data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-output.xml +43 -0
  279. data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-parameters.xml +13 -0
  280. data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand.xml +7 -0
  281. data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-output.xml +17 -0
  282. data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-parameters.xml +17 -0
  283. data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand.xml +7 -0
  284. data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand-parameters.xml +15 -0
  285. data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand.xml +7 -0
  286. data/test/reports/TEST-HammerCLIForeman-Subnet.xml +7 -0
  287. data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand-parameters.xml +15 -0
  288. data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand.xml +7 -0
  289. data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand-parameters.xml +11 -0
  290. data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand.xml +7 -0
  291. data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand-parameters.xml +12 -0
  292. data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand.xml +7 -0
  293. data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-output.xml +17 -0
  294. data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-parameters.xml +11 -0
  295. data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand.xml +7 -0
  296. data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-output.xml +15 -0
  297. data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-parameters.xml +17 -0
  298. data/test/reports/TEST-HammerCLIForeman-Template-ListCommand.xml +7 -0
  299. data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand-parameters.xml +9 -0
  300. data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand.xml +7 -0
  301. data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand-parameters.xml +11 -0
  302. data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand.xml +7 -0
  303. data/test/reports/TEST-HammerCLIForeman-Template.xml +7 -0
  304. data/test/reports/TEST-HammerCLIForeman-User-CreateCommand-parameters.xml +19 -0
  305. data/test/reports/TEST-HammerCLIForeman-User-CreateCommand.xml +7 -0
  306. data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand-parameters.xml +11 -0
  307. data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand.xml +7 -0
  308. data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-output.xml +23 -0
  309. data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-parameters.xml +11 -0
  310. data/test/reports/TEST-HammerCLIForeman-User-InfoCommand.xml +7 -0
  311. data/test/reports/TEST-HammerCLIForeman-User-ListCommand-output.xml +17 -0
  312. data/test/reports/TEST-HammerCLIForeman-User-ListCommand-parameters.xml +17 -0
  313. data/test/reports/TEST-HammerCLIForeman-User-ListCommand.xml +7 -0
  314. data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand-parameters.xml +11 -0
  315. data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand.xml +7 -0
  316. data/test/reports/TEST-HammerCLIForeman-User.xml +7 -0
  317. data/test/reports/TEST-MiniTest-Spec.xml +7 -0
  318. data/test/unit/commands_test.rb +9 -9
  319. data/test/unit/data/test_api.json +43 -0
  320. data/test/unit/exception_handler_test.rb +20 -1
  321. data/test/unit/host_test.rb +12 -0
  322. data/test/unit/id_resolver_test.rb +18 -2
  323. data/test/unit/user_test.rb +1 -1
  324. metadata +561 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f81351582f4f713c7186858fda4d98b2e450d5c1
4
- data.tar.gz: 6abc6beec85cc11c4677cb4aa8031841a7a54a0b
3
+ metadata.gz: d452c453ff4c1d71b981aa86267a97d57ad5af89
4
+ data.tar.gz: 1c3a7f0a5e69bd24c75bddfc0a82ebe3c42c2143
5
5
  SHA512:
6
- metadata.gz: 807d5903e8b026a982f944fa3d58577d4d5975cd42340b1b6e2784bbdf42708be9f4169c5947ace310c8fc55df3ca7bc5bfab82e065e841ccca81a1c259a8214
7
- data.tar.gz: 559d0b261a6069fa02540f0db294dbd9c90f30157055e7a13a5b81f3b3116bd1db1a78710a67f806b800e341755c984182ac07c716fbb02b7c4f3526822cb805
6
+ metadata.gz: 0a501559d4630e4cb23e0761ec3172ef9e4152e8594abdafa04adf348a0794da761380c21f5534725385f71a8b891f59740d2b80027e45a6d70dc150328bc4b9
7
+ data.tar.gz: fc59ef6ba743c661725412edd411d91f30cee6f37beeaad218fe3c8a2a13f40ea232a56e1f81f45b3e8a726e9a057594a0179156317f69acea470107b3323de0
data/config/foreman.yml CHANGED
@@ -14,3 +14,7 @@
14
14
 
15
15
  # API request timeout. Set to -1 for no timeout
16
16
  #:request_timeout: 120 #seconds
17
+
18
+ # Follow API redirects. One of :never, :default, :always
19
+ # Value :default means RestClient default behaviour - follow only in GET and HEAD requests
20
+ #:follow_redirects: :never
data/doc/host_create.md CHANGED
@@ -169,7 +169,7 @@ start # boolean, whether to start the machine or not
169
169
 
170
170
  Available keys for `--interface`:
171
171
  ```
172
- compute_type # one of [:bridge, :network]
172
+ compute_type # one of [bridge, network]
173
173
  compute_network / compute_bridge # name of interface according to type
174
174
  compute_model # one of [virtio, rtl8139, ne2k_pci, pcnet, e1000]
175
175
  ```
@@ -231,9 +231,9 @@ memory_mb # integer number
231
231
  cluster # cluster id from VMware
232
232
  path # path to folder
233
233
  guest_id # guest OS id form VMware
234
- scsi_controller_type # id of the controller from VMWare
235
- hardware_version # hardware version id from VMWare
236
- start # 1/0
234
+ scsi_controller_type # id of the controller from VMware
235
+ hardware_version # hardware version id from VMware
236
+ start # Must be a 1 or 0, whether to start the machine or not
237
237
  ```
238
238
 
239
239
  Available keys for `--interface`:
data/doc/release_notes.md CHANGED
@@ -1,12 +1,30 @@
1
1
  Release notes
2
2
  =============
3
3
 
4
- ### 0.6.2 (2016-03-22)
5
- * hammer-cli-foreman-0.6.1 misses dependency on apipie-bindings >=0.0.16 ([#14312](http://projects.theforeman.org/issues/14312))
6
- * Specifying provision and primary flags should not be mandatory ([#13927](http://projects.theforeman.org/issues/13927))
7
-
8
- ### 0.6.1 (2016-03-15)
9
- * Host creation error: ApipieBindings::InvalidArgumentTypesError ([#13966](http://projects.theforeman.org/issues/13966))
4
+ ### 0.7.0 (2016-06-14)
5
+ * Let print adapters decide whether to paginate ([#15257](http://projects.theforeman.org/issues/15257))
6
+ * Forbid setting smart param override value and puppet default ([#13832](http://projects.theforeman.org/issues/13832))
7
+ * Add rebuild config option for host ([PR#231](https://github.com/theforeman/hammer-cli-foreman/pull/231)) ([#12103](http://projects.theforeman.org/issues/12103))
8
+ * Removing wrong colons from host create docs
9
+ * i18n - remove underscore from override value error message
10
+ * Typo in MissingSeachOptions ([#14007](http://projects.theforeman.org/issues/14007))
11
+ * Add Catalan language ([#14947](http://projects.theforeman.org/issues/14947))
12
+ * Hammer shows incorrect admin status when assign admin role using user group ([#14606](http://projects.theforeman.org/issues/14606))
13
+ * Fixed response parsing for puppetclasses parameter ([#14930](http://projects.theforeman.org/issues/14930))
14
+ * Display locked flag for templates and ptables ([#14943](http://projects.theforeman.org/issues/14943))
15
+ * Document vmware `start` parameter
16
+ * Fixes VMware name in docs for host create
17
+ * Respect per_page set in config file ([#14530](http://projects.theforeman.org/issues/14530))
18
+ * Provide success/failure message for associating commands ([#7492](http://projects.theforeman.org/issues/7492))
19
+ * Add support for Gemfile.local.rb ([#14466](http://projects.theforeman.org/issues/14466))
20
+ * Fixing path in docs for generated test json ([PR#226](https://github.com/theforeman/hammer-cli-foreman/pull/226))
21
+ * Added clone command to config templates ([#13946](http://projects.theforeman.org/issues/13946))
22
+ * Handle API request redirects with useful message ([#11147](http://projects.theforeman.org/issues/11147))
23
+ * Newer version of apipie validates types for arrays ([#13966](http://projects.theforeman.org/issues/13966))
24
+ * Show auth source name for all auth sources ([#7468](http://projects.theforeman.org/issues/7468))
25
+ * Environment and Puppet proxy is not required ([#13926](http://projects.theforeman.org/issues/13926))
26
+ * Added special method for dealing with puppetclasses ([#11880](http://projects.theforeman.org/issues/11880))
27
+ * Make primary and provision flag optional ([#13927](http://projects.theforeman.org/issues/13927))
10
28
 
11
29
  ### 0.6.0 (2016-02-25)
12
30
  * Names of sc-params are immutable ([#13830](http://projects.theforeman.org/issues/13830))
@@ -39,11 +39,17 @@ module HammerCLIForeman
39
39
  class AddHostgroupCommand < HammerCLIForeman::AddAssociatedCommand
40
40
  associated_resource :hostgroups
41
41
  desc _("Associate a hostgroup")
42
+
43
+ success_message _("The hostgroup has been associated")
44
+ failure_message _("Could not associate the hostgroup")
42
45
  end
43
46
 
44
47
  class RemoveHostgroupCommand < HammerCLIForeman::RemoveAssociatedCommand
45
48
  associated_resource :hostgroups
46
49
  desc _("Disassociate a hostgroup")
50
+
51
+ success_message _("The hostgroup has been disassociated")
52
+ failure_message _("Could not disassociate the hostgroup")
47
53
  end
48
54
  end
49
55
 
@@ -53,11 +59,17 @@ module HammerCLIForeman
53
59
  class AddEnvironmentCommand < HammerCLIForeman::AddAssociatedCommand
54
60
  associated_resource :environments
55
61
  desc _("Associate an environment")
62
+
63
+ success_message _("The environment has been associated")
64
+ failure_message _("Could not associate the environment")
56
65
  end
57
66
 
58
67
  class RemoveEnvironmentCommand < HammerCLIForeman::RemoveAssociatedCommand
59
68
  associated_resource :environments
60
69
  desc _("Disassociate an environment")
70
+
71
+ success_message _("The environment has been disassociated")
72
+ failure_message _("Could not disassociate the environment")
61
73
  end
62
74
  end
63
75
 
@@ -67,11 +79,17 @@ module HammerCLIForeman
67
79
  class AddDomainCommand < HammerCLIForeman::AddAssociatedCommand
68
80
  associated_resource :domains
69
81
  desc _("Associate a domain")
82
+
83
+ success_message _("The domain has been associated")
84
+ failure_message _("Could not associate the domain")
70
85
  end
71
86
 
72
87
  class RemoveDomainCommand < HammerCLIForeman::RemoveAssociatedCommand
73
88
  associated_resource :domains
74
89
  desc _("Disassociate a domain")
90
+
91
+ success_message _("The domain has been disassociated")
92
+ failure_message _("Could not disassociate the domain")
75
93
  end
76
94
  end
77
95
 
@@ -81,11 +99,17 @@ module HammerCLIForeman
81
99
  class AddMediumCommand < HammerCLIForeman::AddAssociatedCommand
82
100
  associated_resource :media
83
101
  desc _("Associate a medium")
102
+
103
+ success_message _("The medium has been associated")
104
+ failure_message _("Could not associate the medium")
84
105
  end
85
106
 
86
107
  class RemoveMediumCommand < HammerCLIForeman::RemoveAssociatedCommand
87
108
  associated_resource :media
88
109
  desc _("Disassociate a medium")
110
+
111
+ success_message _("The medium has been disassociated")
112
+ failure_message _("Could not disassociate the medium")
89
113
  end
90
114
  end
91
115
 
@@ -95,11 +119,17 @@ module HammerCLIForeman
95
119
  class AddSubnetCommand < HammerCLIForeman::AddAssociatedCommand
96
120
  associated_resource :subnets
97
121
  desc _("Associate a subnet")
122
+
123
+ success_message _("The subnet has been associated")
124
+ failure_message _("Could not associate the subnet")
98
125
  end
99
126
 
100
127
  class RemoveSubnetCommand < HammerCLIForeman::RemoveAssociatedCommand
101
128
  associated_resource :subnets
102
129
  desc _("Disassociate a subnet")
130
+
131
+ success_message _("The subnet has been disassociated")
132
+ failure_message _("Could not disassociate the subnet")
103
133
  end
104
134
  end
105
135
 
@@ -109,11 +139,17 @@ module HammerCLIForeman
109
139
  class AddComputeResourceCommand < HammerCLIForeman::AddAssociatedCommand
110
140
  associated_resource :compute_resources
111
141
  desc _("Associate a compute resource")
142
+
143
+ success_message _("The compute resource has been associated")
144
+ failure_message _("Could not associate the compute resource")
112
145
  end
113
146
 
114
147
  class RemoveComputeResourceCommand < HammerCLIForeman::RemoveAssociatedCommand
115
148
  associated_resource :compute_resources
116
149
  desc _("Disassociate a compute resource")
150
+
151
+ success_message _("The compute resource has been disassociated")
152
+ failure_message _("Could not disassociate the compute resource")
117
153
  end
118
154
  end
119
155
 
@@ -124,6 +160,9 @@ module HammerCLIForeman
124
160
  associated_resource :smart_proxies
125
161
  desc _("Associate a smart proxy")
126
162
 
163
+ success_message _("The smart proxy has been associated")
164
+ failure_message _("Could not associate the smart proxy")
165
+
127
166
  def associated_resource_name
128
167
  "smart-proxy"
129
168
  end
@@ -133,6 +172,9 @@ module HammerCLIForeman
133
172
  associated_resource :smart_proxies
134
173
  desc _("Disassociate a smart proxy")
135
174
 
175
+ success_message _("The smart proxy has been disassociated")
176
+ failure_message _("Could not disassociate the smart proxy")
177
+
136
178
  def associated_resource_name
137
179
  "smart-proxy"
138
180
  end
@@ -189,11 +231,17 @@ module HammerCLIForeman
189
231
  class AddConfigTemplateCommand < HammerCLIForeman::AddAssociatedCommand
190
232
  associated_resource :config_templates
191
233
  desc _("Associate a configuration template")
234
+
235
+ success_message _("The configuration template has been associated")
236
+ failure_message _("Could not associate the configuration template")
192
237
  end
193
238
 
194
239
  class RemoveConfigTemplateCommand < HammerCLIForeman::RemoveAssociatedCommand
195
240
  associated_resource :config_templates
196
241
  desc _("Disassociate a configuration template")
242
+
243
+ success_message _("The configuration template has been disassociated")
244
+ failure_message _("Could not disassociate the configuration template")
197
245
  end
198
246
  end
199
247
 
@@ -203,11 +251,17 @@ module HammerCLIForeman
203
251
  class AddOrganizationCommand < HammerCLIForeman::AddAssociatedCommand
204
252
  associated_resource :organizations
205
253
  desc _("Associate an organization")
254
+
255
+ success_message _("The organization has been associated")
256
+ failure_message _("Could not associate the organization")
206
257
  end
207
258
 
208
259
  class RemoveOrganizationCommand < HammerCLIForeman::RemoveAssociatedCommand
209
260
  associated_resource :organizations
210
261
  desc _("Disassociate an organization")
262
+
263
+ success_message _("The organization has been disassociated")
264
+ failure_message _("Could not disassociate the organization")
211
265
  end
212
266
  end
213
267
 
@@ -25,6 +25,7 @@ module HammerCLIForeman
25
25
  config[:credentials] = credentials
26
26
  config[:logger] = Logging.logger['API']
27
27
  config[:api_version] = 2
28
+ config[:follow_redirects] = HammerCLI::Settings.get(:foreman, :follow_redirects) || :never
28
29
  config[:aggressive_cache_checking] = HammerCLI::Settings.get(:foreman, :refresh_cache) || false
29
30
  config[:headers] = { "Accept-Language" => HammerCLI::I18n.locale }
30
31
  config[:language] = HammerCLI::I18n.locale
@@ -151,7 +152,7 @@ module HammerCLIForeman
151
152
  end
152
153
  begin
153
154
  resolver.send("#{resource.singular_name}_id", opts)
154
- rescue HammerCLIForeman::MissingSeachOptions => e
155
+ rescue HammerCLIForeman::MissingSearchOptions => e
155
156
  if (options[:required] == true || resource_search_requested(resource, opts))
156
157
  logger.info "Error occured while searching for #{resource.singular_name}"
157
158
  raise e
@@ -163,7 +164,7 @@ module HammerCLIForeman
163
164
  opts = resolver.scoped_options(resource.singular_name, all_options)
164
165
  begin
165
166
  resolver.send("#{resource.singular_name}_ids", opts)
166
- rescue HammerCLIForeman::MissingSeachOptions => e
167
+ rescue HammerCLIForeman::MissingSearchOptions => e
167
168
  if (options[:required] == true || resource_search_requested(resource, opts, true))
168
169
  logger.info "Error occured while searching for #{resource.name}"
169
170
  raise e
@@ -187,7 +188,7 @@ module HammerCLIForeman
187
188
 
188
189
  def send_request
189
190
  transform_format(super)
190
- rescue HammerCLIForeman::MissingSeachOptions => e
191
+ rescue HammerCLIForeman::MissingSearchOptions => e
191
192
 
192
193
  switches = self.class.find_options(:referenced_resource => e.resource.singular_name).map(&:long_switch)
193
194
 
@@ -199,7 +200,7 @@ module HammerCLIForeman
199
200
  error_message = _("Could not find %{resource}, please set one of options %{switches}.")
200
201
  end
201
202
 
202
- raise MissingSeachOptions.new(
203
+ raise MissingSearchOptions.new(
203
204
  error_message % {
204
205
  :resource => e.resource.singular_name,
205
206
  :switches => switches.join(", ")
@@ -327,7 +328,9 @@ module HammerCLIForeman
327
328
  end
328
329
 
329
330
  def should_retrieve_all?
330
- pagination_supported? && option_per_page.nil? && option_page.nil?
331
+ retrieve_all = pagination_supported? && option_per_page.nil? && option_page.nil?
332
+ retrieve_all &&= HammerCLI::Settings.get(:ui, :per_page).nil? if output.adapter.paginate_by_default?
333
+ retrieve_all
331
334
  end
332
335
 
333
336
  end
@@ -475,6 +478,11 @@ module HammerCLIForeman
475
478
  return superclass.associated_resource if superclass.respond_to? :associated_resource
476
479
  end
477
480
 
481
+ def self.default_message(format)
482
+ name = associated_resource ? associated_resource.singular_name.to_s : nil
483
+ format % { :resource_name => name.gsub(/_|-/, ' ') } unless name.nil?
484
+ end
485
+
478
486
  def get_associated_identifier
479
487
  get_resource_id(associated_resource, :scoped => true)
480
488
  end
@@ -521,6 +529,14 @@ module HammerCLIForeman
521
529
  description.strip.empty? ? _("Associate a resource") : description
522
530
  end
523
531
 
532
+ def self.failure_message(msg = nil)
533
+ super(msg) || default_message(_('Could not associate the %{resource_name}'))
534
+ end
535
+
536
+ def self.success_message(msg = nil)
537
+ super(msg) || default_message(_('The %{resource_name} has been associated'))
538
+ end
539
+
524
540
  def get_new_ids
525
541
  ids = get_current_ids.map(&:to_s)
526
542
  required_id = get_associated_identifier.to_s
@@ -551,7 +567,12 @@ module HammerCLIForeman
551
567
  ids
552
568
  end
553
569
 
554
- end
555
-
570
+ def self.failure_message(msg = nil)
571
+ super(msg) || default_message(_('Could not disassociate the %{resource_name}'))
572
+ end
556
573
 
574
+ def self.success_message(msg = nil)
575
+ super(msg) || default_message(_('The %{resource_name} has been disassociated'))
576
+ end
577
+ end
557
578
  end
@@ -10,6 +10,7 @@ module HammerCLIForeman
10
10
  [RestClient::InternalServerError, :handle_internal_error],
11
11
  [RestClient::Forbidden, :handle_forbidden],
12
12
  [RestClient::UnprocessableEntity, :handle_unprocessable_entity],
13
+ [RestClient::MovedPermanently, :handle_moved_permanently],
13
14
  [ArgumentError, :handle_argument_error],
14
15
  ]
15
16
  end
@@ -24,6 +25,18 @@ module HammerCLIForeman
24
25
  end
25
26
 
26
27
 
28
+ def handle_moved_permanently(e)
29
+ error = [_("Redirection of API call detected.")]
30
+ https_message = _("It seems hammer is configured to use HTTP and the server prefers HTTPS.")
31
+ error << https_message if strip_protocol(e.response.headers[:location]) == strip_protocol(e.response.request.url)
32
+ error << _("Update your server url configuration")
33
+ error << _("you can set 'follow_redirects' to one of :default or :always to enable redirects following")
34
+ print_error error.join("\n")
35
+ log_full_error e
36
+ HammerCLI::EX_CONFIG
37
+ end
38
+
39
+
27
40
  def handle_internal_error(e)
28
41
  handle_foreman_error(e)
29
42
  HammerCLI::EX_SOFTWARE
@@ -79,5 +92,10 @@ module HammerCLIForeman
79
92
  HammerCLI::EX_CONFIG
80
93
  end
81
94
 
95
+ private
96
+
97
+ def strip_protocol(url)
98
+ url.gsub(%r'^http(s)?://','').gsub(%r'//', '/')
99
+ end
82
100
  end
83
101
  end
@@ -13,7 +13,7 @@ module HammerCLIForeman
13
13
  end
14
14
  end
15
15
 
16
- class MissingSeachOptions < ResolverError; end
16
+ class MissingSearchOptions < ResolverError; end
17
17
 
18
18
  end
19
19
 
@@ -368,12 +368,8 @@ module HammerCLIForeman
368
368
  super
369
369
  unless validator.any(:option_hostgroup_id, :option_hostgroup_name).exist?
370
370
  if option_managed
371
- validator.all(:option_environment_id, :option_architecture_id, :option_domain_id,
372
- :option_puppet_proxy_id, :option_operatingsystem_id,
373
- :option_ptable_id).required
374
- else
375
- # unmanaged host only requires environment
376
- validator.option(:option_environment_id).required
371
+ validator.all(:option_architecture_id, :option_domain_id,
372
+ :option_operatingsystem_id, :option_ptable_id).required
377
373
  end
378
374
  end
379
375
  end
@@ -518,6 +514,15 @@ module HammerCLIForeman
518
514
  end
519
515
  end
520
516
 
517
+ class RebuildConfigCommand < HammerCLIForeman::SingleResourceCommand
518
+ action :rebuild_config
519
+ command_name "rebuild-config"
520
+ desc _('Rebuild orchestration related configurations for host')
521
+ success_message _('Configuration successfully rebuilt.')
522
+
523
+ build_options
524
+ end
525
+
521
526
  autoload_subcommands
522
527
 
523
528
  subcommand 'interface', HammerCLIForeman::Interface.desc, HammerCLIForeman::Interface
@@ -119,7 +119,7 @@ module HammerCLIForeman
119
119
  end
120
120
 
121
121
  def puppetclass_ids(options)
122
- options[HammerCLI.option_accessor_name("ids")] || find_resources(:puppetclasses, options).collect{|h| h.values}.flatten.map{|h| h['id']}
122
+ options[HammerCLI.option_accessor_name("ids")] || find_puppetclasses(options).collect { |c| c['id'] }
123
123
  end
124
124
 
125
125
  protected
@@ -154,6 +154,14 @@ module HammerCLIForeman
154
154
  results
155
155
  end
156
156
 
157
+ def find_puppetclasses(options)
158
+ resource_name = :puppetclasses
159
+ resource = @api.resource(resource_name)
160
+ results = resolved_call(resource_name, :index, options).first.values.flatten
161
+ raise ResolverError.new(_("one of %s not found") % resource.name, resource) if results.count < expected_record_count(options, resource)
162
+ results
163
+ end
164
+
157
165
  def find_resource(resource_name, options)
158
166
  results = find_resource_raw(resource_name, options)
159
167
  resource = @api.resource(resource_name)
@@ -209,7 +217,7 @@ module HammerCLIForeman
209
217
  else
210
218
  create_search_options(options, resource)
211
219
  end
212
- raise MissingSeachOptions.new(_("Missing options to search %s") % resource.singular_name, resource) if search_options.empty?
220
+ raise MissingSearchOptions.new(_("Missing options to search %s") % resource.singular_name, resource) if search_options.empty?
213
221
  search_options
214
222
  end
215
223