hybrid_platforms_conductor 32.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/check-node +24 -0
- data/bin/deploy +12 -0
- data/bin/dump_nodes_json +12 -0
- data/bin/free_ips +23 -0
- data/bin/free_veids +17 -0
- data/bin/get_impacted_nodes +43 -0
- data/bin/last_deploys +56 -0
- data/bin/nodes_to_deploy +104 -0
- data/bin/report +10 -0
- data/bin/run +39 -0
- data/bin/setup +11 -0
- data/bin/ssh_config +14 -0
- data/bin/test +13 -0
- data/bin/topograph +54 -0
- data/lib/hybrid_platforms_conductor/action.rb +82 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
- data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
- data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
- data/lib/hybrid_platforms_conductor/config.rb +263 -0
- data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
- data/lib/hybrid_platforms_conductor/connector.rb +84 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
- data/lib/hybrid_platforms_conductor/executable.rb +145 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
- data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
- data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
- data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
- data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
- data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
- data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
- data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
- data/lib/hybrid_platforms_conductor/report.rb +31 -0
- data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
- data/lib/hybrid_platforms_conductor/test.rb +141 -0
- data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
- data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
- data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
- data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
- data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
- data/lib/hybrid_platforms_conductor/version.rb +5 -0
- data/spec/hybrid_platforms_conductor_test.rb +159 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
- data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
- data/spec/spec_helper.rb +111 -0
- metadata +566 -0
data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/platform_handler'
|
|
2
|
+
|
|
3
|
+
module HybridPlatformsConductor
|
|
4
|
+
|
|
5
|
+
module HpcPlugins
|
|
6
|
+
|
|
7
|
+
module PlatformHandler
|
|
8
|
+
|
|
9
|
+
# Brief description of the plugin here.
|
|
10
|
+
# The name should match the file name.
|
|
11
|
+
# It should always inherit from PlatformHandler.
|
|
12
|
+
# In all instance methods of a platform handler, the following variables are accessible:
|
|
13
|
+
# * @platform_type (Symbol): The platform type. It is the name of the plugin (:platform_handler_plugin)
|
|
14
|
+
# * @repository_path (String): The repository on which this platform handler instance will perform (/path/to/repository)
|
|
15
|
+
# * @nodes_handler (NodesHandler): Nodes handler used to access information about the platforms
|
|
16
|
+
class PlatformHandlerPlugin < HybridPlatformsConductor::PlatformHandler
|
|
17
|
+
|
|
18
|
+
# Are dependencies met before using this plugin?
|
|
19
|
+
# [API] - This method is optional
|
|
20
|
+
#
|
|
21
|
+
# Result::
|
|
22
|
+
# * Boolean: Are dependencies met before using this plugin?
|
|
23
|
+
def self.valid?
|
|
24
|
+
true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Add a Mixin to the DSL parsing the platforms configuration file.
|
|
28
|
+
# This can be used by any plugin to add plugin-specific configuration getters and setters, accessible later from NodesHandler instances.
|
|
29
|
+
# An optional initializer can also be given.
|
|
30
|
+
# [API] - Those calls are optional
|
|
31
|
+
module MyDSLExtension
|
|
32
|
+
|
|
33
|
+
attr_accessor :my_property
|
|
34
|
+
|
|
35
|
+
# Initialize the DSL
|
|
36
|
+
def init_my_dsl_extension
|
|
37
|
+
@my_property = 42
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
self.extend_config_dsl_with MyDSLExtension, :init_my_dsl_extension
|
|
42
|
+
|
|
43
|
+
# Register test classes at the platform level.
|
|
44
|
+
# This will be called for each platform of this type.
|
|
45
|
+
# [API] - This method is optional
|
|
46
|
+
#
|
|
47
|
+
# Result::
|
|
48
|
+
# * Hash<Symbol,Class>: A list of tests classes (that should inherit from Tests::Test), per test name
|
|
49
|
+
def tests
|
|
50
|
+
# If this plugin defines some tests that are specific to this platform, then return the test classes here.
|
|
51
|
+
# If no tests are written, then no need to define this method at all.
|
|
52
|
+
# The documentation of those test classes can be found in the file my_test_plugin.rb.sample.
|
|
53
|
+
# Additionnally to generic test classes, the ones that are defined from specific platform handler plugins (like here) have the following differences:
|
|
54
|
+
# * Global tests (using the test instance method) are run once per platform of the matching kind.
|
|
55
|
+
# * Node-specific tests (using the test_for_node, test_on_node and test_on_check_node methods) are run only on nodes belonging to a platform of the matching kind.
|
|
56
|
+
# * All instance methods have access to the variable @repository_path that can be used to reference the specific repository for which tests are being run.
|
|
57
|
+
{
|
|
58
|
+
"#{name}_my_test1": HybridPlatformsConductor::Tests::MyTestClass1,
|
|
59
|
+
"#{name}_my_test2": HybridPlatformsConductor::Tests::MyTestClass2
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Initialize a new instance of this platform handler.
|
|
64
|
+
# [API] - This method is optional.
|
|
65
|
+
# [API] - @cmd_runner is accessible.
|
|
66
|
+
def init
|
|
67
|
+
# This method is called when initializing a new instance of this platform handler, for a given repository.
|
|
68
|
+
@my_instance_variable = :initial_value
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Setup the platform, install dependencies...
|
|
72
|
+
# [API] - This method is mandatory.
|
|
73
|
+
# [API] - @cmd_runner is accessible.
|
|
74
|
+
def setup
|
|
75
|
+
# This method is called by the setup executable.
|
|
76
|
+
# It should contain any command that sets up a repository.
|
|
77
|
+
@cmd_runner.run_cmd "cd #{@repository_path} && bundle install --path vendor/bundle --binstubs"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Get the list of known nodes.
|
|
81
|
+
# [API] - This method is mandatory.
|
|
82
|
+
#
|
|
83
|
+
# Result::
|
|
84
|
+
# * Array<String>: List of node names
|
|
85
|
+
def known_nodes
|
|
86
|
+
# This method is used to get the list of nodes that are handled by the platform
|
|
87
|
+
[
|
|
88
|
+
'my_node_1',
|
|
89
|
+
'my_node_2',
|
|
90
|
+
'my_node_3'
|
|
91
|
+
]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Get the list of known nodes lists names.
|
|
95
|
+
# [API] - This method is optional.
|
|
96
|
+
#
|
|
97
|
+
# Result::
|
|
98
|
+
# * Array<String>: List of nodes lists' names
|
|
99
|
+
def known_nodes_lists
|
|
100
|
+
# This method is used to get the list of nodes lists that are handled by the platform.
|
|
101
|
+
# A nodes list is just a group of nodes selectors that can then be used to ease command line interfaces.
|
|
102
|
+
[
|
|
103
|
+
'my_nodes_list_1',
|
|
104
|
+
'my_nodes_list_2'
|
|
105
|
+
]
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Get the list of nodes selectors belonging to a nodes list
|
|
109
|
+
# [API] - This method is optional unless known_nodes_lists has been defined.
|
|
110
|
+
#
|
|
111
|
+
# Parameters::
|
|
112
|
+
# * *nodes_list* (String): Name of the nodes list
|
|
113
|
+
# Result::
|
|
114
|
+
# * Array<Object>: List of nodes selectors
|
|
115
|
+
def nodes_selectors_from_nodes_list(nodes_list)
|
|
116
|
+
# If known_nodes_lists has been defined, then this method should return the list of nodes selectors of a given nodes list.
|
|
117
|
+
case nodes_list
|
|
118
|
+
when 'my_nodes_list_1'
|
|
119
|
+
[
|
|
120
|
+
'my_node_1',
|
|
121
|
+
'my_node_2'
|
|
122
|
+
]
|
|
123
|
+
when 'my_nodes_list_2'
|
|
124
|
+
[
|
|
125
|
+
'/my_node.*/'
|
|
126
|
+
]
|
|
127
|
+
else
|
|
128
|
+
raise "Unknown list name #{nodes_list}"
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Get the metadata of a given node.
|
|
133
|
+
# [API] - This method is mandatory.
|
|
134
|
+
#
|
|
135
|
+
# Parameters::
|
|
136
|
+
# * *node* (String): Node to read metadata from
|
|
137
|
+
# Result::
|
|
138
|
+
# * Hash<Symbol,Object>: The corresponding metadata
|
|
139
|
+
def metadata_for(node)
|
|
140
|
+
{
|
|
141
|
+
french_name: "Le noeud #{node}"
|
|
142
|
+
}
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Return the services for a given node
|
|
146
|
+
# [API] - This method is mandatory.
|
|
147
|
+
#
|
|
148
|
+
# Parameters::
|
|
149
|
+
# * *node* (String): node to read configuration from
|
|
150
|
+
# Result::
|
|
151
|
+
# * Array<String>: The corresponding services
|
|
152
|
+
def services_for(node)
|
|
153
|
+
['hadoop_worker']
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Get the list of services we can deploy
|
|
157
|
+
# [API] - This method is mandatory.
|
|
158
|
+
#
|
|
159
|
+
# Result::
|
|
160
|
+
# * Array<String>: The corresponding services
|
|
161
|
+
def deployable_services
|
|
162
|
+
['hadoop_worker']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Package the repository, ready to be deployed on artefacts or directly to a node.
|
|
166
|
+
# [API] - This method is mandatory.
|
|
167
|
+
# [API] - @cmd_runner is accessible.
|
|
168
|
+
# [API] - @actions_executor is accessible.
|
|
169
|
+
#
|
|
170
|
+
# Parameters::
|
|
171
|
+
# * *services* (Hash< String, Array<String> >): Services to be deployed, per node
|
|
172
|
+
# * *secrets* (Hash): Secrets to be used for deployment
|
|
173
|
+
# * *local_environment* (Boolean): Are we deploying to a local environment?
|
|
174
|
+
def package(services:, secrets:, local_environment:)
|
|
175
|
+
# This method should take all actions to prepare the repository to be deployed on nodes later.
|
|
176
|
+
File.write('temporary_secrets_to_be_deployed.json', secrets)
|
|
177
|
+
# Usually it is meant to package the deployment scripts.
|
|
178
|
+
@cmd_runner.run_cmd "cd #{@repository_path} && ./scripts/package_in_debian_format.sh"
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Prepare deployments.
|
|
182
|
+
# This method is called just before getting and executing the actions to be deployed.
|
|
183
|
+
# It is called once per platform.
|
|
184
|
+
# [API] - This method is optional.
|
|
185
|
+
# [API] - @cmd_runner is accessible.
|
|
186
|
+
# [API] - @actions_executor is accessible.
|
|
187
|
+
#
|
|
188
|
+
# Parameters::
|
|
189
|
+
# * *services* (Hash< String, Array<String> >): Services to be deployed, per node
|
|
190
|
+
# * *secrets* (Hash): Secrets to be used for deployment
|
|
191
|
+
# * *local_environment* (Boolean): Are we deploying to a local environment?
|
|
192
|
+
# * *why_run* (Boolean): Are we deploying in why-run mode?
|
|
193
|
+
def prepare_for_deploy(services:, secrets:, local_environment:, why_run:)
|
|
194
|
+
# This method is used if some actions are needed before deploying for real.
|
|
195
|
+
# The why_run switch is on if the deployment should just be simulated.
|
|
196
|
+
ENV['deploy_time'] = Time.now.to_s
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Get the list of actions to perform to deploy on a given node.
|
|
200
|
+
# Those actions can be executed in parallel with other deployments on other nodes. They must be thread safe.
|
|
201
|
+
# [API] - This method is mandatory.
|
|
202
|
+
# [API] - @cmd_runner is accessible.
|
|
203
|
+
# [API] - @actions_executor is accessible.
|
|
204
|
+
#
|
|
205
|
+
# Parameters::
|
|
206
|
+
# * *node* (String): Node to deploy on
|
|
207
|
+
# * *service* (String): Service to be deployed
|
|
208
|
+
# * *use_why_run* (Boolean): Do we use a why-run mode? [default = true]
|
|
209
|
+
# Result::
|
|
210
|
+
# * Array< Hash<Symbol,Object> >: List of actions to be done
|
|
211
|
+
def actions_to_deploy_on(node, service, use_why_run: true)
|
|
212
|
+
# This method returns all the actions to execute to deploy on a node.
|
|
213
|
+
# The use_why_run switch is on if the deployment should just be simulated.
|
|
214
|
+
# Those actions (bash commands, scp of files, ruby code...) should be thread safe as they can be executed in parallel with other deployment actions for other nodes in case of a concurrent deployment on several nodes.
|
|
215
|
+
# The complete description of an action can be found in actions_executor.rb file, in the execute_actions_on method description.
|
|
216
|
+
[
|
|
217
|
+
{
|
|
218
|
+
scp: {
|
|
219
|
+
"#{File.dirname(__FILE__)}/platform_handler_plugin/scripts" => './deploy_scripts',
|
|
220
|
+
'temporary_secrets_to_be_deployed.json' => './temporary_secrets_to_be_deployed.json'
|
|
221
|
+
},
|
|
222
|
+
remote_bash: [
|
|
223
|
+
'cd ./deploy_scripts',
|
|
224
|
+
"./deploy_service #{service}",
|
|
225
|
+
'rm temporary_secrets_to_be_deployed.json'
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Prepare a why-run deployment so that a JSON file describing the nodes will be output in the run_logs.
|
|
232
|
+
# [API] - This method is mandatory.
|
|
233
|
+
# [API] - @cmd_runner is accessible.
|
|
234
|
+
# [API] - @actions_executor is accessible.
|
|
235
|
+
# [API] - @deployer is accessible.
|
|
236
|
+
def prepare_why_run_deploy_for_json_dump
|
|
237
|
+
# This method is used to prepare a deployment action that should dump JSON info from the node itself.
|
|
238
|
+
@dump_json_mode = true
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Parse stdout and stderr of a given deploy run and get the list of tasks with their status
|
|
242
|
+
# [API] - This method is mandatory.
|
|
243
|
+
#
|
|
244
|
+
# Parameters::
|
|
245
|
+
# * *stdout* (String): stdout to be parsed
|
|
246
|
+
# * *stderr* (String): stderr to be parsed
|
|
247
|
+
# Result::
|
|
248
|
+
# * Array< Hash<Symbol,Object> >: List of task properties. The following properties should be returned, among free ones:
|
|
249
|
+
# * *name* (String): Task name
|
|
250
|
+
# * *status* (Symbol): Task status. Should be on of:
|
|
251
|
+
# * *:changed*: The task has been changed
|
|
252
|
+
# * *:identical*: The task has not been changed
|
|
253
|
+
# * *diffs* (String): Differences, if any
|
|
254
|
+
def parse_deploy_output(stdout, stderr)
|
|
255
|
+
tasks = []
|
|
256
|
+
stdout.split("\n").each do |line|
|
|
257
|
+
if line =~ /Task (.+) status - (.+)/
|
|
258
|
+
tasks << {
|
|
259
|
+
name: $1,
|
|
260
|
+
status: $2 == 'ok' ? :identical : :changed
|
|
261
|
+
}
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
tasks
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Get the list of impacted nodes and services from a files diff.
|
|
268
|
+
# [API] - This method is optional
|
|
269
|
+
#
|
|
270
|
+
# Parameters::
|
|
271
|
+
# * *files_diffs* (Hash< String, Hash< Symbol, Object > >): List of diffs info, per file name having a diff. Diffs info have the following properties:
|
|
272
|
+
# * *moved_to* (String): The new file path, in case it has been moved [optional]
|
|
273
|
+
# * *diff* (String): The diff content
|
|
274
|
+
# Result::
|
|
275
|
+
# * Array<String>: The list of nodes impacted by this diff
|
|
276
|
+
# * Array<String>: The list of services impacted by this diff
|
|
277
|
+
# * Boolean: Are there some files that have a global impact (meaning all nodes are potentially impacted by this diff)?
|
|
278
|
+
def impacts_from(files_diffs)
|
|
279
|
+
[
|
|
280
|
+
files_diffs.keys.select { |file| file.match(/nodes\/(.+)/)[1] }.compact.uniq,
|
|
281
|
+
files_diffs.keys.select { |file| file.match(/services\/(.+)/)[1] }.compact.uniq,
|
|
282
|
+
false
|
|
283
|
+
]
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
end
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
require 'docker-api'
|
|
2
|
+
require 'hybrid_platforms_conductor/provisioner'
|
|
3
|
+
|
|
4
|
+
module HybridPlatformsConductor
|
|
5
|
+
|
|
6
|
+
module HpcPlugins
|
|
7
|
+
|
|
8
|
+
module Provisioner
|
|
9
|
+
|
|
10
|
+
# Provision Docker containers
|
|
11
|
+
class Docker < HybridPlatformsConductor::Provisioner
|
|
12
|
+
|
|
13
|
+
# Are dependencies met before using this plugin?
|
|
14
|
+
# [API] - This method is optional
|
|
15
|
+
#
|
|
16
|
+
# Result::
|
|
17
|
+
# * Boolean: Are dependencies met before using this plugin?
|
|
18
|
+
def self.valid?
|
|
19
|
+
docker_ok = false
|
|
20
|
+
begin
|
|
21
|
+
::Docker.validate_version!
|
|
22
|
+
docker_ok = true
|
|
23
|
+
rescue
|
|
24
|
+
log_error "[ #{@node}/#{@environment} ] - Docker is not installed correctly. Please install it. Error: #{$!}"
|
|
25
|
+
end
|
|
26
|
+
docker_ok
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Create an instance.
|
|
30
|
+
# Reuse an existing one if it already exists.
|
|
31
|
+
# [API] - This method is mandatory
|
|
32
|
+
def create
|
|
33
|
+
# Get the image name for this node
|
|
34
|
+
image = @nodes_handler.get_image_of(@node).to_sym
|
|
35
|
+
# Find if we have such an image registered
|
|
36
|
+
if @config.known_os_images.include?(image)
|
|
37
|
+
# Build the image if it does not exist
|
|
38
|
+
image_tag = "hpc_image_#{image}"
|
|
39
|
+
docker_image = nil
|
|
40
|
+
image_futex_file = "#{Dir.tmpdir}/hpc_docker_image_futexes/#{image_tag}"
|
|
41
|
+
FileUtils.mkdir_p File.dirname(image_futex_file)
|
|
42
|
+
Futex.new(image_futex_file).open do
|
|
43
|
+
docker_image = ::Docker::Image.all.find { |search_image| !search_image.info['RepoTags'].nil? && search_image.info['RepoTags'].include?("#{image_tag}:latest") }
|
|
44
|
+
unless docker_image
|
|
45
|
+
log_debug "[ #{@node}/#{@environment} ] - Creating Docker image #{image_tag}..."
|
|
46
|
+
Excon.defaults[:read_timeout] = 600
|
|
47
|
+
docker_image = ::Docker::Image.build_from_dir(@config.os_image_dir(image))
|
|
48
|
+
docker_image.tag repo: image_tag
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
container_name = "hpc_docker_container_#{@node}_#{@environment}"
|
|
52
|
+
container_futex_file = "#{Dir.tmpdir}/hpc_docker_container_futexes/#{image_tag}"
|
|
53
|
+
FileUtils.mkdir_p File.dirname(container_futex_file)
|
|
54
|
+
Futex.new(container_futex_file).open do
|
|
55
|
+
old_docker_container = ::Docker::Container.all(all: true).find { |container| container.info['Names'].include? "/#{container_name}" }
|
|
56
|
+
@container =
|
|
57
|
+
if old_docker_container
|
|
58
|
+
old_docker_container
|
|
59
|
+
else
|
|
60
|
+
log_debug "[ #{@node}/#{@environment} ] - Creating Docker container #{container_name}..."
|
|
61
|
+
# We add the SYS_PTRACE capability as some images need to restart services (for example postfix) and those services need the rights to ls in /proc/{PID}/exe to check if a status is running. Without SYS_PTRACE such ls returns permission denied and the service can't be stopped (as init.d always returns it as stopped even when running).
|
|
62
|
+
# We add the privileges as some containers need to install and configure the udev package, which needs RW access to /sys.
|
|
63
|
+
# We add the bind to cgroup volume to be able to test systemd specifics (enabling/disabling services for example).
|
|
64
|
+
::Docker::Container.create(
|
|
65
|
+
name: container_name,
|
|
66
|
+
image: image_tag,
|
|
67
|
+
CapAdd: 'SYS_PTRACE',
|
|
68
|
+
Privileged: true,
|
|
69
|
+
Binds: ['/sys/fs/cgroup:/sys/fs/cgroup:ro'],
|
|
70
|
+
# Some playbooks need the hostname to be set to a correct FQDN
|
|
71
|
+
Hostname: "#{@node}.testdomain"
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
else
|
|
76
|
+
raise "[ #{@node}/#{@environment} ] - Unknown OS image #{image} defined for node #{@node}"
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Start an instance
|
|
81
|
+
# Prerequisite: create has been called before
|
|
82
|
+
# [API] - This method is mandatory
|
|
83
|
+
def start
|
|
84
|
+
log_debug "[ #{@node}/#{@environment} ] - Start Docker Container #{@container.refresh!.info['Name'][1..-1]} ..."
|
|
85
|
+
@container.start
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Stop an instance
|
|
89
|
+
# Prerequisite: create has been called before
|
|
90
|
+
# [API] - This method is mandatory
|
|
91
|
+
def stop
|
|
92
|
+
log_debug "[ #{@node}/#{@environment} ] - Stop Docker Container #{@container.refresh!.info['Name'][1..-1]} ..."
|
|
93
|
+
@container.stop
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Destroy an instance
|
|
97
|
+
# Prerequisite: create has been called before
|
|
98
|
+
# [API] - This method is mandatory
|
|
99
|
+
def destroy
|
|
100
|
+
log_debug "[ #{@node}/#{@environment} ] - Destroy Docker Container #{@container.refresh!.info['Name'][1..-1]} ..."
|
|
101
|
+
@container.remove
|
|
102
|
+
@container = nil
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Return the state of an instance
|
|
106
|
+
# [API] - This method is mandatory
|
|
107
|
+
#
|
|
108
|
+
# Result::
|
|
109
|
+
# * Symbol: The state the instance is in. Possible values are:
|
|
110
|
+
# * *:missing*: The instance does not exist
|
|
111
|
+
# * *:created*: The instance has been created but is not running
|
|
112
|
+
# * *:running*: The instance is running
|
|
113
|
+
# * *:exited*: The instance has run and is now stopped
|
|
114
|
+
# * *:error*: The instance is in error
|
|
115
|
+
def state
|
|
116
|
+
if !defined?(@container) || @container.nil?
|
|
117
|
+
:missing
|
|
118
|
+
else
|
|
119
|
+
begin
|
|
120
|
+
@container.refresh!.info['State']['Status'].to_sym
|
|
121
|
+
rescue
|
|
122
|
+
log_error "[ #{@node}/#{@environment} ] - Error while reading state of Docker container: #{$!}"
|
|
123
|
+
:error
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Return the IP address of an instance.
|
|
129
|
+
# Prerequisite: create has been called before.
|
|
130
|
+
# [API] - This method is optional
|
|
131
|
+
#
|
|
132
|
+
# Result::
|
|
133
|
+
# * String or nil: The instance IP address, or nil if this information is not relevant
|
|
134
|
+
def ip
|
|
135
|
+
# Get its IP that could have changed upon restart
|
|
136
|
+
# cf https://github.com/moby/moby/issues/2801
|
|
137
|
+
# Make sure we refresh its info before querying it, as we could hit a cache of a previous IP.
|
|
138
|
+
@container.refresh!
|
|
139
|
+
@container.json['NetworkSettings']['IPAddress']
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/provisioner'
|
|
2
|
+
|
|
3
|
+
module HybridPlatformsConductor
|
|
4
|
+
|
|
5
|
+
module HpcPlugins
|
|
6
|
+
|
|
7
|
+
module Provisioner
|
|
8
|
+
|
|
9
|
+
class MyProvisioner < HybridPlatformsConductor::Provisioner
|
|
10
|
+
|
|
11
|
+
# Are dependencies met before using this plugin?
|
|
12
|
+
# [API] - This method is optional
|
|
13
|
+
#
|
|
14
|
+
# Result::
|
|
15
|
+
# * Boolean: Are dependencies met before using this plugin?
|
|
16
|
+
def self.valid?
|
|
17
|
+
true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Add a Mixin to the DSL parsing the platforms configuration file.
|
|
21
|
+
# This can be used by any plugin to add plugin-specific configuration getters and setters, accessible later from NodesHandler instances.
|
|
22
|
+
# An optional initializer can also be given.
|
|
23
|
+
# [API] - Those calls are optional
|
|
24
|
+
module MyDSLExtension
|
|
25
|
+
|
|
26
|
+
attr_accessor :my_property
|
|
27
|
+
|
|
28
|
+
# Initialize the DSL
|
|
29
|
+
def init_my_dsl_extension
|
|
30
|
+
@my_property = 42
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
self.extend_config_dsl_with MyDSLExtension, :init_my_dsl_extension
|
|
35
|
+
|
|
36
|
+
# Create an instance.
|
|
37
|
+
# Reuse an existing one if it already exists.
|
|
38
|
+
# [API] - This method is mandatory
|
|
39
|
+
def create
|
|
40
|
+
@vm = InfraAPI.create_vm_for(@nodes_handler.get_image_of(@node))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Start an instance
|
|
44
|
+
# Prerequisite: create has been called before
|
|
45
|
+
# [API] - This method is mandatory
|
|
46
|
+
def start
|
|
47
|
+
@vm.start
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Stop an instance
|
|
51
|
+
# Prerequisite: create has been called before
|
|
52
|
+
# [API] - This method is mandatory
|
|
53
|
+
def stop
|
|
54
|
+
@vm.stop
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Destroy an instance
|
|
58
|
+
# Prerequisite: create has been called before
|
|
59
|
+
# [API] - This method is mandatory
|
|
60
|
+
def destroy
|
|
61
|
+
@vm.remove
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Return the state of an instance
|
|
65
|
+
# [API] - This method is mandatory
|
|
66
|
+
#
|
|
67
|
+
# Result::
|
|
68
|
+
# * Symbol: The state the instance is in. Possible values are:
|
|
69
|
+
# * *:missing*: The instance does not exist
|
|
70
|
+
# * *:created*: The instance has been created but is not running
|
|
71
|
+
# * *:running*: The instance is running
|
|
72
|
+
# * *:exited*: The instance has run and is now stopped
|
|
73
|
+
# * *:error*: The instance is in error
|
|
74
|
+
def state
|
|
75
|
+
@vm.state.to_sym
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Return the IP address of an instance.
|
|
79
|
+
# Prerequisite: create has been called before.
|
|
80
|
+
# [API] - This method is optional
|
|
81
|
+
#
|
|
82
|
+
# Result::
|
|
83
|
+
# * String or nil: The instance IP address, or nil if this information is not relevant
|
|
84
|
+
def ip
|
|
85
|
+
@vm.ip_address
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Return the default timeout to apply when waiting for an instance to be started/stopped...
|
|
89
|
+
# [API] - This method is optional
|
|
90
|
+
#
|
|
91
|
+
# Result::
|
|
92
|
+
# * Integer: The timeout in seconds
|
|
93
|
+
def default_timeout
|
|
94
|
+
3600
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|