dtk-client 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/Gemfile +1 -3
  4. data/README.md +2 -121
  5. data/Rakefile +44 -0
  6. data/bin/dtk +10 -88
  7. data/dtk-client.gemspec +21 -44
  8. data/examples/simple/dtk.module.yaml +32 -0
  9. data/{lib/git-logs/git.log → examples/simple/test/README.md} +0 -0
  10. data/examples/spark/dtk.module.yaml +120 -0
  11. data/examples/with_repo_content/deploy/puppet/manifests/hostname.pp +54 -0
  12. data/examples/with_repo_content/dtk.module.yaml +49 -0
  13. data/examples/with_repo_content/test/README.txt +0 -0
  14. data/features/dtk.feature +8 -0
  15. data/features/step_definitions/dtk_steps.rb +6 -0
  16. data/features/support/env.rb +15 -0
  17. data/lib/cli/command/mixin.rb +101 -0
  18. data/lib/cli/command/module/clone.rb +42 -0
  19. data/lib/cli/command/module/install.rb +52 -0
  20. data/lib/cli/command/module/list.rb +31 -0
  21. data/lib/cli/command/module/list_assemblies.rb +39 -0
  22. data/lib/cli/command/module/push.rb +34 -0
  23. data/lib/cli/command/module/uninstall.rb +46 -0
  24. data/lib/cli/command/module.rb +33 -0
  25. data/lib/cli/command/options.rb +33 -0
  26. data/lib/cli/command/service/cancel_task.rb +33 -0
  27. data/lib/cli/command/service/converge.rb +37 -0
  28. data/lib/{parser/adapters/thor/common_option_defs.rb → cli/command/service/create_workspace.rb} +13 -17
  29. data/lib/cli/command/service/destroy.rb +47 -0
  30. data/lib/cli/command/service/edit.rb +47 -0
  31. data/lib/cli/command/service/exec.rb +42 -0
  32. data/lib/cli/command/service/exec_sync.rb +53 -0
  33. data/lib/cli/command/service/list.rb +30 -0
  34. data/lib/cli/command/service/list_actions.rb +39 -0
  35. data/lib/cli/command/service/list_attributes.rb +44 -0
  36. data/lib/cli/command/service/list_component_links.rb +33 -0
  37. data/lib/cli/command/service/list_components.rb +39 -0
  38. data/lib/cli/command/service/list_dependent_modules.rb +33 -0
  39. data/lib/cli/command/service/list_nodes.rb +33 -0
  40. data/lib/cli/command/service/list_violations.rb +33 -0
  41. data/lib/cli/command/service/pull.rb +32 -0
  42. data/lib/cli/command/service/push.rb +37 -0
  43. data/lib/{shell/parse_monkey_patch.rb → cli/command/service/set_default_target.rb} +9 -17
  44. data/lib/cli/command/service/set_required_attributes.rb +32 -0
  45. data/lib/cli/command/service/ssh.rb +42 -0
  46. data/lib/cli/command/service/stage.rb +55 -0
  47. data/lib/cli/command/service/start.rb +33 -0
  48. data/lib/{shell/context_aux.rb → cli/command/service/stop.rb} +10 -23
  49. data/lib/cli/command/service/task_status.rb +39 -0
  50. data/lib/cli/command/service.rb +55 -0
  51. data/lib/{commands.rb → cli/command/subcommand.rb} +22 -25
  52. data/lib/{bundler_monkey_patch.rb → cli/command/token/arg.rb} +6 -6
  53. data/lib/cli/command/token/class_mixin.rb +96 -0
  54. data/lib/cli/command/token/flag.rb +42 -0
  55. data/lib/{execute/command/rest_call.rb → cli/command/token/mixin.rb} +23 -14
  56. data/lib/cli/command/token/switch.rb +35 -0
  57. data/lib/cli/command/token.rb +76 -0
  58. data/lib/cli/command.rb +46 -0
  59. data/lib/cli/context/attributes.rb +50 -0
  60. data/lib/cli/context/type/module.rb +34 -0
  61. data/lib/{commands/thor/state_change.rb → cli/context/type/service.rb} +11 -5
  62. data/lib/cli/context/type/top.rb +32 -0
  63. data/lib/cli/context/type.rb +42 -0
  64. data/lib/cli/context.rb +174 -0
  65. data/lib/cli/directory_parser/file_system.rb +105 -0
  66. data/lib/{execute/command.rb → cli/directory_parser.rb} +14 -17
  67. data/lib/{execute.rb → cli/file_obj.rb} +13 -9
  68. data/lib/cli/processor/plugin/gli.rb +70 -0
  69. data/lib/cli/processor.rb +60 -0
  70. data/lib/cli/runner/dtkn_access.rb +75 -0
  71. data/lib/cli/runner.rb +58 -0
  72. data/lib/cli/version.rb +8 -0
  73. data/lib/{config → client/config}/cacert.pem +0 -0
  74. data/lib/client/config/default.conf +20 -0
  75. data/lib/client/config.rb +106 -0
  76. data/lib/client/configurator.rb +182 -0
  77. data/lib/client/conn.rb +197 -0
  78. data/lib/client/content_generator.rb +127 -0
  79. data/lib/client/error/subclasses.rb +105 -0
  80. data/lib/client/error.rb +98 -0
  81. data/lib/client/git_repo/adapter/git_gem/error_handler.rb +70 -0
  82. data/lib/client/git_repo/adapter/git_gem.rb +179 -0
  83. data/lib/client/git_repo.rb +122 -0
  84. data/lib/client/logger.rb +136 -0
  85. data/lib/client/operation/account.rb +66 -0
  86. data/lib/client/operation/client_module_dir/git_repo.rb +286 -0
  87. data/lib/client/operation/client_module_dir.rb +138 -0
  88. data/lib/client/operation/module/clone_module.rb +52 -0
  89. data/lib/client/operation/module/install/common_module.rb +58 -0
  90. data/lib/client/operation/module/install/external_module.rb +122 -0
  91. data/lib/client/operation/module/install.rb +91 -0
  92. data/lib/client/operation/module/install_from_catalog.rb +76 -0
  93. data/lib/client/operation/module/list.rb +34 -0
  94. data/lib/client/operation/module/list_assemblies.rb +35 -0
  95. data/lib/client/operation/module/push.rb +62 -0
  96. data/lib/client/operation/module/uninstall.rb +44 -0
  97. data/lib/client/operation/module.rb +58 -0
  98. data/lib/{commands/common/thor/reparse.rb → client/operation/module_service_common.rb} +27 -16
  99. data/lib/client/operation/service/cancel_task.rb +29 -0
  100. data/lib/client/operation/service/commit_and_push.rb +128 -0
  101. data/lib/client/operation/service/converge.rb +50 -0
  102. data/lib/{util/common_util.rb → client/operation/service/create_workspace.rb} +13 -13
  103. data/lib/client/operation/service/destroy.rb +42 -0
  104. data/lib/client/operation/service/edit.rb +54 -0
  105. data/lib/client/operation/service/exec.rb +73 -0
  106. data/lib/client/operation/service/list.rb +32 -0
  107. data/lib/client/operation/service/list_actions.rb +34 -0
  108. data/lib/{commands/thor/dependency.rb → client/operation/service/list_attributes.rb} +16 -12
  109. data/lib/client/operation/service/list_component_links.rb +29 -0
  110. data/lib/{commands/common/thor/pull_clone_changes.rb → client/operation/service/list_components.rb} +13 -7
  111. data/lib/client/operation/service/list_dependent_modules.rb +29 -0
  112. data/lib/client/operation/service/list_nodes.rb +29 -0
  113. data/lib/{commands/thor/project.rb → client/operation/service/list_violations.rb} +8 -13
  114. data/lib/client/operation/service/pull.rb +37 -0
  115. data/lib/client/operation/service/set_default_target.rb +31 -0
  116. data/lib/client/operation/service/set_required_attributes.rb +41 -0
  117. data/lib/client/operation/service/ssh.rb +118 -0
  118. data/lib/client/operation/service/stage.rb +54 -0
  119. data/lib/client/operation/service/start.rb +29 -0
  120. data/lib/client/operation/service/stop.rb +30 -0
  121. data/lib/{task_status → client/operation/service/task_status}/refresh_mode.rb +15 -25
  122. data/lib/{task_status → client/operation/service/task_status}/snapshot_mode.rb +4 -5
  123. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/format.rb +1 -1
  124. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/action.rb +1 -1
  125. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/components.rb +1 -1
  126. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result/node_level.rb +1 -1
  127. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/result.rb +4 -4
  128. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/action.rb +1 -1
  129. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/components.rb +1 -1
  130. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps/node_level.rb +1 -1
  131. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task/steps.rb +4 -4
  132. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/hierarchical_task.rb +3 -3
  133. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/no_results.rb +1 -1
  134. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/render.rb +1 -1
  135. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/stage/render.rb +1 -1
  136. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/stage.rb +3 -3
  137. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_end.rb +1 -1
  138. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element/task_start.rb +1 -1
  139. data/lib/{task_status → client/operation/service/task_status}/stream_mode/element.rb +13 -13
  140. data/lib/{task_status → client/operation/service/task_status}/stream_mode.rb +5 -9
  141. data/lib/client/operation/service/task_status.rb +77 -0
  142. data/lib/client/operation/service.rb +54 -0
  143. data/lib/client/operation.rb +67 -0
  144. data/lib/client/operation_args.rb +40 -0
  145. data/lib/{execute/execute_context/result_store.rb → client/render/view/simple.rb} +15 -14
  146. data/lib/client/render/view/table/processor.rb +248 -0
  147. data/lib/client/render/view/table.rb +75 -0
  148. data/lib/client/render.rb +113 -0
  149. data/lib/client/response/error_handler.rb +97 -0
  150. data/lib/client/response/render_helper.rb +78 -0
  151. data/lib/client/response/subclasses.rb +62 -0
  152. data/lib/client/response.rb +83 -0
  153. data/lib/client/session.rb +62 -0
  154. data/lib/client/util/auxiliary.rb +34 -0
  155. data/lib/client/util/console.rb +81 -0
  156. data/lib/client/util/disk_cacher.rb +66 -0
  157. data/lib/client/util/dtk_path.rb +28 -0
  158. data/lib/{search_hash.rb → client/util/hash_with_optional_keys.rb} +29 -21
  159. data/lib/client/util/interactive_wizard.rb +84 -0
  160. data/lib/client/util/module_ref.rb +92 -0
  161. data/lib/client/util/os_util/print.rb +121 -0
  162. data/lib/client/util/os_util.rb +122 -0
  163. data/lib/{commands/thor/utils.rb → client/util/post_body.rb} +1 -1
  164. data/lib/{execute/error_usage.rb → client/util/query_string_hash.rb} +2 -2
  165. data/lib/client/util/remote_dependency.rb +67 -0
  166. data/lib/client/util/ssh_util.rb +89 -0
  167. data/lib/client/util/validation.rb +28 -0
  168. data/lib/client/util.rb +18 -0
  169. data/lib/{util/permission_util.rb → dtk_cli.rb} +10 -9
  170. data/lib/dtk_client.rb +18 -14
  171. data/test/default_test.rb +14 -0
  172. data/test/test_helper.rb +9 -0
  173. metadata +196 -307
  174. data/Gemfile_dev +0 -13
  175. data/bin/dtk-execute +0 -32
  176. data/bin/dtk-shell +0 -31
  177. data/lib/auxiliary.rb +0 -61
  178. data/lib/client.rb +0 -58
  179. data/lib/command_helper.rb +0 -33
  180. data/lib/command_helpers/git_repo/merge.rb +0 -153
  181. data/lib/command_helpers/git_repo.rb +0 -589
  182. data/lib/command_helpers/jenkins_client/config_xml.rb +0 -288
  183. data/lib/command_helpers/jenkins_client.rb +0 -106
  184. data/lib/command_helpers/service_importer.rb +0 -251
  185. data/lib/command_helpers/service_link.rb +0 -33
  186. data/lib/command_helpers/test_module_creator.rb +0 -69
  187. data/lib/command_helpers/test_module_templates/dtk.model.yaml.eruby +0 -10
  188. data/lib/command_helpers/test_module_templates/spec_helper.rb.eruby +0 -10
  189. data/lib/command_helpers/test_module_templates/temp_component_spec.rb.eruby +0 -5
  190. data/lib/commands/common/thor/access_control.rb +0 -133
  191. data/lib/commands/common/thor/action_result_handler.rb +0 -74
  192. data/lib/commands/common/thor/assembly_template.rb +0 -92
  193. data/lib/commands/common/thor/assembly_workspace.rb +0 -1638
  194. data/lib/commands/common/thor/base_command_helper.rb +0 -59
  195. data/lib/commands/common/thor/clone.rb +0 -82
  196. data/lib/commands/common/thor/common.rb +0 -88
  197. data/lib/commands/common/thor/common_base.rb +0 -49
  198. data/lib/commands/common/thor/create_target.rb +0 -70
  199. data/lib/commands/common/thor/edit.rb +0 -255
  200. data/lib/commands/common/thor/inventory_parser.rb +0 -98
  201. data/lib/commands/common/thor/list_diffs.rb +0 -128
  202. data/lib/commands/common/thor/module/import.rb +0 -215
  203. data/lib/commands/common/thor/module.rb +0 -1011
  204. data/lib/commands/common/thor/node.rb +0 -53
  205. data/lib/commands/common/thor/poller.rb +0 -65
  206. data/lib/commands/common/thor/pull_from_remote.rb +0 -152
  207. data/lib/commands/common/thor/puppet_forge.rb +0 -72
  208. data/lib/commands/common/thor/purge_clone.rb +0 -101
  209. data/lib/commands/common/thor/push_clone_changes.rb +0 -162
  210. data/lib/commands/common/thor/push_to_remote.rb +0 -94
  211. data/lib/commands/common/thor/remotes.rb +0 -71
  212. data/lib/commands/common/thor/set_required_attributes.rb +0 -46
  213. data/lib/commands/thor/account.rb +0 -239
  214. data/lib/commands/thor/assembly.rb +0 -361
  215. data/lib/commands/thor/attribute.rb +0 -79
  216. data/lib/commands/thor/component.rb +0 -70
  217. data/lib/commands/thor/component_module.rb +0 -501
  218. data/lib/commands/thor/component_template.rb +0 -174
  219. data/lib/commands/thor/developer.rb +0 -144
  220. data/lib/commands/thor/dtk.rb +0 -152
  221. data/lib/commands/thor/library.rb +0 -125
  222. data/lib/commands/thor/node.rb +0 -504
  223. data/lib/commands/thor/node_group.rb +0 -203
  224. data/lib/commands/thor/node_template.rb +0 -94
  225. data/lib/commands/thor/provider.rb +0 -233
  226. data/lib/commands/thor/remotes.rb +0 -49
  227. data/lib/commands/thor/service.rb +0 -932
  228. data/lib/commands/thor/service_module.rb +0 -900
  229. data/lib/commands/thor/target.rb +0 -250
  230. data/lib/commands/thor/task.rb +0 -116
  231. data/lib/commands/thor/test_module.rb +0 -310
  232. data/lib/commands/thor/workspace.rb +0 -698
  233. data/lib/config/client.conf.header +0 -20
  234. data/lib/config/configuration.rb +0 -99
  235. data/lib/config/default.conf +0 -16
  236. data/lib/config/disk_cacher.rb +0 -80
  237. data/lib/configurator.rb +0 -176
  238. data/lib/context_router.rb +0 -44
  239. data/lib/core.rb +0 -489
  240. data/lib/domain/git_adapter.rb +0 -412
  241. data/lib/domain/git_error_handler.rb +0 -64
  242. data/lib/domain/response/error_handler.rb +0 -86
  243. data/lib/domain/response.rb +0 -285
  244. data/lib/dtk-client/version.rb +0 -20
  245. data/lib/dtk_constants.rb +0 -40
  246. data/lib/dtk_error.rb +0 -114
  247. data/lib/dtk_logger.rb +0 -113
  248. data/lib/error.rb +0 -85
  249. data/lib/execute/cli_pure/cli_rerouter.rb +0 -102
  250. data/lib/execute/command/api_call/map.rb +0 -60
  251. data/lib/execute/command/api_call/service.rb +0 -91
  252. data/lib/execute/command/api_call/translation_term.rb +0 -119
  253. data/lib/execute/command/api_call.rb +0 -60
  254. data/lib/execute/command_processor/rest_call.rb +0 -59
  255. data/lib/execute/command_processor.rb +0 -30
  256. data/lib/execute/execute_context.rb +0 -86
  257. data/lib/execute/script/add_tenant.rb +0 -121
  258. data/lib/execute/script.rb +0 -64
  259. data/lib/parser/adapters/option_parser.rb +0 -70
  260. data/lib/parser/adapters/thor.rb +0 -555
  261. data/lib/require_first.rb +0 -104
  262. data/lib/shell/context.rb +0 -1064
  263. data/lib/shell/domain/active_context.rb +0 -186
  264. data/lib/shell/domain/context_entity.rb +0 -89
  265. data/lib/shell/domain/context_params.rb +0 -223
  266. data/lib/shell/domain/override_tasks.rb +0 -88
  267. data/lib/shell/domain/shadow_entity.rb +0 -76
  268. data/lib/shell/header_shell.rb +0 -44
  269. data/lib/shell/help_monkey_patch.rb +0 -283
  270. data/lib/shell/interactive_wizard.rb +0 -256
  271. data/lib/shell/message_queue.rb +0 -63
  272. data/lib/shell/status_monitor.rb +0 -124
  273. data/lib/shell.rb +0 -261
  274. data/lib/task_status.rb +0 -83
  275. data/lib/util/console.rb +0 -235
  276. data/lib/util/dtk_puppet.rb +0 -65
  277. data/lib/util/module_util.rb +0 -66
  278. data/lib/util/os_util.rb +0 -385
  279. data/lib/util/remote_dependency_util.rb +0 -84
  280. data/lib/util/ssh_util.rb +0 -94
  281. data/lib/view_processor/augmented_simple_list.rb +0 -44
  282. data/lib/view_processor/hash_pretty_print.rb +0 -123
  283. data/lib/view_processor/simple_list.rb +0 -156
  284. data/lib/view_processor/table_print.rb +0 -309
  285. data/lib/view_processor.rb +0 -129
  286. data/puppet/manifests/init.pp +0 -72
  287. data/puppet/manifests/params.pp +0 -16
  288. data/puppet/r8meta.puppet.yml +0 -35
  289. data/puppet/templates/bash_profile.erb +0 -2
  290. data/puppet/templates/client.conf.erb +0 -1
  291. data/puppet/templates/dtkclient.erb +0 -2
  292. data/spec/component_module_spec.rb +0 -34
  293. data/spec/dependency_spec.rb +0 -6
  294. data/spec/dtk_shell_spec.rb +0 -13
  295. data/spec/dtk_spec.rb +0 -33
  296. data/spec/lib/spec_helper.rb +0 -10
  297. data/spec/lib/spec_thor.rb +0 -108
  298. data/spec/node_template_spec.rb +0 -24
  299. data/spec/project_spec.rb +0 -6
  300. data/spec/repo_spec.rb +0 -7
  301. data/spec/response_spec.rb +0 -52
  302. data/spec/service_module_spec.rb +0 -38
  303. data/spec/service_spec.rb +0 -50
  304. data/spec/state_change_spec.rb +0 -7
  305. data/spec/table_print_spec.rb +0 -48
  306. data/spec/target_spec.rb +0 -57
  307. data/spec/task_spec.rb +0 -28
  308. data/views/assembly/augmented_simple_list.rb +0 -12
  309. data/views/assembly_template/augmented_simple_list.rb +0 -12
  310. data/views/list_task/augmented_simple_list.rb +0 -12
@@ -1,288 +0,0 @@
1
- #
2
- # Copyright (C) 2010-2016 dtk contributors
3
- #
4
- # This file is part of the dtk project.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
- #TODO: should haev separet file sfor each template
19
- require 'erubis'
20
- class DTK::Client::JenkinsClient
21
- module ConfigXML
22
- #TODO: this is not working now
23
- def self.generate_service_module_project(repo_url,module_id,branch)
24
- #TODO: not using branch argument
25
- #TODO: did not put in module_id yet
26
- template_bindings = {
27
- :repo_url => repo_url
28
- }
29
- ConfigXMLTemplateServiceModule.result(template_bindings)
30
- end
31
- def self.generate_assembly_project(assembly_id)
32
- #TODO: not using branch argument
33
- #TODO: did not put in module_id yet
34
- template_bindings = {
35
- :assembly_id => assembly_id
36
- }
37
- ConfigXMLTemplateAssembly.result(template_bindings)
38
- end
39
-
40
- ConfigXMLTemplateServiceModule = Erubis::Eruby.new <<eos
41
- <?xml version='1.0' encoding='UTF-8'?>
42
- <project>
43
- <actions/>
44
- <description></description>
45
- <keepDependencies>false</keepDependencies>
46
- <properties>
47
- <com.gmail.ikeike443.PlayAutoTestJobProperty/>
48
- </properties>
49
- <scm class="hudson.plugins.git.GitSCM">
50
- <configVersion>2</configVersion>
51
- <userRemoteConfigs>
52
- <hudson.plugins.git.UserRemoteConfig>
53
- <name></name>
54
- <refspec></refspec>
55
- <url><%= repo_url %></url>
56
- </hudson.plugins.git.UserRemoteConfig>
57
- </userRemoteConfigs>
58
- <branches>
59
- <hudson.plugins.git.BranchSpec>
60
- <name>**</name>
61
- </hudson.plugins.git.BranchSpec>
62
- </branches>
63
- <disableSubmodules>false</disableSubmodules>
64
- <recursiveSubmodules>false</recursiveSubmodules>
65
- <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
66
- <authorOrCommitter>false</authorOrCommitter>
67
- <clean>false</clean>
68
- <wipeOutWorkspace>false</wipeOutWorkspace>
69
- <pruneBranches>false</pruneBranches>
70
- <remotePoll>false</remotePoll>
71
- <ignoreNotifyCommit>false</ignoreNotifyCommit>
72
- <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
73
- <gitTool>Default</gitTool>
74
- <submoduleCfg class="list"/>
75
- <relativeTargetDir></relativeTargetDir>
76
- <reference></reference>
77
- <excludedRegions></excludedRegions>
78
- <excludedUsers></excludedUsers>
79
- <gitConfigName></gitConfigName>
80
- <gitConfigEmail></gitConfigEmail>
81
- <skipTag>false</skipTag>
82
- <includedRegions></includedRegions>
83
- <scmName></scmName>
84
- </scm>
85
- <canRoam>true</canRoam>
86
- <disabled>false</disabled>
87
- <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
88
- <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
89
- <triggers class="vector"/>
90
- <concurrentBuild>false</concurrentBuild>
91
- <builders>
92
- <hudson.tasks.Shell>
93
- <command>ruby /var/lib/jenkins/r8_e2e.rb</command>
94
- </hudson.tasks.Shell>
95
- </builders>
96
- <publishers>
97
- <hudson.plugins.emailext.ExtendedEmailPublisher>
98
- <recipientList>$DEFAULT_RECIPIENTS</recipientList>
99
- <configuredTriggers>
100
- <hudson.plugins.emailext.plugins.trigger.FailureTrigger>
101
- <email>
102
- <recipientList></recipientList>
103
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
104
- <body>$PROJECT_DEFAULT_CONTENT</body>
105
- <sendToDevelopers>true</sendToDevelopers>
106
- <sendToRequester>false</sendToRequester>
107
- <includeCulprits>false</includeCulprits>
108
- <sendToRecipientList>true</sendToRecipientList>
109
- </email>
110
- </hudson.plugins.emailext.plugins.trigger.FailureTrigger>
111
- <hudson.plugins.emailext.plugins.trigger.StillFailingTrigger>
112
- <email>
113
- <recipientList></recipientList>
114
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
115
- <body>$PROJECT_DEFAULT_CONTENT</body>
116
- <sendToDevelopers>true</sendToDevelopers>
117
- <sendToRequester>false</sendToRequester>
118
- <includeCulprits>false</includeCulprits>
119
- <sendToRecipientList>false</sendToRecipientList>
120
- </email>
121
- </hudson.plugins.emailext.plugins.trigger.StillFailingTrigger>
122
- <hudson.plugins.emailext.plugins.trigger.FixedTrigger>
123
- <email>
124
- <recipientList></recipientList>
125
- <subject>$PROJECT_DEFAULT_SUBJECT</subject>
126
- <body>$PROJECT_DEFAULT_CONTENT</body>
127
- <sendToDevelopers>true</sendToDevelopers>
128
- <sendToRequester>false</sendToRequester>
129
- <includeCulprits>false</includeCulprits>
130
- <sendToRecipientList>true</sendToRecipientList>
131
- </email>
132
- </hudson.plugins.emailext.plugins.trigger.FixedTrigger>
133
- </configuredTriggers>
134
- <contentType>default</contentType>
135
- <defaultSubject>$DEFAULT_SUBJECT</defaultSubject>
136
- <defaultContent>${JELLY_SCRIPT,template=&quot;html&quot;}</defaultContent>
137
- <attachmentsPattern></attachmentsPattern>
138
- </hudson.plugins.emailext.ExtendedEmailPublisher>
139
- </publishers>
140
- <buildWrappers/>
141
- </project>
142
- eos
143
-
144
-
145
- ConfigXMLTemplateAssembly = Erubis::Eruby.new <<eos
146
- <?xml version='1.0' encoding='UTF-8'?>
147
- <project>
148
- <actions/>
149
- <description></description>
150
- <keepDependencies>false</keepDependencies>
151
- <properties>
152
- <com.gmail.ikeike443.PlayAutoTestJobProperty/>
153
- </properties>
154
- <scm class="hudson.scm.NullSCM"/>
155
- <canRoam>true</canRoam>
156
- <disabled>false</disabled>
157
- <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
158
- <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
159
- <triggers class="vector"/>
160
- <concurrentBuild>false</concurrentBuild>
161
- <builders>
162
- <hudson.tasks.Shell>
163
- <command>#!/usr/bin/env ruby
164
-
165
- require &apos;rubygems&apos;
166
- require &apos;rest_client&apos;
167
- require &apos;pp&apos;
168
- require &apos;json&apos;
169
-
170
- STDOUT.sync = true
171
-
172
- ENDPOINT = &apos;http://ec2-54-247-191-95.eu-west-1.compute.amazonaws.com:7000&apos;
173
- ASSEMBLY_ID = &apos;<%= assembly_id %>&apos;
174
-
175
- # controling &apos;pretty-print&apos; in log file
176
- JSON_OUTPUT_ENABLED = false
177
-
178
- # Method for deleting assembly instances
179
- def deleteAssembly(assemblyId)
180
- responseAssemblyDelete = RestClient.post(ENDPOINT + &apos;/rest/assembly/delete&apos;, &apos;assembly_id&apos; =&gt; assemblyId)
181
- puts &quot;Assembly has been deleted! Response: #{responseAssemblyDelete}&quot;
182
- end
183
-
184
- #
185
- # Method for pretty print of json responses
186
- def json_print(json)
187
- pp json if JSON_OUTPUT_ENABLED
188
- end
189
-
190
- pp &quot;Script has been started!&quot;
191
-
192
- puts &quot;Using template ID: #{ASSEMBLY_ID}&quot;
193
-
194
- # Stage the assembly
195
- stageAssembly = RestClient.post(ENDPOINT + &apos;/rest/assembly/stage&apos;, &apos;assembly_id&apos; =&gt; ASSEMBLY_ID)
196
- assemblyId = JSON.parse(stageAssembly)[&quot;data&quot;][&quot;assembly_id&quot;]
197
-
198
- puts &quot;Using stage assembly ID: #{assemblyId}&quot;
199
-
200
- # Create a task for the cloned assembly instance
201
- responseTask = RestClient.post(ENDPOINT + &apos;/rest/assembly/create_task&apos;, &apos;assembly_id&apos; =&gt; assemblyId)
202
- # Extract task id
203
- taskId = JSON.parse(responseTask)[&quot;data&quot;][&quot;task_id&quot;]
204
- # Execute the task
205
- puts &quot;Starting task id: #{taskId}&quot;
206
- responseTaskExecute = RestClient.post(ENDPOINT + &apos;/rest/task/execute&apos;, &apos;task_id&apos; =&gt; taskId)
207
-
208
- taskStatus = &apos;executing&apos;
209
-
210
- while taskStatus.include? &apos;executing&apos;
211
- sleep 20
212
- responseTaskStatus = RestClient.post(ENDPOINT + &apos;/rest/task/status&apos;, &apos;task_id &apos;=&gt; taskId)
213
- taskFullResponse = JSON.parse(responseTaskStatus)
214
- taskStatus = taskFullResponse[&quot;data&quot;][&quot;status&quot;]
215
- puts &quot;Task status: #{taskStatus}&quot;
216
- json_print JSON.parse(responseTaskStatus)
217
- end
218
-
219
- if taskStatus.include? &apos;fail&apos;
220
- # Print error response from the service
221
- puts &quot;Smoke test failed, response: &quot;
222
- pp taskFullResponse
223
- # Delete the cloned assembly&apos;s instance
224
- deleteAssembly(assemblyId)
225
- abort(&quot;Task with ID #{taskId} failed!&quot;)
226
- else
227
- puts &quot;Task with ID #{taskId} success!&quot;
228
- end
229
-
230
-
231
- #Create a task for the smoke test
232
- responseSmokeTest = RestClient.post(ENDPOINT + &apos;/rest/assembly/create_smoketests_task&apos;, &apos;assembly_id&apos; =&gt; assemblyId)
233
- json_print responseSmokeTest
234
-
235
- #Extract task id
236
- smokeTestId = JSON.parse(responseSmokeTest)[&quot;data&quot;][&quot;task_id&quot;]
237
- puts &quot;Created smoke test task with ID: #{smokeTestId}&quot;
238
- #Execute the task
239
- responseSmokeExecute = RestClient.post(ENDPOINT + &apos;/rest/task/execute&apos;, &apos;task_id&apos; =&gt; smokeTestId)
240
-
241
- json_print JSON.parse(responseSmokeExecute)
242
-
243
- puts &quot;Starting smoke test task with ID: #{smokeTestId}&quot;
244
-
245
- smokeStatus = &apos;executing&apos;
246
-
247
- while smokeStatus.include? &apos;executing&apos;
248
- sleep 20
249
- responseSmokeStatus = RestClient.post(ENDPOINT + &apos;/rest/task/status&apos;, &apos;task_id &apos;=&gt; smokeTestId)
250
- fullResponse = JSON.parse(responseSmokeStatus)
251
- smokeStatus = fullResponse[&quot;data&quot;][&quot;status&quot;]
252
- puts &quot;Smoke test status: #{smokeStatus}&quot;
253
- end
254
-
255
- if smokeStatus.include? &apos;failed&apos;
256
- # Delete the cloned assembly&apos;s instance
257
- puts &quot;Smoke test failed, response: &quot;
258
- pp fullResponse
259
-
260
- # Getting log files for failed jobs
261
- task_log_response = RestClient.post(ENDPOINT + &apos;/rest/task/get_logs&apos;, &apos;task_id &apos;=&gt; smokeTestId)
262
- puts &quot;Logs response:&quot;
263
- pp JSON.parse(task_log_response)
264
-
265
- deleteAssembly(assemblyId)
266
- abort(&quot;Smoke test failed.&quot;)
267
- end
268
-
269
- # Delete the cloned assembly&apos;s instance, this is the must!
270
- #deleteAssembly(assemblyId)
271
-
272
- #abort(&quot;Testing failure mail report.&quot;)
273
- </command>
274
- </hudson.tasks.Shell>
275
- </builders>
276
- <publishers>
277
- <hudson.tasks.Mailer>
278
- <recipients>r8-jenkins@atlantbh.com</recipients>
279
- <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
280
- <sendToIndividuals>false</sendToIndividuals>
281
- </hudson.tasks.Mailer>
282
- </publishers>
283
- <buildWrappers/>
284
- </project>
285
- eos
286
-
287
- end
288
- end
@@ -1,106 +0,0 @@
1
- #
2
- # Copyright (C) 2010-2016 dtk contributors
3
- #
4
- # This file is part of the dtk project.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
- # TODO: Marked for removal [Haris] - Do we need this?
19
- require 'jenkins-client'
20
- module DTK; module Client
21
- class JenkinsClient
22
- require File.expand_path('jenkins_client/config_xml', File.dirname(__FILE__))
23
-
24
- def self.create_service_module_project(module_id,module_name,repo_url,branch)
25
- jenkins_project_name = module_name
26
- config_xml_contents = ConfigXML.generate_service_module_project(repo_url,module_id,branch)
27
- connection().create_job(jenkins_project_name,config_xml_contents)
28
- end
29
-
30
- def self.create_service_module_project?(module_id,module_name,repo_url,branch)
31
- jenkins_project_name = module_name
32
- jobs = get_jobs()||[]
33
- #no op if job exists already
34
- unless jobs.find{|j|j["name"] == jenkins_project_name}
35
- create_service_module_project(module_id,module_name,repo_url,branch)
36
- end
37
- end
38
-
39
- def self.create_assembly_project(assembly_name,assembly_id)
40
- jenkins_project_name = assembly_name.gsub(/::/,"-")
41
- config_xml_contents = ConfigXML.generate_assembly_project(assembly_id)
42
- connection().create_job(jenkins_project_name,config_xml_contents)
43
- end
44
-
45
- def self.create_assembly_project?(assembly_name,assembly_id)
46
- jenkins_project_name = assembly_name.gsub(/::/,"-")
47
- jobs = get_jobs()||[]
48
- #no op if job exists already
49
- unless jobs.find{|j|j["name"] == jenkins_project_name}
50
- create_assembly_project(assembly_name,assembly_id)
51
- end
52
- end
53
-
54
- def self.get_jobs()
55
- connection().get_jobs()
56
- end
57
-
58
- private
59
- def self.connection()
60
- return @connection if @connection
61
- #TODO: hardwired
62
- connection_hash = {
63
- :username => "rich",
64
- :password => "test",
65
- :url => "http://ec2-107-22-254-226.compute-1.amazonaws.com:8080"
66
- }
67
- @connection = Connection.new(connection_hash)
68
- end
69
-
70
- class Connection < Hash
71
- def initialize(connection_hash)
72
- super()
73
- merge!(connection_hash)
74
- set_connection()
75
- end
76
- def create_job(job_name,config_xml_contents)
77
- ::Jenkins::Client::Job.create(job_name, config_xml_contents)
78
- end
79
-
80
- def get_info()
81
- get('api/json')
82
- end
83
-
84
- def get_jobs()
85
- get_info()["jobs"]
86
- end
87
- private
88
- #TODO: one issue with the jenkins-client adapter is that it a singleton and thus only allows connection under one user to one jenkins server
89
- def set_connection()
90
- ::Jenkins::Client.configure do |c|
91
- c.username = self[:username]
92
- c.password = self[:password]
93
- c.url = self[:url]
94
- end
95
- end
96
-
97
- def get(path)
98
- faraday_response = ::Jenkins::Client.get(path)
99
- unless [200].include?(faraday_response.status)
100
- raise Error.new("Bad response from Jenkins (status = #{faraday_response.status.to_s})")
101
- end
102
- faraday_response.body
103
- end
104
- end
105
- end
106
- end; end
@@ -1,251 +0,0 @@
1
- #
2
- # Copyright (C) 2010-2016 dtk contributors
3
- #
4
- # This file is part of the dtk project.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
- dtk_require_from_base('configurator')
19
- module DTK::Client
20
- #
21
- # Main purpose of this module is to recognize which local modules are missing based on
22
- # name, namespace, version and for those missing component module module will call
23
- # module#clone and module#import_dtkn method to get missing component modules
24
- #
25
- module ServiceImporter
26
- def create_missing_clone_dirs()
27
- Configurator.create_missing_clone_dirs
28
- end
29
-
30
- def self.error_message(name, errors, opts = {})
31
- prefix = ''
32
- unless opts[:module_type] == :service_module
33
- prefix = "Module '#{name}' has errors:\n "
34
- end
35
- command = opts[:command] || 'edit'
36
- "#{prefix}#{errors.to_s}\nYou can fix errors by invoking the '#{command}' command.\n"
37
- end
38
-
39
- ##
40
- # Method will trigger pull from dtkn for each existing module
41
- #
42
- def trigger_module_auto_pull(required_modules, opts = {})
43
- return if required_modules.empty?
44
- hide_output = opts[:hide_output]
45
-
46
- # options[:force] means this command is triggered from trigger_module_auto_import method bellow
47
- unless opts[:force]
48
- update_none = RemoteDependencyUtil.check_for_frozen_modules(required_modules)
49
-
50
- if update_none
51
- print "All dependent modules are frozen and will not be updated!\n" unless hide_output
52
- print "Resuming pull ... " unless hide_output
53
- return Response::Ok.new()
54
- end
55
- end
56
-
57
- if opts[:force] || Console.confirmation_prompt("Do you want to update in addition to this module its dependent modules from the catalog?")
58
- required_modules.uniq.each do |r_module|
59
- module_name = full_module_name(r_module)
60
- module_type = r_module['type']
61
- version = r_module['version']
62
- full_name = (version && !version.eql?('master')) ? "#{module_name}(#{version})" : module_name
63
-
64
- # No op for frozen modules
65
- next if r_module['frozen']
66
-
67
- print "Pulling #{module_type.gsub('_',' ')} content for '#{full_name}' ... " unless hide_output
68
-
69
- new_context_params = DTK::Shell::ContextParams.new
70
- new_context_params.add_context_to_params(module_type, module_type)
71
- new_context_params.add_context_name_to_params(module_type, module_type, module_name)
72
-
73
- forwarded_opts = { :skip_recursive_pull => true, :ignore_dependency_merge_conflict => true }
74
- forwarded_opts.merge!(:do_not_raise => true) if opts[:do_not_raise]
75
- forwarded_opts.merge!(:version => version) if version && !version.eql?('master')
76
- new_context_params.forward_options(forwarded_opts)
77
-
78
- response = ContextRouter.routeTask(module_type, "pull_dtkn", new_context_params, @conn)
79
-
80
- unless response.ok?
81
- if opts[:do_not_raise]
82
- OsUtil.print("#{response.error_message}", :red)
83
- else
84
- raise DtkError, response.error_message
85
- end
86
- end
87
- end
88
-
89
- print "Resuming pull ... " unless opts[:force]
90
- end
91
- end
92
-
93
- ##
94
- # Method will trigger import for each missing module component
95
- #
96
- def trigger_module_auto_import(modules_to_import, required_modules, opts = {})
97
- hide_output = opts[:hide_output]
98
-
99
- puts 'Auto-installing missing module(s)' unless hide_output
100
- update_all = false
101
- update_none = RemoteDependencyUtil.check_for_frozen_modules(required_modules)
102
-
103
- # Print out or update installed modules from catalog
104
- required_modules.uniq.each do |r_module|
105
- module_name = full_module_name(r_module)
106
- module_type = r_module['type']
107
- version = r_module['version']
108
- full_name = (version && !version.eql?('master')) ? "#{module_name}(#{version})" : module_name
109
-
110
- unless hide_output
111
- print "Using #{module_type.gsub('_', ' ')} '#{full_name}'\n" unless update_all
112
- end
113
-
114
- next if update_none || opts[:update_none]
115
-
116
- pull_opts = {:force => true, :do_not_raise => true}
117
- pull_opts.merge!(:hide_output => hide_output) if hide_output
118
-
119
- if update_all
120
- trigger_module_auto_pull([r_module], pull_opts)
121
- else
122
- options = required_modules.size > 1 ? %w(all none) : []
123
- update = Console.confirmation_prompt_additional_options("Do you want to update dependent #{module_type.gsub('_', ' ')} '#{full_name}' from the catalog?", options) unless hide_output
124
- next unless update
125
-
126
- if update.to_s.eql?('all')
127
- update_all = true
128
- trigger_module_auto_pull([r_module], pull_opts)
129
- elsif update.to_s.eql?('none')
130
- update_none = true
131
- else
132
- trigger_module_auto_pull([r_module], pull_opts)
133
- end
134
- end
135
- end
136
-
137
- # Trigger import/install for missing modules
138
- modules_to_import.uniq.each do |m_module|
139
- module_name = full_module_name(m_module)
140
- module_type = m_module['type']
141
- version = m_module['version']
142
- full_name = (version && !version.eql?('master')) ? "#{module_name}(#{version})" : module_name
143
-
144
- # we check if there is module_url if so we install from git
145
- module_url = m_module['module_url']
146
-
147
- # descriptive message
148
- importing = module_url ? "Importing" : "Installing"
149
- import_msg = "#{importing} #{module_type.gsub('_', ' ')} '#{full_name}'"
150
- import_msg += " from git source #{module_url}" if module_url
151
- print "#{import_msg} ... " unless hide_output
152
-
153
- if module_url
154
- # import from Git source
155
- new_context_params = ::DTK::Shell::ContextParams.new([module_url, module_name])
156
- new_context_params.forward_options(:internal_trigger => true)
157
- response = ContextRouter.routeTask(module_type, 'import_git', new_context_params, @conn)
158
- else
159
- # import from Repo Manager
160
- new_context_params = ::DTK::Shell::ContextParams.new([module_name])
161
- new_context_params.override_method_argument!('option_2', version) if version && !version.eql?('master')
162
- new_context_params.forward_options(:skip_cloning => false, :skip_auto_install => true, :module_type => module_type, :ignore_component_error => true).merge!(opts)
163
- response = ContextRouter.routeTask(module_type, 'install', new_context_params, @conn)
164
- end
165
-
166
- ignore_component_error = (new_context_params.get_forwarded_options() || {})[:ignore_component_error] && module_type.eql?('component_module')
167
- puts(response.data(:does_not_exist) ? response.data(:does_not_exist) : 'Done.') unless hide_output
168
- raise DtkError, response.error_message if !response.ok? && !ignore_component_error
169
- end
170
-
171
- Response::Ok.new()
172
- end
173
-
174
- def resolve_missing_components(service_module_id, service_module_name, namespace_to_use, force_clone=false)
175
- # Get dependency component modules and cross reference them with local component modules
176
- module_component_list = post rest_url("service_module/list_component_modules"), { :service_module_id => service_module_id }
177
-
178
- local_modules, needed_modules = OsUtil.local_component_module_list(), Array.new
179
-
180
- if module_component_list
181
- module_component_list.data.each do |cmp_module|
182
- with_namespace = ModuleUtil.resolve_name(cmp_module["display_name"],cmp_module["namespace_name"])
183
- formated_name = add_version?(with_namespace, cmp_module['version'])
184
- unless local_modules.include?(formated_name)
185
- needed_modules << cmp_module.merge({'formated_name' => formated_name})
186
- end
187
- end
188
- end
189
-
190
- unless needed_modules.empty?
191
- # puts "Service '#{service_module_name}' does not have the following component modules dependencies on the client machine: \n\n"
192
- # needed_modules.each { |m| puts " - #{m['formated_name']}" }
193
- is_install_dependencies = true
194
- # is_install_dependencies = Console.confirmation_prompt("\nDo you want to clone these missing component modules to the client machine?") unless force_clone
195
-
196
- # we get list of modules available on server
197
-
198
- new_context_params = nil
199
-
200
- if is_install_dependencies
201
- needed_modules.each do |m|
202
- formated_name = m['formated_name']
203
- # print "Cloning component module '#{formated_name}' from server ... "
204
- thor_options = {}
205
- thor_options["version"] = m['version'] unless m['version'].eql?('base')
206
- thor_options["skip_edit"] = true
207
- thor_options["omit_output"] = true
208
- thor_options.merge!(:module_type => 'component-module')
209
- thor_options.merge!(:service_importer => true)
210
- new_context_params = ::DTK::Shell::ContextParams.new
211
- new_context_params.forward_options(thor_options)
212
- new_context_params.add_context_to_params(formated_name, :"component-module", m['id'])
213
-
214
- begin
215
- response = ContextRouter.routeTask("component_module", "clone", new_context_params, @conn)
216
- rescue DtkValidationError => e
217
- # ignoring this
218
- end
219
- # puts "Done."
220
- end
221
- end
222
- end
223
- end
224
-
225
- private
226
- #
227
- # As the result we can have multiple version so we need to resolve them
228
- #
229
- # Returns: Array<String>
230
- def resolve_module_names(e)
231
- versions = (e['version'] ? e['version'].split(',') : ['CURRENT'])
232
-
233
- versions.collect { |version| add_version?(e['display_name'], version)}
234
- end
235
-
236
- # Resolves local module name
237
- #
238
- # Returns: String
239
- def add_version?(display_name, version)
240
- version = nil if 'CURRENT'.eql?(version) || 'base'.eql?(version)
241
- (version ? "#{display_name}-#{version.strip}" : "#{display_name}")
242
- end
243
-
244
- private
245
-
246
- def full_module_name(module_hash)
247
- ModuleUtil.join_name(module_hash['name'], module_hash['namespace'])
248
- end
249
-
250
- end
251
- end
@@ -1,33 +0,0 @@
1
- #
2
- # Copyright (C) 2010-2016 dtk contributors
3
- #
4
- # This file is part of the dtk project.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
- module DTK; module Client; class CommandHelper
19
- class ServiceLink < self; class << self
20
- def post_body_with_id_keys(context_params,method_argument_names)
21
- assembly_or_workspace_id = context_params.retrieve_arguments([[:service_id!,:workspace_id!]])
22
- ret = {:assembly_id => assembly_or_workspace_id}
23
- if context_params.is_last_command_eql_to?(:component)
24
- component_id,service_type = context_params.retrieve_arguments([:component_id!,:option_1!],method_argument_names)
25
- ret.merge(:input_component_id => component_id,:service_type => service_type)
26
- else
27
- service_link_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
28
- ret.merge(:service_link_id => service_link_id)
29
- end
30
- end
31
-
32
- end; end
33
- end; end; end