Module: Yutani

Defined in:
lib/yutani/hiera.rb,
lib/yutani.rb,
lib/yutani/cli.rb,
lib/yutani/data.rb,
lib/yutani/stack.rb,
lib/yutani/utils.rb,
lib/yutani/config.rb,
lib/yutani/version.rb,
lib/yutani/provider.rb,
lib/yutani/resource.rb,
lib/yutani/template.rb,
lib/yutani/remote_config.rb

Overview

say something about the purpose of this wrapper, for instance the way in which yutani maintains a stack of hiera scopes and then merges them when a lookup occurs

Defined Under Namespace

Modules: Hiera, Utils Classes: Cli, Config, Data, DeepMergeHash, IndifferentHash, Provider, RemoteConfig, Resource, Stack, SubData, SubResource, Template, TemplateNotFoundError, TerraformCommandError

Constant Summary collapse

VERSION =
'0.1.20'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.hieraObject

do we need :logger?



21
22
23
# File 'lib/yutani.rb', line 21

def hiera
  @hiera
end

.loggerObject

do we need :logger?



21
22
23
# File 'lib/yutani.rb', line 21

def logger
  @logger
end

Class Method Details

.config(override = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/yutani.rb', line 38

def config(override = {})
  config = Config.new
  override = Config[override]

  config = config.read_config_file

  # Merge DEFAULTS < .yutani.yml < override
  Config.from(config.merge(override))
end

.dsl_eval(str, *args, &block) ⇒ Object



57
58
59
# File 'lib/yutani.rb', line 57

def dsl_eval(str, *args, &block)
  Docile.dsl_eval(self, *args, &block)
end

.eval_file(*args, file) ⇒ Object



67
68
69
# File 'lib/yutani.rb', line 67

def eval_file(*args, file)
  eval_string(File.read(file), file)
end

.eval_string(*args, str, file) ⇒ Object



61
62
63
64
65
# File 'lib/yutani.rb', line 61

def eval_string(*args, str, file)
  dsl_eval(str, *args, file) do
    instance_eval(str, file)
  end
end

.scope(**kv) {|Yutani::IndifferentHash.new(Hiera.scope)| ... } ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/yutani.rb', line 48

def scope(**kv, &block)
  Hiera.push kv

  # let user use symbols or strings for keys
  yield Yutani::IndifferentHash.new(Hiera.scope)

  Hiera.pop
end

.stack(*namespace, &block) ⇒ Object

DSL statement



32
33
34
35
36
# File 'lib/yutani.rb', line 32

def stack(*namespace, &block)
  s = Stack.new(*namespace, &block)
  s.to_fs
  s
end