class YleTf
Constants
- Error
Base class for yle_tf errors
- TERRAFORM_VERSION_REQUIREMENT
- VERSION
Attributes
actions[W]
tf_command[R]
tf_command_args[R]
tf_env[R]
tf_options[R]
Public Class Methods
new(tf_options, tf_env, tf_command, tf_command_args = [])
click to toggle source
# File lib/yle_tf.rb, line 16 def initialize(tf_options, tf_env, tf_command, tf_command_args = []) Logger.debug("YleTf version: #{VERSION}") Logger.debug("Ruby version: #{RUBY_VERSION}") Logger.debug("tf_options: #{tf_options.inspect}") Logger.debug("tf_env: #{tf_env.inspect}") Logger.debug("tf_command: #{tf_command.inspect}") Logger.debug("tf_command_args: #{tf_command_args.inspect}") @tf_options = tf_options @tf_env = tf_env @tf_command = tf_command @tf_command_args = tf_command_args Plugin::Loader.load_plugins end
Public Instance Methods
action_env()
click to toggle source
# File lib/yle_tf.rb, line 59 def action_env { tf_options: tf_options, tf_env: tf_env, tf_command: tf_command, tf_command_args: tf_command_args, tfvars: default_tfvars, } end
actions()
click to toggle source
# File lib/yle_tf.rb, line 41 def actions @actions ||= build_action_stack end
apply_action_hooks()
click to toggle source
# File lib/yle_tf.rb, line 51 def apply_action_hooks hooks = Plugin.manager.action_hooks Logger.debug("Applying #{hooks.length} action hooks") Plugin::ActionHook.new(actions).tap do |h| hooks.each { |hook_proc| hook_proc.call(h) } end end
build_action_stack()
click to toggle source
# File lib/yle_tf.rb, line 45 def build_action_stack command_data = Plugin.manager.commands[tf_command] command_proc = command_data[:proc] command_proc.call end
default_tfvars()
click to toggle source
# File lib/yle_tf.rb, line 69 def default_tfvars { 'env' => tf_env, } end
run(env = {})
click to toggle source
# File lib/yle_tf.rb, line 32 def run(env = {}) Logger.debug('Building and running the stack') apply_action_hooks Logger.debug("actions: #{actions.inspect}") env.merge!(action_env) Logger.debug("env: #{env.inspect}") actions.call(env) end