Class: Hiera::Backend::Eyaml::Actions::DecryptAction

Inherits:
Object
  • Object
show all
Defined in:
lib/hiera/backend/eyaml/actions/decrypt_action.rb

Class Method Summary collapse

Class Method Details

.executeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hiera/backend/eyaml/actions/decrypt_action.rb', line 12

def self.execute
  parser = Parser::ParserFactory.encrypted_parser
  tokens = parser.parse(Eyaml::Options[:input_data])
  case Eyaml::Options[:source]
    when :eyaml
      decrypted = tokens.map{ |token| token.to_decrypted }
      decrypted.join
    else
      decrypted = tokens.map{ |token|
        case token.class.name
          when /::EncToken$/
            token.plain_text
          else
            token.match
        end
      }
      decrypted.join
  end

end