-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathnode_encrypt.rb
More file actions
17 lines (14 loc) · 834 Bytes
/
node_encrypt.rb
File metadata and controls
17 lines (14 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true
require_relative '../../../puppet_x/node_encrypt'
Puppet::Parser::Functions.newfunction(:node_encrypt,
type: :rvalue,
arity: 1, doc: <<-DOC
This function simply encrypts the String or Sensitive passed to it using the certificate
belonging to the client the catalog is being compiled for.
DOC
) do |args|
content = args.first
content = content.unwrap if defined?(Puppet::Pops::Types::PSensitiveType::Sensitive) && content.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)
certname = lookupvar('clientcert')
PuppetX::NodeEncrypt.encrypt(content, certname)
end