Sha256: eed748b8a137da3bac565ca222a5a4d6295fdde4d764aae38c44d21cefeac1dc
Contents?: true
Size: 839 Bytes
Versions: 5
Compression:
Stored size: 839 Bytes
Contents
require 'itamae' require 'hashie' require 'json' require 'schash' module Itamae class Node < Hashie::Mash ValidationError = Class.new(StandardError) def reverse_merge(other_hash) Hashie::Mash.new(other_hash).merge(self) end def reverse_merge!(other_hash) self.replace(reverse_merge(other_hash)) end def [](key) val = super(key) if val.nil? begin val = host_inventory[key] rescue NotImplementedError, NameError val = nil end end val end def validate!(&block) errors = Schash::Validator.new(&block).validate(self) unless errors.empty? errors.each do |error| Logger.error "'#{error.position.join('->')}' #{error.message}" end raise ValidationError end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
itamae-1.2.0 | lib/itamae/node.rb |
itamae-1.1.26 | lib/itamae/node.rb |
itamae-1.1.25 | lib/itamae/node.rb |
itamae-1.1.24 | lib/itamae/node.rb |
itamae-1.1.23 | lib/itamae/node.rb |