From e49e262faa36a3c87db8d935104cd3432f76dfbb Mon Sep 17 00:00:00 2001 From: hoatle Date: Thu, 19 Jul 2018 18:41:49 +0700 Subject: [PATCH] @ #227 | configurator stub is ready to be implemented --- Vagrantfile | 3 +- lib/configurator.rb | 74 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 lib/configurator.rb diff --git a/Vagrantfile b/Vagrantfile index d46028da..ee5fb04c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,6 +4,7 @@ require "rubygems" require_relative 'lib/utility' require_relative 'lib/settings_processor' +require_relative 'lib/configurator' # teracy-dev version VERSION='0.6.0-a1-SNAPSHOT' @@ -50,7 +51,7 @@ Vagrant.configure("2") do |config| primary = node_config["primary"] ||= false autostart = node_config["autostart"] === false ? false : true config.vm.define node_config["name"], primary: primary, autostart: autostart do |node| - # node settings here + configure(node_config, node) end end # postload-ext list here diff --git a/lib/configurator.rb b/lib/configurator.rb new file mode 100644 index 00000000..ff46d090 --- /dev/null +++ b/lib/configurator.rb @@ -0,0 +1,74 @@ +# configure for node with all options from https://www.vagrantup.com/docs/ + +require_relative 'utility' + +$logger = get_logger() + + +# https://www.vagrantup.com/docs/vagrantfile/machine_settings.html +def _configure_vm(vm_config, node) + # TODO: implement this + $logger.debug("_configure_vm: #{vm_config}") +end + +# https://www.vagrantup.com/docs/vagrantfile/ssh_settings.html +def _configure_ssh(ssh_config, node) + # TODO: implement this + $logger.debug("_configure_ssh: #{ssh_config}") +end + + +# https://www.vagrantup.com/docs/vagrantfile/winrm_settings.html +def _configure_winrm(winrm_config, node) + # TODO: implement this + $logger.debug("_configure_winrm: #{winrm_config}") +end + +# https://www.vagrantup.com/docs/vagrantfile/winssh_settings.html +def _configure_winssh(winssh_config, node) + # TODO: implemet this + $logger.debug("_configure_winssh: #{winssh_config}") +end + +# https://www.vagrantup.com/docs/vagrantfile/vagrant_settings.html +def _configure_vagrant(vagrant_config, node) + # TODO: implement this + $logger.debug("_configure_vagrant: #{vagrant_config}") +end + +# https://www.vagrantup.com/docs/provisioning/ +def _configure_provisioners(provisoners_config, node) + # TODO: implement this + $logger.debug("_configure_provisioners: #{provisoners_config}") +end + +# https://www.vagrantup.com/docs/networking/ +def _configure_networks(networks_config, node) + # TODO: implement this + $logger.debug("_configure_networks: #{networks_config}") +end + +# https://www.vagrantup.com/docs/synced-folders/ +def _configure_sync_folders(sync_folders_config, node) + # TODO: implement this + $logger.debug("_configure_sync_folders: #{sync_folders_config}") +end + +# https://www.vagrantup.com/docs/providers/ +def _configure_providers(providers_config, node) + # TODO: implement this + $logger.debug("_configure_providers: #{providers_config}") +end + + +def configure(node_config, node) + _configure_vm(node_config["vm"], node) + _configure_ssh(node_config["ssh"], node) + _configure_winrm(node_config["winrm"], node) + _configure_winssh(node_config["winssh"], node) + _configure_vagrant(node_config["vagrant"], node) + _configure_provisioners(node_config["provisoners"], node) + _configure_networks(node_config["networks"], node) + _configure_sync_folders(node_config["synced-folders"], node) + _configure_provisioners(node_config["providers"], node) +end