hammer_cli_foreman 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (325) hide show
  1. checksums.yaml +4 -4
  2. data/doc/configuration.md +2 -2
  3. data/doc/name_id_resolution.md +26 -1
  4. data/doc/release_notes.md +24 -0
  5. data/lib/hammer_cli_foreman.rb +30 -29
  6. data/lib/hammer_cli_foreman/api/connection.rb +1 -1
  7. data/lib/hammer_cli_foreman/api/interactive_basic_auth.rb +3 -3
  8. data/lib/hammer_cli_foreman/api/session_authenticator_wrapper.rb +9 -8
  9. data/lib/hammer_cli_foreman/api/void_auth.rb +7 -0
  10. data/lib/hammer_cli_foreman/architecture.rb +3 -5
  11. data/lib/hammer_cli_foreman/associating_commands.rb +32 -32
  12. data/lib/hammer_cli_foreman/auth.rb +2 -2
  13. data/lib/hammer_cli_foreman/auth_source_ldap.rb +4 -4
  14. data/lib/hammer_cli_foreman/commands.rb +23 -55
  15. data/lib/hammer_cli_foreman/common_parameter.rb +5 -5
  16. data/lib/hammer_cli_foreman/compute_resource.rb +17 -7
  17. data/lib/hammer_cli_foreman/config_group.rb +3 -3
  18. data/lib/hammer_cli_foreman/domain.rb +6 -8
  19. data/lib/hammer_cli_foreman/environment.rb +3 -3
  20. data/lib/hammer_cli_foreman/exception_handler.rb +27 -4
  21. data/lib/hammer_cli_foreman/external_usergroup.rb +3 -4
  22. data/lib/hammer_cli_foreman/filter.rb +20 -21
  23. data/lib/hammer_cli_foreman/host.rb +43 -18
  24. data/lib/hammer_cli_foreman/hostgroup.rb +24 -19
  25. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +4 -6
  26. data/lib/hammer_cli_foreman/id_resolver.rb +86 -50
  27. data/lib/hammer_cli_foreman/image.rb +3 -4
  28. data/lib/hammer_cli_foreman/interface.rb +7 -9
  29. data/lib/hammer_cli_foreman/location.rb +6 -9
  30. data/lib/hammer_cli_foreman/media.rb +3 -6
  31. data/lib/hammer_cli_foreman/model.rb +3 -6
  32. data/lib/hammer_cli_foreman/operating_system.rb +11 -12
  33. data/lib/hammer_cli_foreman/option_sources.rb +4 -0
  34. data/lib/hammer_cli_foreman/option_sources/id_params.rb +51 -0
  35. data/lib/hammer_cli_foreman/option_sources/ids_params.rb +30 -0
  36. data/lib/hammer_cli_foreman/option_sources/self_param.rb +16 -0
  37. data/lib/hammer_cli_foreman/option_sources/user_params.rb +59 -0
  38. data/lib/hammer_cli_foreman/organization.rb +6 -9
  39. data/lib/hammer_cli_foreman/output/formatters.rb +1 -1
  40. data/lib/hammer_cli_foreman/parameter.rb +3 -5
  41. data/lib/hammer_cli_foreman/partition_table.rb +5 -6
  42. data/lib/hammer_cli_foreman/realm.rb +3 -3
  43. data/lib/hammer_cli_foreman/report.rb +1 -4
  44. data/lib/hammer_cli_foreman/role.rb +4 -7
  45. data/lib/hammer_cli_foreman/settings.rb +1 -1
  46. data/lib/hammer_cli_foreman/smart_class_parameter.rb +24 -14
  47. data/lib/hammer_cli_foreman/smart_proxy.rb +5 -7
  48. data/lib/hammer_cli_foreman/smart_variable.rb +24 -12
  49. data/lib/hammer_cli_foreman/ssh_keys.rb +56 -0
  50. data/lib/hammer_cli_foreman/subnet.rb +6 -9
  51. data/lib/hammer_cli_foreman/template.rb +16 -9
  52. data/lib/hammer_cli_foreman/user.rb +10 -52
  53. data/lib/hammer_cli_foreman/usergroup.rb +3 -3
  54. data/lib/hammer_cli_foreman/version.rb +1 -1
  55. data/test/data/1.15/foreman_api.json +1 -1
  56. data/test/data/1.16/foreman_api.json +1 -0
  57. data/test/functional/compute_resource_test.rb +117 -0
  58. data/test/functional/filter_test.rb +2 -2
  59. data/test/functional/host_test.rb +61 -10
  60. data/test/functional/location_test.rb +5 -5
  61. data/test/functional/organization_test.rb +7 -7
  62. data/test/functional/role_test.rb +3 -3
  63. data/test/functional/smart_class_parameter_test.rb +5 -5
  64. data/test/functional/smart_variable_test.rb +1 -1
  65. data/test/functional/ssh_keys_test.rb +105 -0
  66. data/test/functional/template_test.rb +30 -4
  67. data/test/functional/user_test.rb +5 -5
  68. data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand-parameters.xml +11 -0
  69. data/test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand.xml +7 -0
  70. data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand-parameters.xml +13 -0
  71. data/test/reports/TEST-HammerCLIForeman-Architecture-DeleteCommand.xml +7 -0
  72. data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-output.xml +13 -0
  73. data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand-parameters.xml +13 -0
  74. data/test/reports/TEST-HammerCLIForeman-Architecture-InfoCommand.xml +7 -0
  75. data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-output.xml +13 -0
  76. data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand-parameters.xml +17 -0
  77. data/test/reports/TEST-HammerCLIForeman-Architecture-ListCommand.xml +7 -0
  78. data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand-parameters.xml +15 -0
  79. data/test/reports/TEST-HammerCLIForeman-Architecture-UpdateCommand.xml +7 -0
  80. data/test/reports/TEST-HammerCLIForeman-Architecture.xml +7 -0
  81. data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand-parameters.xml +11 -0
  82. data/test/reports/TEST-HammerCLIForeman-CommonParameter-DeleteCommand.xml +7 -0
  83. data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-output.xml +13 -0
  84. data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand-parameters.xml +17 -0
  85. data/test/reports/TEST-HammerCLIForeman-CommonParameter-ListCommand.xml +7 -0
  86. data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand-parameters.xml +13 -0
  87. data/test/reports/TEST-HammerCLIForeman-CommonParameter-SetCommand.xml +7 -0
  88. data/test/reports/TEST-HammerCLIForeman-CommonParameter.xml +7 -0
  89. data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand-parameters.xml +15 -0
  90. data/test/reports/TEST-HammerCLIForeman-ComputeResource-CreateCommand.xml +7 -0
  91. data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand-parameters.xml +13 -0
  92. data/test/reports/TEST-HammerCLIForeman-ComputeResource-DeleteCommand.xml +7 -0
  93. data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-output.xml +17 -0
  94. data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand-parameters.xml +13 -0
  95. data/test/reports/TEST-HammerCLIForeman-ComputeResource-InfoCommand.xml +7 -0
  96. data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-output.xml +15 -0
  97. data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand-parameters.xml +17 -0
  98. data/test/reports/TEST-HammerCLIForeman-ComputeResource-ListCommand.xml +7 -0
  99. data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand-parameters.xml +15 -0
  100. data/test/reports/TEST-HammerCLIForeman-ComputeResource-UpdateCommand.xml +7 -0
  101. data/test/reports/TEST-HammerCLIForeman-ComputeResource.xml +7 -0
  102. data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand-parameters.xml +11 -0
  103. data/test/reports/TEST-HammerCLIForeman-Domain-CreateCommand.xml +7 -0
  104. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand-parameters.xml +13 -0
  105. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteCommand.xml +7 -0
  106. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand-parameters.xml +15 -0
  107. data/test/reports/TEST-HammerCLIForeman-Domain-DeleteParameterCommand.xml +7 -0
  108. data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-output.xml +21 -0
  109. data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand-parameters.xml +13 -0
  110. data/test/reports/TEST-HammerCLIForeman-Domain-InfoCommand.xml +7 -0
  111. data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-output.xml +13 -0
  112. data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand-parameters.xml +17 -0
  113. data/test/reports/TEST-HammerCLIForeman-Domain-ListCommand.xml +7 -0
  114. data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand-parameters.xml +17 -0
  115. data/test/reports/TEST-HammerCLIForeman-Domain-SetParameterCommand.xml +7 -0
  116. data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand-parameters.xml +15 -0
  117. data/test/reports/TEST-HammerCLIForeman-Domain-UpdateCommand.xml +7 -0
  118. data/test/reports/TEST-HammerCLIForeman-Domain.xml +7 -0
  119. data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand-parameters.xml +11 -0
  120. data/test/reports/TEST-HammerCLIForeman-Environment-CreateCommand.xml +7 -0
  121. data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand-parameters.xml +13 -0
  122. data/test/reports/TEST-HammerCLIForeman-Environment-DeleteCommand.xml +7 -0
  123. data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-output.xml +17 -0
  124. data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand-parameters.xml +13 -0
  125. data/test/reports/TEST-HammerCLIForeman-Environment-InfoCommand.xml +7 -0
  126. data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-output.xml +13 -0
  127. data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand-parameters.xml +17 -0
  128. data/test/reports/TEST-HammerCLIForeman-Environment-ListCommand.xml +7 -0
  129. data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand-parameters.xml +15 -0
  130. data/test/reports/TEST-HammerCLIForeman-Environment-UpdateCommand.xml +7 -0
  131. data/test/reports/TEST-HammerCLIForeman-Environment.xml +7 -0
  132. data/test/reports/TEST-HammerCLIForeman-ExceptionHandler.xml +13 -0
  133. data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand-parameters.xml +46 -0
  134. data/test/reports/TEST-HammerCLIForeman-Host-CreateCommand.xml +7 -0
  135. data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand-parameters.xml +13 -0
  136. data/test/reports/TEST-HammerCLIForeman-Host-DeleteCommand.xml +7 -0
  137. data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand-parameters.xml +15 -0
  138. data/test/reports/TEST-HammerCLIForeman-Host-DeleteParameterCommand.xml +7 -0
  139. data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-output.xml +85 -0
  140. data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand-parameters.xml +13 -0
  141. data/test/reports/TEST-HammerCLIForeman-Host-InfoCommand.xml +7 -0
  142. data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-output.xml +21 -0
  143. data/test/reports/TEST-HammerCLIForeman-Host-ListCommand-parameters.xml +17 -0
  144. data/test/reports/TEST-HammerCLIForeman-Host-ListCommand.xml +7 -0
  145. data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand-output.xml +9 -0
  146. data/test/reports/TEST-HammerCLIForeman-Host-PuppetRunCommand.xml +7 -0
  147. data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand-parameters.xml +17 -0
  148. data/test/reports/TEST-HammerCLIForeman-Host-SetParameterCommand.xml +7 -0
  149. data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand-output.xml +9 -0
  150. data/test/reports/TEST-HammerCLIForeman-Host-StatusCommand.xml +7 -0
  151. data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand-parameters.xml +40 -0
  152. data/test/reports/TEST-HammerCLIForeman-Host-UpdateCommand.xml +7 -0
  153. data/test/reports/TEST-HammerCLIForeman-Host.xml +7 -0
  154. data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand-parameters.xml +11 -0
  155. data/test/reports/TEST-HammerCLIForeman-Hostgroup-CreateCommand.xml +7 -0
  156. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand-parameters.xml +11 -0
  157. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteCommand.xml +7 -0
  158. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand-parameters.xml +13 -0
  159. data/test/reports/TEST-HammerCLIForeman-Hostgroup-DeleteParameterCommand.xml +7 -0
  160. data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-output.xml +29 -0
  161. data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand-parameters.xml +11 -0
  162. data/test/reports/TEST-HammerCLIForeman-Hostgroup-InfoCommand.xml +7 -0
  163. data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-output.xml +27 -0
  164. data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand-parameters.xml +17 -0
  165. data/test/reports/TEST-HammerCLIForeman-Hostgroup-ListCommand.xml +7 -0
  166. data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand-parameters.xml +15 -0
  167. data/test/reports/TEST-HammerCLIForeman-Hostgroup-SetParameterCommand.xml +7 -0
  168. data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand-parameters.xml +13 -0
  169. data/test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand.xml +7 -0
  170. data/test/reports/TEST-HammerCLIForeman-Hostgroup.xml +7 -0
  171. data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-parameters.xml +11 -0
  172. data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand-resource-disabled.xml +11 -0
  173. data/test/reports/TEST-HammerCLIForeman-Location-CreateCommand.xml +7 -0
  174. data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-parameters.xml +13 -0
  175. data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand-resource-disabled.xml +11 -0
  176. data/test/reports/TEST-HammerCLIForeman-Location-DeleteCommand.xml +7 -0
  177. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-output.xml +17 -0
  178. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-parameters.xml +13 -0
  179. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand-resource-disabled.xml +11 -0
  180. data/test/reports/TEST-HammerCLIForeman-Location-InfoCommand.xml +7 -0
  181. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-output.xml +13 -0
  182. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-parameters.xml +17 -0
  183. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand-resource-disabled.xml +11 -0
  184. data/test/reports/TEST-HammerCLIForeman-Location-ListCommand.xml +7 -0
  185. data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-parameters.xml +15 -0
  186. data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand-resource-disabled.xml +11 -0
  187. data/test/reports/TEST-HammerCLIForeman-Location-UpdateCommand.xml +7 -0
  188. data/test/reports/TEST-HammerCLIForeman-Location.xml +7 -0
  189. data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand-parameters.xml +13 -0
  190. data/test/reports/TEST-HammerCLIForeman-Medium-CreateCommand.xml +7 -0
  191. data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand-parameters.xml +13 -0
  192. data/test/reports/TEST-HammerCLIForeman-Medium-DeleteCommand.xml +7 -0
  193. data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-output.xml +23 -0
  194. data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand-parameters.xml +13 -0
  195. data/test/reports/TEST-HammerCLIForeman-Medium-InfoCommand.xml +7 -0
  196. data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-output.xml +15 -0
  197. data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand-parameters.xml +17 -0
  198. data/test/reports/TEST-HammerCLIForeman-Medium-ListCommand.xml +7 -0
  199. data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand-parameters.xml +17 -0
  200. data/test/reports/TEST-HammerCLIForeman-Medium-UpdateCommand.xml +7 -0
  201. data/test/reports/TEST-HammerCLIForeman-Medium.xml +7 -0
  202. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand-parameters.xml +11 -0
  203. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-CreateCommand.xml +7 -0
  204. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand-parameters.xml +13 -0
  205. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteCommand.xml +7 -0
  206. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand-parameters.xml +13 -0
  207. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-DeleteParameterCommand.xml +7 -0
  208. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-output.xml +27 -0
  209. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand-parameters.xml +13 -0
  210. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-InfoCommand.xml +7 -0
  211. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-output.xml +17 -0
  212. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand-parameters.xml +17 -0
  213. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-ListCommand.xml +7 -0
  214. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand-parameters.xml +15 -0
  215. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-SetParameterCommand.xml +7 -0
  216. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand-parameters.xml +17 -0
  217. data/test/reports/TEST-HammerCLIForeman-OperatingSystem-UpdateCommand.xml +7 -0
  218. data/test/reports/TEST-HammerCLIForeman-OperatingSystem.xml +7 -0
  219. data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-parameters.xml +11 -0
  220. data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand-resource-disabled.xml +11 -0
  221. data/test/reports/TEST-HammerCLIForeman-Organization-CreateCommand.xml +7 -0
  222. data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-parameters.xml +13 -0
  223. data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand-resource-disabled.xml +11 -0
  224. data/test/reports/TEST-HammerCLIForeman-Organization-DeleteCommand.xml +7 -0
  225. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-output.xml +17 -0
  226. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-parameters.xml +13 -0
  227. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand-resource-disabled.xml +11 -0
  228. data/test/reports/TEST-HammerCLIForeman-Organization-InfoCommand.xml +7 -0
  229. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-output.xml +13 -0
  230. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-parameters.xml +17 -0
  231. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand-resource-disabled.xml +11 -0
  232. data/test/reports/TEST-HammerCLIForeman-Organization-ListCommand.xml +7 -0
  233. data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-parameters.xml +15 -0
  234. data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand-resource-disabled.xml +11 -0
  235. data/test/reports/TEST-HammerCLIForeman-Organization-UpdateCommand.xml +7 -0
  236. data/test/reports/TEST-HammerCLIForeman-Organization.xml +7 -0
  237. data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand-parameters.xml +13 -0
  238. data/test/reports/TEST-HammerCLIForeman-PartitionTable-CreateCommand.xml +7 -0
  239. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand-parameters.xml +13 -0
  240. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DeleteCommand.xml +7 -0
  241. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand-parameters.xml +15 -0
  242. data/test/reports/TEST-HammerCLIForeman-PartitionTable-DumpCommand.xml +7 -0
  243. data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-output.xml +19 -0
  244. data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand-parameters.xml +13 -0
  245. data/test/reports/TEST-HammerCLIForeman-PartitionTable-InfoCommand.xml +7 -0
  246. data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-output.xml +15 -0
  247. data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-parameters.xml +17 -0
  248. data/test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand.xml +7 -0
  249. data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand-parameters.xml +13 -0
  250. data/test/reports/TEST-HammerCLIForeman-PartitionTable-UpdateCommand.xml +7 -0
  251. data/test/reports/TEST-HammerCLIForeman-PartitionTable.xml +7 -0
  252. data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand-parameters.xml +13 -0
  253. data/test/reports/TEST-HammerCLIForeman-SmartProxy-CreateCommand.xml +7 -0
  254. data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand-parameters.xml +13 -0
  255. data/test/reports/TEST-HammerCLIForeman-SmartProxy-DeleteCommand.xml +7 -0
  256. data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-output.xml +21 -0
  257. data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand-parameters.xml +13 -0
  258. data/test/reports/TEST-HammerCLIForeman-SmartProxy-InfoCommand.xml +7 -0
  259. data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-output.xml +15 -0
  260. data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand-parameters.xml +11 -0
  261. data/test/reports/TEST-HammerCLIForeman-SmartProxy-ListCommand.xml +7 -0
  262. data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand-parameters.xml +15 -0
  263. data/test/reports/TEST-HammerCLIForeman-SmartProxy-UpdateCommand.xml +7 -0
  264. data/test/reports/TEST-HammerCLIForeman-SmartProxy.xml +7 -0
  265. data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand-parameters.xml +15 -0
  266. data/test/reports/TEST-HammerCLIForeman-Subnet-CreateCommand.xml +7 -0
  267. data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand-parameters.xml +13 -0
  268. data/test/reports/TEST-HammerCLIForeman-Subnet-DeleteCommand.xml +7 -0
  269. data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-output.xml +43 -0
  270. data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand-parameters.xml +13 -0
  271. data/test/reports/TEST-HammerCLIForeman-Subnet-InfoCommand.xml +7 -0
  272. data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-output.xml +17 -0
  273. data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand-parameters.xml +17 -0
  274. data/test/reports/TEST-HammerCLIForeman-Subnet-ListCommand.xml +7 -0
  275. data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand-parameters.xml +15 -0
  276. data/test/reports/TEST-HammerCLIForeman-Subnet-UpdateCommand.xml +7 -0
  277. data/test/reports/TEST-HammerCLIForeman-Subnet.xml +7 -0
  278. data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand-parameters.xml +15 -0
  279. data/test/reports/TEST-HammerCLIForeman-Template-CreateCommand.xml +7 -0
  280. data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand-parameters.xml +11 -0
  281. data/test/reports/TEST-HammerCLIForeman-Template-DeleteCommand.xml +7 -0
  282. data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand-parameters.xml +12 -0
  283. data/test/reports/TEST-HammerCLIForeman-Template-DumpCommand.xml +7 -0
  284. data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-output.xml +17 -0
  285. data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand-parameters.xml +11 -0
  286. data/test/reports/TEST-HammerCLIForeman-Template-InfoCommand.xml +7 -0
  287. data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-output.xml +15 -0
  288. data/test/reports/TEST-HammerCLIForeman-Template-ListCommand-parameters.xml +17 -0
  289. data/test/reports/TEST-HammerCLIForeman-Template-ListCommand.xml +7 -0
  290. data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand-parameters.xml +9 -0
  291. data/test/reports/TEST-HammerCLIForeman-Template-ListKindsCommand.xml +7 -0
  292. data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand-parameters.xml +11 -0
  293. data/test/reports/TEST-HammerCLIForeman-Template-UpdateCommand.xml +7 -0
  294. data/test/reports/TEST-HammerCLIForeman-Template.xml +7 -0
  295. data/test/reports/TEST-HammerCLIForeman-User-CreateCommand-parameters.xml +19 -0
  296. data/test/reports/TEST-HammerCLIForeman-User-CreateCommand.xml +7 -0
  297. data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand-parameters.xml +11 -0
  298. data/test/reports/TEST-HammerCLIForeman-User-DeleteCommand.xml +7 -0
  299. data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-output.xml +23 -0
  300. data/test/reports/TEST-HammerCLIForeman-User-InfoCommand-parameters.xml +11 -0
  301. data/test/reports/TEST-HammerCLIForeman-User-InfoCommand.xml +7 -0
  302. data/test/reports/TEST-HammerCLIForeman-User-ListCommand-output.xml +17 -0
  303. data/test/reports/TEST-HammerCLIForeman-User-ListCommand-parameters.xml +17 -0
  304. data/test/reports/TEST-HammerCLIForeman-User-ListCommand.xml +7 -0
  305. data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand-parameters.xml +11 -0
  306. data/test/reports/TEST-HammerCLIForeman-User-UpdateCommand.xml +7 -0
  307. data/test/reports/TEST-HammerCLIForeman-User.xml +7 -0
  308. data/test/reports/TEST-MiniTest-Spec.xml +7 -0
  309. data/test/unit/api/interactive_basic_auth_test.rb +20 -1
  310. data/test/unit/api/session_authenticator_wrapper_test.rb +23 -8
  311. data/test/unit/api/void_auth_test.rb +11 -0
  312. data/test/unit/commands_test.rb +1 -1
  313. data/test/unit/exception_handler_test.rb +24 -3
  314. data/test/unit/helpers/command.rb +6 -2
  315. data/test/unit/host_test.rb +2 -2
  316. data/test/unit/hostgroup_test.rb +5 -3
  317. data/test/unit/id_resolver_test.rb +53 -5
  318. data/test/unit/media_test.rb +2 -2
  319. data/test/unit/option_sources/id_params_test.rb +30 -0
  320. data/test/unit/option_sources/ids_params_test.rb +30 -0
  321. data/test/unit/output/formatters_test.rb +4 -0
  322. data/test/unit/smart_class_parameter_test.rb +4 -4
  323. data/test/unit/smart_variable_test.rb +2 -2
  324. data/test/unit/user_test.rb +1 -2
  325. metadata +569 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bbff81f4608f3747313bf8525acb14c1734db93
4
- data.tar.gz: 9fe96408c5e413b1731c4196d1cb62c80895a20d
3
+ metadata.gz: d87fa149fc1614b767ea22dbb7035c5ce7885b8d
4
+ data.tar.gz: 95e857975d4178e6e75da2b50643f52b05ab3723
5
5
  SHA512:
6
- metadata.gz: 080d7ba7ce6424c9bf4ff975e3d3bf63336cb565d96455fa4e07e317cc447eb52b8c5ede99de581c5026f259fb9e7f9943acc6dec41651137e732ae654639067
7
- data.tar.gz: 94cbec39dca93447a6105586a948f2c5708b8dad4563731d5203ec303c579fa9612003d993eadc186a0e248e8976dae2b11cecc32ad83356339185ecec92fc25
6
+ metadata.gz: ebb86bc0b6cf8dfde731271567c1c6592fa4d37b59338e26e367bbb62b8ee60f091b2ba6fb1880721c4a5b0d3ce7382af210fe82ba57b94dc24ee2da4f13c6ff
7
+ data.tar.gz: 3249b9157df0f2f25417f62fb3268618edfbfdf4be50178675e70a16945f89dc255ffb8a4e4df144666a445eb74c8b1806379c8f3e2b1ffa67767f23a61bd3e3
data/doc/configuration.md CHANGED
@@ -45,7 +45,7 @@ It's disabled by default. To turn it on, put following into your config file:
45
45
  :foreman:
46
46
  :use_sessions: true
47
47
  ```
48
- Unfortunately retry on session expiry is yet to be implemented. Therefore you'll observe first command to fail
49
- after the session expires.
48
+ Please note that when you turn sessions on, the credentials stored in your config file will be ignored.
50
49
 
51
50
  The default session timeout is 1 hour. This can be changed in the Foreman: `Settings > Authentication > Idle timeout`
51
+ When the session expires hammer will prompt for username and password again.
@@ -15,6 +15,7 @@ ID resolution step by step
15
15
 
16
16
  `IdResolver` implements the method `<resource_name>_id(cli_options)` for each of the resources. Under the hood, the method:
17
17
  - returns `cli_options['option_id']` if it's not nil
18
+ - returns HammerCLI::NilValue if the correspondent search option is set to HammerCLI::NilValue (i.e. NIL specified on CLI)
18
19
  - looks at `index` method's parameters, finds all required `*_id` params there and makes sure they're present (if not it tries to resolve them recursively)
19
20
  - extends the original options with a `search` field that searches for the name
20
21
  - calls the `index` method and returns the result
@@ -25,6 +26,15 @@ It can end up with an exception when:
25
26
  - the resource was not found
26
27
  - more resources were found
27
28
 
29
+ Differences in resolution of list of id's
30
+ -----------------------------------------
31
+
32
+ the lookup method is called `<resource_name>_ids` and in addition:
33
+ - returns `cli_options['option_ids']` if it's not nil
34
+ - returns empty list (`[]`) when the search option is set to empty string or empty list
35
+
36
+ It also ends up with exception when any of the ids was not resolved.
37
+
28
38
  APIdoc requirements
29
39
  -------------------
30
40
 
@@ -46,5 +56,20 @@ Option builders should take care of all the requirements for you, but just for t
46
56
  Behaviour tuning
47
57
  ----------------
48
58
 
49
- Most of the resources are searchable by name. However there are exceptions that either don't have a name or offer more searchable fields. In such cases you have to update [the definition of searchable fields](https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/id_resolver.rb#L31).
59
+ The resolution can be tuned at various levels.
60
+
61
+ Most of the resources are searchable by name. However there are exceptions that either don't have a name
62
+ or offer more searchable fields. In such cases you have to update the definition
63
+ of searchable fields (SEARCHABLES) in [id_resolver](https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/id_resolver.rb).
64
+
65
+ If you need to modify the lookup query (the `search` field) you can override the default one by adding a method
66
+ returning the correct lookup options to the resolver class.
67
+ The method should be called according to the following schema:
68
+ - `create_<resource_name>_search_options(options)` for single id lookup (takes precedence over the next one for single id lookups)
69
+ - `create_<resource_plural_name>_search_options(options)` combine for single and/or multiple ids lookup
70
+ - `create_<resource_plural_name>_search_options(options, mode)` combined with extra parameter suggesting the lookup mode and being set to `:single`, `:multi` or `nil`
71
+
72
+ For examples check the `id_resolver`.
50
73
 
74
+ It is possible to completely override the resolution procedure by adding a method(s) called `<resource_name>_id` and/or `<resource_name>_ids` to the `id_resolver`.
75
+ It will get the options hash as an input and expects `id` (list of `ids` respectively) or a `ResolverError` on its return.
data/doc/release_notes.md CHANGED
@@ -1,6 +1,30 @@
1
1
  Release notes
2
2
  =============
3
3
 
4
+ ### 0.12.0 (2018-02-19)
5
+ * Do not resolve already resolved id params ([#22517](http://projects.theforeman.org/issues/22517))
6
+ * Generate --provision-method from apidoc ([#22552](http://projects.theforeman.org/issues/22552))
7
+ * Review whitespace in extracted strings ([#7451](http://projects.theforeman.org/issues/7451))
8
+ * Allow nil searchables ([#21768](http://projects.theforeman.org/issues/21768))
9
+ * Fix typo for hostgroup in functional test ([#22094](http://projects.theforeman.org/issues/22094))
10
+ * Rename add-override-value to add-matcher ([#12999](http://projects.theforeman.org/issues/12999))
11
+ * Handle 400 bad request - concat response message ([#21627](http://projects.theforeman.org/issues/21627))
12
+ * Make hammer host reports work ([#20742](http://projects.theforeman.org/issues/20742))
13
+ * "unknown template kind" message translated ([#4573](http://projects.theforeman.org/issues/4573))
14
+ * Add status for Void authenticator ([#20505](http://projects.theforeman.org/issues/20505))
15
+ * Add show command for ssh-keys ([#20476](http://projects.theforeman.org/issues/20476))
16
+ * Add org/loc in ptable info command ([#21264](http://projects.theforeman.org/issues/21264))
17
+ * Create compute-resource VMware - URL optional ([#17568](http://projects.theforeman.org/issues/17568))
18
+ * Test to expect integer params as a number ([#21013](http://projects.theforeman.org/issues/21013))
19
+ * Add ssh-keys commands ([#20476](http://projects.theforeman.org/issues/20476))
20
+ * Remove --include and --thin from host-hostgroup list ([#20754](http://projects.theforeman.org/issues/20754))
21
+ * Added fields info to hostgroup/host info command ([#18750](http://projects.theforeman.org/issues/18750))
22
+ * Don't store session_id for unauthorized responses ([#20575](http://projects.theforeman.org/issues/20575))
23
+ * Owner Name is shown in hammer host info command ([#20709](http://projects.theforeman.org/issues/20709))
24
+ * Show empty table field with ReferenceFormatter ([#20758](http://projects.theforeman.org/issues/20758))
25
+ * Better logging of 403 responses ([#20120](http://projects.theforeman.org/issues/20120))
26
+ * Update documentation for sessions ([#20315](http://projects.theforeman.org/issues/20315))
27
+
4
28
  ### 0.11.0 (2017-08-01)
5
29
  * Adding a list normalizer to override-value-order ([#17135](http://projects.theforeman.org/issues/17135))
6
30
  * Correctly reset taxonomies for overriding filters ([#20117](http://projects.theforeman.org/issues/20117))
@@ -18,6 +18,7 @@ module HammerCLIForeman
18
18
  require 'hammer_cli_foreman/param_filters'
19
19
  require 'hammer_cli_foreman/id_resolver'
20
20
  require 'hammer_cli_foreman/dependency_resolver'
21
+ require 'hammer_cli_foreman/option_sources'
21
22
 
22
23
  begin
23
24
  require 'hammer_cli_foreman/commands'
@@ -27,119 +28,119 @@ module HammerCLIForeman
27
28
  require 'hammer_cli_foreman/common_parameter'
28
29
  require 'hammer_cli_foreman/defaults'
29
30
 
30
- HammerCLI::MainCommand.lazy_subcommand('auth', _("Foreman connection login/logout."),
31
+ HammerCLI::MainCommand.lazy_subcommand('auth', _("Foreman connection login/logout"),
31
32
  'HammerCLIForeman::Auth', 'hammer_cli_foreman/auth'
32
33
  )
33
34
 
34
- HammerCLI::MainCommand.lazy_subcommand('architecture', _("Manipulate architectures."),
35
+ HammerCLI::MainCommand.lazy_subcommand('architecture', _("Manipulate architectures"),
35
36
  'HammerCLIForeman::Architecture', 'hammer_cli_foreman/architecture'
36
37
  )
37
38
 
38
- HammerCLI::MainCommand.lazy_subcommand('auth-source', _("Manipulate auth sources."),
39
+ HammerCLI::MainCommand.lazy_subcommand('auth-source', _("Manipulate auth sources"),
39
40
  'HammerCLIForeman::AuthSource', 'hammer_cli_foreman/auth_source'
40
41
  )
41
42
 
42
- HammerCLI::MainCommand.lazy_subcommand('compute-resource', _("Manipulate compute resources."),
43
+ HammerCLI::MainCommand.lazy_subcommand('compute-resource', _("Manipulate compute resources"),
43
44
  'HammerCLIForeman::ComputeResource', 'hammer_cli_foreman/compute_resource'
44
45
  )
45
46
 
46
- HammerCLI::MainCommand.lazy_subcommand('domain', _("Manipulate domains."),
47
+ HammerCLI::MainCommand.lazy_subcommand('domain', _("Manipulate domains"),
47
48
  'HammerCLIForeman::Domain', 'hammer_cli_foreman/domain'
48
49
  )
49
50
 
50
- HammerCLI::MainCommand.lazy_subcommand('environment', _("Manipulate environments."),
51
+ HammerCLI::MainCommand.lazy_subcommand('environment', _("Manipulate environments"),
51
52
  'HammerCLIForeman::Environment', 'hammer_cli_foreman/environment'
52
53
  )
53
54
 
54
- HammerCLI::MainCommand.lazy_subcommand('fact', _("Search facts."),
55
+ HammerCLI::MainCommand.lazy_subcommand('fact', _("Search facts"),
55
56
  'HammerCLIForeman::Fact', 'hammer_cli_foreman/fact'
56
57
  )
57
58
 
58
- HammerCLI::MainCommand.lazy_subcommand('filter', _("Manage permission filters."),
59
+ HammerCLI::MainCommand.lazy_subcommand('filter', _("Manage permission filters"),
59
60
  'HammerCLIForeman::Filter', 'hammer_cli_foreman/filter'
60
61
  )
61
62
 
62
- HammerCLI::MainCommand.lazy_subcommand('host', _("Manipulate hosts."),
63
+ HammerCLI::MainCommand.lazy_subcommand('host', _("Manipulate hosts"),
63
64
  'HammerCLIForeman::Host', 'hammer_cli_foreman/host'
64
65
  )
65
66
 
66
- HammerCLI::MainCommand.lazy_subcommand('hostgroup', _("Manipulate hostgroups."),
67
+ HammerCLI::MainCommand.lazy_subcommand('hostgroup', _("Manipulate hostgroups"),
67
68
  'HammerCLIForeman::Hostgroup', 'hammer_cli_foreman/hostgroup'
68
69
  )
69
70
 
70
- HammerCLI::MainCommand.lazy_subcommand('location', _("Manipulate locations."),
71
+ HammerCLI::MainCommand.lazy_subcommand('location', _("Manipulate locations"),
71
72
  'HammerCLIForeman::Location', 'hammer_cli_foreman/location'
72
73
  )
73
74
 
74
- HammerCLI::MainCommand.lazy_subcommand('medium', _("Manipulate installation media."),
75
+ HammerCLI::MainCommand.lazy_subcommand('medium', _("Manipulate installation media"),
75
76
  'HammerCLIForeman::Medium', 'hammer_cli_foreman/media'
76
77
  )
77
78
 
78
- HammerCLI::MainCommand.lazy_subcommand('model', _("Manipulate hardware models."),
79
+ HammerCLI::MainCommand.lazy_subcommand('model', _("Manipulate hardware models"),
79
80
  'HammerCLIForeman::Model', 'hammer_cli_foreman/model'
80
81
  )
81
82
 
82
- HammerCLI::MainCommand.lazy_subcommand('os', _("Manipulate operating system."),
83
+ HammerCLI::MainCommand.lazy_subcommand('os', _("Manipulate operating system"),
83
84
  'HammerCLIForeman::OperatingSystem', 'hammer_cli_foreman/operating_system'
84
85
  )
85
86
 
86
- HammerCLI::MainCommand.lazy_subcommand('organization', _("Manipulate organizations."),
87
+ HammerCLI::MainCommand.lazy_subcommand('organization', _("Manipulate organizations"),
87
88
  'HammerCLIForeman::Organization', 'hammer_cli_foreman/organization'
88
89
  )
89
90
 
90
- HammerCLI::MainCommand.lazy_subcommand('partition-table', _("Manipulate partition tables."),
91
+ HammerCLI::MainCommand.lazy_subcommand('partition-table', _("Manipulate partition tables"),
91
92
  'HammerCLIForeman::PartitionTable', 'hammer_cli_foreman/partition_table'
92
93
  )
93
94
 
94
- HammerCLI::MainCommand.lazy_subcommand('puppet-class', _("Search puppet modules."),
95
+ HammerCLI::MainCommand.lazy_subcommand('puppet-class', _("Search puppet modules"),
95
96
  'HammerCLIForeman::PuppetClass', 'hammer_cli_foreman/puppet_class'
96
97
  )
97
98
 
98
- HammerCLI::MainCommand.lazy_subcommand('report', _("Browse and read reports."),
99
+ HammerCLI::MainCommand.lazy_subcommand('report', _("Browse and read reports"),
99
100
  'HammerCLIForeman::Report', 'hammer_cli_foreman/report'
100
101
  )
101
102
 
102
- HammerCLI::MainCommand.lazy_subcommand('role', _("Manage user roles."),
103
+ HammerCLI::MainCommand.lazy_subcommand('role', _("Manage user roles"),
103
104
  'HammerCLIForeman::Role', 'hammer_cli_foreman/role'
104
105
  )
105
106
 
106
- HammerCLI::MainCommand.lazy_subcommand('sc-param', _("Manipulate smart class parameters."),
107
+ HammerCLI::MainCommand.lazy_subcommand('sc-param', _("Manipulate smart class parameters"),
107
108
  'HammerCLIForeman::SmartClassParameter', 'hammer_cli_foreman/smart_class_parameter'
108
109
  )
109
110
 
110
- HammerCLI::MainCommand.lazy_subcommand('smart-variable', _("Manipulate smart variables."),
111
+ HammerCLI::MainCommand.lazy_subcommand('smart-variable', _("Manipulate smart variables"),
111
112
  'HammerCLIForeman::SmartVariable', 'hammer_cli_foreman/smart_variable'
112
113
  )
113
114
 
114
- HammerCLI::MainCommand.lazy_subcommand('proxy', _("Manipulate smart proxies."),
115
+ HammerCLI::MainCommand.lazy_subcommand('proxy', _("Manipulate smart proxies"),
115
116
  'HammerCLIForeman::SmartProxy', 'hammer_cli_foreman/smart_proxy'
116
117
  )
117
118
 
118
- HammerCLI::MainCommand.lazy_subcommand('realm', _("Manipulate realms."),
119
+ HammerCLI::MainCommand.lazy_subcommand('realm', _("Manipulate realms"),
119
120
  'HammerCLIForeman::Realm', 'hammer_cli_foreman/realm'
120
121
  )
121
122
 
122
- HammerCLI::MainCommand.lazy_subcommand('settings', _("Change server settings."),
123
+ HammerCLI::MainCommand.lazy_subcommand('settings', _("Change server settings"),
123
124
  'HammerCLIForeman::Settings', 'hammer_cli_foreman/settings'
124
125
  )
125
126
 
126
- HammerCLI::MainCommand.lazy_subcommand('subnet', _("Manipulate subnets."),
127
+ HammerCLI::MainCommand.lazy_subcommand('subnet', _("Manipulate subnets"),
127
128
  'HammerCLIForeman::Subnet', 'hammer_cli_foreman/subnet'
128
129
  )
129
130
 
130
- HammerCLI::MainCommand.lazy_subcommand('template', _("Manipulate config templates."),
131
+ HammerCLI::MainCommand.lazy_subcommand('template', _("Manipulate config templates"),
131
132
  'HammerCLIForeman::Template', 'hammer_cli_foreman/template'
132
133
  )
133
134
 
134
- HammerCLI::MainCommand.lazy_subcommand('user', _("Manipulate users."),
135
+ HammerCLI::MainCommand.lazy_subcommand('user', _("Manipulate users"),
135
136
  'HammerCLIForeman::User', 'hammer_cli_foreman/user'
136
137
  )
137
138
 
138
- HammerCLI::MainCommand.lazy_subcommand('user-group', _("Manage user groups."),
139
+ HammerCLI::MainCommand.lazy_subcommand('user-group', _("Manage user groups"),
139
140
  'HammerCLIForeman::Usergroup', 'hammer_cli_foreman/usergroup'
140
141
  )
141
142
 
142
- HammerCLI::MainCommand.lazy_subcommand('config-group', _("Manipulate config groups."),
143
+ HammerCLI::MainCommand.lazy_subcommand('config-group', _("Manipulate config groups"),
143
144
  'HammerCLIForeman::ConfigGroup', 'hammer_cli_foreman/config_group'
144
145
  )
145
146
 
@@ -34,7 +34,7 @@ module HammerCLIForeman
34
34
  return @authenticator if @authenticator
35
35
 
36
36
  if ssl_cert_authentication?(settings) && !use_basic_auth?(settings)
37
- @authenticator = VoidAuth.new
37
+ @authenticator = VoidAuth.new(_('Using certificate authentication.'))
38
38
  else
39
39
  if settings.get(:foreman, :use_sessions)
40
40
  @authenticator = InteractiveBasicAuth.new(
@@ -14,7 +14,7 @@ module HammerCLIForeman
14
14
  def error(ex)
15
15
  if ex.is_a?(RestClient::Unauthorized)
16
16
  self.clear
17
- return UnauthorizedError.new(_("Invalid username or password"))
17
+ return UnauthorizedError.new(_("Invalid username or password."))
18
18
  end
19
19
  end
20
20
 
@@ -42,11 +42,11 @@ module HammerCLIForeman
42
42
  private
43
43
 
44
44
  def get_user
45
- @user ||= ask_user(_("[Foreman] Username: "))
45
+ @user ||= ask_user(_("[Foreman] Username:%s") % " ")
46
46
  end
47
47
 
48
48
  def get_password
49
- @password ||= ask_user(_("[Foreman] Password for %s: ") % @user, true)
49
+ @password ||= ask_user(_("[Foreman] Password for %{user}:%{wsp}") % {:user => @user, :wsp => " "}, true)
50
50
  end
51
51
 
52
52
  def ask_user(prompt, silent=false)
@@ -5,6 +5,8 @@ module HammerCLIForeman
5
5
  class SessionAuthenticatorWrapper < ApipieBindings::Authenticators::Base
6
6
  SESSION_STORAGE = '~/.hammer/sessions/'
7
7
 
8
+ attr_reader :session_id
9
+
8
10
  def initialize(authenticator, url, storage_dir = nil)
9
11
  @authenticator = authenticator
10
12
  @url = url
@@ -23,7 +25,7 @@ module HammerCLIForeman
23
25
 
24
26
  def status
25
27
  if load_session
26
- _("Session exists, currently logged in as '%s'") % @user
28
+ _("Session exists, currently logged in as '%s'.") % @user
27
29
  else
28
30
  _("Using sessions, you are currently not logged in.")
29
31
  end
@@ -58,10 +60,10 @@ module HammerCLIForeman
58
60
  load_session
59
61
  if ex.is_a?(RestClient::Unauthorized) && !@session_id.nil?
60
62
  if @user_changed
61
- return UnauthorizedError.new(_("Invalid username or password, continuing with session for '%s'") % @user)
63
+ return UnauthorizedError.new(_("Invalid username or password, continuing with session for '%s'.") % @user)
62
64
  else
63
65
  destroy_session
64
- return SessionExpired.new(_("Session has expired"))
66
+ return SessionExpired.new(_("Session has expired."))
65
67
  end
66
68
  else
67
69
  return @authenticator.error(ex)
@@ -69,8 +71,8 @@ module HammerCLIForeman
69
71
  end
70
72
 
71
73
  def response(r)
72
- @session_id = r.cookies['_session_id']
73
- if (@session_id && r.code != 401)
74
+ if (r.cookies['_session_id'] && r.code != 401)
75
+ @session_id = r.cookies['_session_id']
74
76
  save_session(@session_id, @authenticator.user)
75
77
  end
76
78
  @authenticator.response(r)
@@ -102,7 +104,7 @@ module HammerCLIForeman
102
104
  end
103
105
  rescue JSON::ParserError
104
106
  destroy_session
105
- warn _('Invalid session file format')
107
+ warn _('Invalid session file format.')
106
108
  nil
107
109
  end
108
110
 
@@ -130,7 +132,7 @@ module HammerCLIForeman
130
132
  return true unless File.exist?(file)
131
133
  mode = File.stat(file).mode.to_s(8)
132
134
  if mode != expected_mode
133
- warn _("Invalid permissions for %{file}: %{mode}, expected %{expected_mode}") % {
135
+ warn _("Invalid permissions for %{file}: %{mode}, expected %{expected_mode}.") % {
134
136
  :mode => mode,
135
137
  :expected_mode => expected_mode,
136
138
  :file => file
@@ -144,4 +146,3 @@ module HammerCLIForeman
144
146
  end
145
147
  end
146
148
  end
147
-
@@ -3,6 +3,13 @@ require 'highline/import'
3
3
  module HammerCLIForeman
4
4
  module Api
5
5
  class VoidAuth < ApipieBindings::Authenticators::Base
6
+ def initialize(message)
7
+ @message = message
8
+ end
9
+
10
+ def status
11
+ @message
12
+ end
6
13
  end
7
14
  end
8
15
  end
@@ -28,7 +28,7 @@ module HammerCLIForeman
28
28
 
29
29
 
30
30
  class CreateCommand < HammerCLIForeman::CreateCommand
31
- success_message _("Architecture created")
31
+ success_message _("Architecture created.")
32
32
  failure_message _("Could not create the architecture")
33
33
 
34
34
  build_options
@@ -36,7 +36,7 @@ module HammerCLIForeman
36
36
 
37
37
 
38
38
  class DeleteCommand < HammerCLIForeman::DeleteCommand
39
- success_message _("Architecture deleted")
39
+ success_message _("Architecture deleted.")
40
40
  failure_message _("Could not delete the architecture")
41
41
 
42
42
  build_options
@@ -44,7 +44,7 @@ module HammerCLIForeman
44
44
 
45
45
 
46
46
  class UpdateCommand < HammerCLIForeman::UpdateCommand
47
- success_message _("Architecture updated")
47
+ success_message _("Architecture updated.")
48
48
  failure_message _("Could not update the architecture")
49
49
 
50
50
  build_options
@@ -56,5 +56,3 @@ module HammerCLIForeman
56
56
  end
57
57
 
58
58
  end
59
-
60
-
@@ -40,7 +40,7 @@ module HammerCLIForeman
40
40
  associated_resource :hostgroups
41
41
  desc _("Associate a hostgroup")
42
42
 
43
- success_message _("The hostgroup has been associated")
43
+ success_message _("The hostgroup has been associated.")
44
44
  failure_message _("Could not associate the hostgroup")
45
45
  end
46
46
 
@@ -48,7 +48,7 @@ module HammerCLIForeman
48
48
  associated_resource :hostgroups
49
49
  desc _("Disassociate a hostgroup")
50
50
 
51
- success_message _("The hostgroup has been disassociated")
51
+ success_message _("The hostgroup has been disassociated.")
52
52
  failure_message _("Could not disassociate the hostgroup")
53
53
  end
54
54
  end
@@ -60,7 +60,7 @@ module HammerCLIForeman
60
60
  associated_resource :environments
61
61
  desc _("Associate an environment")
62
62
 
63
- success_message _("The environment has been associated")
63
+ success_message _("The environment has been associated.")
64
64
  failure_message _("Could not associate the environment")
65
65
  end
66
66
 
@@ -68,7 +68,7 @@ module HammerCLIForeman
68
68
  associated_resource :environments
69
69
  desc _("Disassociate an environment")
70
70
 
71
- success_message _("The environment has been disassociated")
71
+ success_message _("The environment has been disassociated.")
72
72
  failure_message _("Could not disassociate the environment")
73
73
  end
74
74
  end
@@ -80,7 +80,7 @@ module HammerCLIForeman
80
80
  associated_resource :domains
81
81
  desc _("Associate a domain")
82
82
 
83
- success_message _("The domain has been associated")
83
+ success_message _("The domain has been associated.")
84
84
  failure_message _("Could not associate the domain")
85
85
  end
86
86
 
@@ -88,7 +88,7 @@ module HammerCLIForeman
88
88
  associated_resource :domains
89
89
  desc _("Disassociate a domain")
90
90
 
91
- success_message _("The domain has been disassociated")
91
+ success_message _("The domain has been disassociated.")
92
92
  failure_message _("Could not disassociate the domain")
93
93
  end
94
94
  end
@@ -100,7 +100,7 @@ module HammerCLIForeman
100
100
  associated_resource :media
101
101
  desc _("Associate a medium")
102
102
 
103
- success_message _("The medium has been associated")
103
+ success_message _("The medium has been associated.")
104
104
  failure_message _("Could not associate the medium")
105
105
  end
106
106
 
@@ -108,7 +108,7 @@ module HammerCLIForeman
108
108
  associated_resource :media
109
109
  desc _("Disassociate a medium")
110
110
 
111
- success_message _("The medium has been disassociated")
111
+ success_message _("The medium has been disassociated.")
112
112
  failure_message _("Could not disassociate the medium")
113
113
  end
114
114
  end
@@ -120,7 +120,7 @@ module HammerCLIForeman
120
120
  associated_resource :subnets
121
121
  desc _("Associate a subnet")
122
122
 
123
- success_message _("The subnet has been associated")
123
+ success_message _("The subnet has been associated.")
124
124
  failure_message _("Could not associate the subnet")
125
125
  end
126
126
 
@@ -128,7 +128,7 @@ module HammerCLIForeman
128
128
  associated_resource :subnets
129
129
  desc _("Disassociate a subnet")
130
130
 
131
- success_message _("The subnet has been disassociated")
131
+ success_message _("The subnet has been disassociated.")
132
132
  failure_message _("Could not disassociate the subnet")
133
133
  end
134
134
  end
@@ -140,7 +140,7 @@ module HammerCLIForeman
140
140
  associated_resource :compute_resources
141
141
  desc _("Associate a compute resource")
142
142
 
143
- success_message _("The compute resource has been associated")
143
+ success_message _("The compute resource has been associated.")
144
144
  failure_message _("Could not associate the compute resource")
145
145
  end
146
146
 
@@ -148,7 +148,7 @@ module HammerCLIForeman
148
148
  associated_resource :compute_resources
149
149
  desc _("Disassociate a compute resource")
150
150
 
151
- success_message _("The compute resource has been disassociated")
151
+ success_message _("The compute resource has been disassociated.")
152
152
  failure_message _("Could not disassociate the compute resource")
153
153
  end
154
154
  end
@@ -160,7 +160,7 @@ module HammerCLIForeman
160
160
  associated_resource :smart_proxies
161
161
  desc _("Associate a smart proxy")
162
162
 
163
- success_message _("The smart proxy has been associated")
163
+ success_message _("The smart proxy has been associated.")
164
164
  failure_message _("Could not associate the smart proxy")
165
165
 
166
166
  def associated_resource_name
@@ -172,7 +172,7 @@ module HammerCLIForeman
172
172
  associated_resource :smart_proxies
173
173
  desc _("Disassociate a smart proxy")
174
174
 
175
- success_message _("The smart proxy has been disassociated")
175
+ success_message _("The smart proxy has been disassociated.")
176
176
  failure_message _("Could not disassociate the smart proxy")
177
177
 
178
178
  def associated_resource_name
@@ -188,7 +188,7 @@ module HammerCLIForeman
188
188
  associated_resource :users
189
189
  desc _("Associate an user")
190
190
 
191
- success_message _("The user has been associated")
191
+ success_message _("The user has been associated.")
192
192
  failure_message _("Could not associate the user")
193
193
  end
194
194
 
@@ -196,7 +196,7 @@ module HammerCLIForeman
196
196
  associated_resource :users
197
197
  desc _("Disassociate an user")
198
198
 
199
- success_message _("The user has been disassociated")
199
+ success_message _("The user has been disassociated.")
200
200
  failure_message _("Could not disassociate the user")
201
201
  end
202
202
  end
@@ -210,7 +210,7 @@ module HammerCLIForeman
210
210
 
211
211
  command_name 'add-user-group'
212
212
 
213
- success_message _("The user group has been associated")
213
+ success_message _("The user group has been associated.")
214
214
  failure_message _("Could not associate the user group")
215
215
  end
216
216
 
@@ -220,7 +220,7 @@ module HammerCLIForeman
220
220
 
221
221
  command_name 'remove-user-group'
222
222
 
223
- success_message _("The user group has been disassociated")
223
+ success_message _("The user group has been disassociated.")
224
224
  failure_message _("Could not disassociate the user group")
225
225
  end
226
226
  end
@@ -232,7 +232,7 @@ module HammerCLIForeman
232
232
  associated_resource :config_templates
233
233
  desc _("Associate a configuration template")
234
234
 
235
- success_message _("The configuration template has been associated")
235
+ success_message _("The configuration template has been associated.")
236
236
  failure_message _("Could not associate the configuration template")
237
237
  end
238
238
 
@@ -240,7 +240,7 @@ module HammerCLIForeman
240
240
  associated_resource :config_templates
241
241
  desc _("Disassociate a configuration template")
242
242
 
243
- success_message _("The configuration template has been disassociated")
243
+ success_message _("The configuration template has been disassociated.")
244
244
  failure_message _("Could not disassociate the configuration template")
245
245
  end
246
246
  end
@@ -252,7 +252,7 @@ module HammerCLIForeman
252
252
  associated_resource :organizations
253
253
  desc _("Associate an organization")
254
254
 
255
- success_message _("The organization has been associated")
255
+ success_message _("The organization has been associated.")
256
256
  failure_message _("Could not associate the organization")
257
257
  end
258
258
 
@@ -260,7 +260,7 @@ module HammerCLIForeman
260
260
  associated_resource :organizations
261
261
  desc _("Disassociate an organization")
262
262
 
263
- success_message _("The organization has been disassociated")
263
+ success_message _("The organization has been disassociated.")
264
264
  failure_message _("Could not disassociate the organization")
265
265
  end
266
266
  end
@@ -272,7 +272,7 @@ module HammerCLIForeman
272
272
  associated_resource :operatingsystems
273
273
  desc _("Associate an operating system")
274
274
 
275
- success_message _("Operating system has been associated")
275
+ success_message _("Operating system has been associated.")
276
276
  failure_message _("Could not associate the operating system")
277
277
  end
278
278
 
@@ -281,7 +281,7 @@ module HammerCLIForeman
281
281
  associated_resource :operatingsystems
282
282
  desc _("Disassociate an operating system")
283
283
 
284
- success_message _("Operating system has been disassociated")
284
+ success_message _("Operating system has been disassociated.")
285
285
  failure_message _("Could not disassociate the operating system")
286
286
  end
287
287
  end
@@ -293,7 +293,7 @@ module HammerCLIForeman
293
293
  associated_resource :architectures
294
294
  desc _("Associate an architecture")
295
295
 
296
- success_message _("Architecture has been associated")
296
+ success_message _("Architecture has been associated.")
297
297
  failure_message _("Could not associate the architecture")
298
298
  end
299
299
 
@@ -302,7 +302,7 @@ module HammerCLIForeman
302
302
  associated_resource :architectures
303
303
  desc _("Disassociate an architecture")
304
304
 
305
- success_message _("Architecture has been disassociated")
305
+ success_message _("Architecture has been disassociated.")
306
306
  failure_message _("Could not disassociate the architecture")
307
307
  end
308
308
  end
@@ -314,7 +314,7 @@ module HammerCLIForeman
314
314
  associated_resource :ptables
315
315
  desc _("Associate a partition table")
316
316
 
317
- success_message _("Partition table has been associated")
317
+ success_message _("Partition table has been associated.")
318
318
  failure_message _("Could not associate the partition table")
319
319
  end
320
320
 
@@ -323,7 +323,7 @@ module HammerCLIForeman
323
323
  associated_resource :ptables
324
324
  desc _("Disassociate a partition table")
325
325
 
326
- success_message _("Partition table has been disassociated")
326
+ success_message _("Partition table has been disassociated.")
327
327
  failure_message _("Could not disassociate the partition table")
328
328
  end
329
329
  end
@@ -335,7 +335,7 @@ module HammerCLIForeman
335
335
  associated_resource :roles
336
336
  desc _("Assign a user role")
337
337
 
338
- success_message _("User role has been assigned")
338
+ success_message _("User role has been assigned.")
339
339
  failure_message _("Could not assign the user role")
340
340
  end
341
341
 
@@ -344,7 +344,7 @@ module HammerCLIForeman
344
344
  associated_resource :roles
345
345
  desc _("Remove a user role")
346
346
 
347
- success_message _("User role has been removed")
347
+ success_message _("User role has been removed.")
348
348
  failure_message _("Could not remove the user role")
349
349
  end
350
350
  end
@@ -356,7 +356,7 @@ module HammerCLIForeman
356
356
  associated_resource :locations
357
357
  desc _("Associate a location")
358
358
 
359
- success_message _("The location has been associated")
359
+ success_message _("The location has been associated.")
360
360
  failure_message _("Could not associate the location")
361
361
  end
362
362
 
@@ -364,7 +364,7 @@ module HammerCLIForeman
364
364
  associated_resource :locations
365
365
  desc _("Disassociate a location")
366
366
 
367
- success_message _("The location has been disassociated")
367
+ success_message _("The location has been disassociated.")
368
368
  failure_message _("Could not disassociate the location")
369
369
  end
370
370
  end