class Hiera::Backend::Eyaml::Encryptor

Attributes

options[RW]
tag[RW]

Public Class Methods

debug(msg) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 65
def self.debug(msg)
  LoggingHelper.debug from: plugin_classname, msg: msg
end
decode(string) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 29
def self.decode(string)
  Base64.decode64(string)
end
decrypt(*_args) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 37
def self.decrypt *_args
  raise StandardError, "decrypt() not defined for decryptor plugin: #{self}"
end
encode(binary_string) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 25
def self.encode(binary_string)
  Base64.strict_encode64(binary_string)
end
encrypt(*_args) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 33
def self.encrypt *_args
  raise StandardError, "encrypt() not defined for encryptor plugin: #{self}"
end
find(encryption_scheme = nil) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 12
def self.find(encryption_scheme = nil)
  encryption_scheme = Eyaml.default_encryption_scheme if encryption_scheme.nil?
  require "hiera/backend/eyaml/encryptors/#{File.basename encryption_scheme.downcase}"
  encryptor_module = Module.const_get(:Hiera).const_get(:Backend).const_get(:Eyaml).const_get(:Encryptors)
  encryptor_class = Utils.find_closest_class parent_class: encryptor_module, class_name: encryption_scheme
  if encryptor_class.nil?
    raise StandardError,
          "Could not find hiera-eyaml encryptor: #{encryption_scheme}. Try gem install hiera-eyaml-#{encryption_scheme.downcase} ?"
  end

  encryptor_class
end
format_message(msg) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 57
def self.format_message(msg)
  "[eyaml_#{plugin_classname}]:  #{msg}"
end
hiera?() click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 53
def self.hiera?
  Utils.hiera?
end
info(msg) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 69
def self.info(msg)
  LoggingHelper.info from: plugin_classname, msg: msg
end
option(name) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 49
def self.option(name)
  Eyaml::Options["#{plugin_classname}_#{name}"] || options["#{plugin_classname}_#{name}"]
end
plugin_classname() click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 41
def self.plugin_classname
  to_s.split('::').last.downcase
end
register() click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 45
def self.register
  Hiera::Backend::Eyaml::Plugins.register_options options: options, plugin: plugin_classname
end
trace(msg) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 61
def self.trace(msg)
  LoggingHelper.trace from: plugin_classname, msg: msg
end
warn(msg) click to toggle source
# File lib/hiera/backend/eyaml/encryptor.rb, line 73
def self.warn(msg)
  LoggingHelper.warn from: plugin_classname, msg: msg
end