class Hiera::Backend::Eyaml::Encryptors::Cli

Constants

VERSION

Public Class Methods

create_keys() click to toggle source
# File lib/hiera/backend/eyaml/encryptors/cli.rb, line 76
def self.create_keys
    STDERR.puts 'This encryptor does not support creation of keys'
end
decrypt(ciphertext) click to toggle source
# File lib/hiera/backend/eyaml/encryptors/cli.rb, line 63
def self.decrypt(ciphertext)
    if self.stderr
        out, status = Open3.capture2(self.decrypt_command, :stdin_data=>ciphertext)
        err = ''
    else
        out, err, status = Open3.capture3(self.decrypt_command, :stdin_data=>ciphertext)
    end
    if status != 0
        raise 'Call to decrypt subcommand failed:\n%s\n%s' % [out, err]
    end
    out
end
decrypt_command() click to toggle source
# File lib/hiera/backend/eyaml/encryptors/cli.rb, line 34
def self.decrypt_command
    decrypt_command = option :decrypt_command
    if decrypt_command.nil? || decrypt_command.empty?
        raise ArgumentError, 'No decryption command configured!'
    end
    decrypt_command
end
encrypt(plaintext) click to toggle source
# File lib/hiera/backend/eyaml/encryptors/cli.rb, line 50
def self.encrypt(plaintext)
    if self.stderr
        out, status = Open3.capture2(self.encrypt_command, :stdin_data=>plaintext)
        err = ''
    else
        out, err, status = Open3.capture3(self.encrypt_command, :stdin_data=>plaintext)
    end
    if status != 0
        raise 'Call to encrypt subcommand failed:\n%s\n%s' % [out, err]
    end
    out
end
encrypt_command() click to toggle source
# File lib/hiera/backend/eyaml/encryptors/cli.rb, line 26
def self.encrypt_command
    encrypt_command = option :encrypt_command
    if encrypt_command.nil? || encrypt_command.empty?
        raise ArgumentError, 'No encryption command configured!'
    end
    encrypt_command
end
stderr() click to toggle source
# File lib/hiera/backend/eyaml/encryptors/cli.rb, line 42
def self.stderr
    stderr = option :stderr
    if stderr.nil? || stderr.empty?
        stderr = false
    end
    stderr
end