File tree 10 files changed +22
-22
lines changed
10 files changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,12 @@ RSpec/NamedSubject:
59
59
RSpec/StubbedMock :
60
60
Exclude :
61
61
- ' spec/functions/node_encrypt_spec.rb'
62
- - ' spec/unit/puppet_x/binford2k /node_encrypt_spec.rb'
62
+ - ' spec/unit/puppet_x/puppetlabs /node_encrypt_spec.rb'
63
63
64
64
# Offense count: 1
65
65
# This cop supports unsafe autocorrection (--autocorrect-all).
66
66
# Configuration parameters: EnforcedStyle.
67
67
# SupportedStyles: nested, compact
68
68
Style/ClassAndModuleChildren :
69
69
Exclude :
70
- - ' lib/puppet_x/binford2k /node_encrypt.rb'
70
+ - ' lib/puppet_x/puppetlabs /node_encrypt.rb'
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
require 'puppet/face'
4
- require 'puppet_x/binford2k /node_encrypt'
4
+ require 'puppet_x/puppetlabs /node_encrypt'
5
5
6
6
Puppet ::Face . define ( :node , '0.0.1' ) do
7
7
action :encrypt do
45
45
text = args . join ( ' ' )
46
46
end
47
47
48
- PuppetX ::Binford2k ::NodeEncrypt . encrypt ( text , options [ :target ] )
48
+ PuppetX ::Puppetlabs ::NodeEncrypt . encrypt ( text , options [ :target ] )
49
49
end
50
50
end
51
51
76
76
77
77
when_invoked do |options |
78
78
if options . include? :data
79
- PuppetX ::Binford2k ::NodeEncrypt . decrypt ( options [ :data ] )
79
+ PuppetX ::Puppetlabs ::NodeEncrypt . decrypt ( options [ :data ] )
80
80
elsif options . include? :env
81
- PuppetX ::Binford2k ::NodeEncrypt . decrypt ( ENV . fetch ( options [ :env ] , nil ) )
81
+ PuppetX ::Puppetlabs ::NodeEncrypt . decrypt ( ENV . fetch ( options [ :env ] , nil ) )
82
82
else
83
- PuppetX ::Binford2k ::NodeEncrypt . decrypt ( $stdin. read )
83
+ PuppetX ::Puppetlabs ::NodeEncrypt . decrypt ( $stdin. read )
84
84
end
85
85
end
86
86
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- require_relative '../../puppet_x/binford2k /node_encrypt'
3
+ require_relative '../../puppet_x/puppetlabs /node_encrypt'
4
4
5
5
# Decrypt data with node_encrypt. This is intended to be used as a
6
6
# Deferred function on the _agent_ via the node_encrypted::secret wrapper.
12
12
13
13
def decrypt ( content )
14
14
Puppet ::Pops ::Types ::PSensitiveType ::Sensitive . new (
15
- PuppetX ::Binford2k ::NodeEncrypt . decrypt ( content ) ,
15
+ PuppetX ::Puppetlabs ::NodeEncrypt . decrypt ( content ) ,
16
16
)
17
17
end
18
18
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- require_relative '../../puppet_x/binford2k /node_encrypt'
3
+ require_relative '../../puppet_x/puppetlabs /node_encrypt'
4
4
5
5
# @summary
6
6
# Encrypt data with node_encrypt.
16
16
17
17
def simple_encrypt ( content )
18
18
certname = closure_scope [ 'clientcert' ]
19
- PuppetX ::Binford2k ::NodeEncrypt . encrypt ( content , certname )
19
+ PuppetX ::Puppetlabs ::NodeEncrypt . encrypt ( content , certname )
20
20
end
21
21
22
22
def sensitive_encrypt ( content )
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- require_relative '../../../puppet_x/binford2k /node_encrypt'
3
+ require_relative '../../../puppet_x/puppetlabs /node_encrypt'
4
4
5
5
Puppet ::Parser ::Functions . newfunction ( :node_encrypt ,
6
6
type : :rvalue ,
14
14
content = content . unwrap if defined? ( Puppet ::Pops ::Types ::PSensitiveType ::Sensitive ) && content . is_a? ( Puppet ::Pops ::Types ::PSensitiveType ::Sensitive )
15
15
16
16
certname = lookupvar ( 'clientcert' )
17
- PuppetX ::Binford2k ::NodeEncrypt . encrypt ( content , certname )
17
+ PuppetX ::Puppetlabs ::NodeEncrypt . encrypt ( content , certname )
18
18
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
module PuppetX
4
- module Binford2k
4
+ module Puppetlabs
5
5
class NodeEncrypt # rubocop:disable Style/Documentation
6
6
def self . encrypted? ( data )
7
7
raise ArgumentError , 'Only strings can be encrypted' unless data . instance_of? ( String )
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
require 'spec_helper'
4
- require 'puppet_x/binford2k /node_encrypt'
4
+ require 'puppet_x/puppetlabs /node_encrypt'
5
5
6
6
describe 'node_encrypt::certificates' do
7
7
before ( :each ) do
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
require 'spec_helper'
4
- require 'puppet_x/binford2k /node_encrypt'
4
+ require 'puppet_x/puppetlabs /node_encrypt'
5
5
6
6
describe 'node_encrypt::file' do
7
7
context 'when ensuring present' do
48
48
end
49
49
50
50
before ( :each ) do
51
- allow ( PuppetX ::Binford2k ::NodeEncrypt ) . to receive ( :decrypt ) . with ( 'encrypted' ) . and_return ( 'decrypted' )
51
+ allow ( PuppetX ::Puppetlabs ::NodeEncrypt ) . to receive ( :decrypt ) . with ( 'encrypted' ) . and_return ( 'decrypted' )
52
52
end
53
53
54
54
it {
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
require 'spec_helper'
4
- require 'puppet_x/binford2k /node_encrypt'
4
+ require 'puppet_x/puppetlabs /node_encrypt'
5
5
6
6
describe 'node_encrypt' do
7
7
let ( :node ) { 'testhost.example.com' }
11
11
end
12
12
13
13
it 'receives foobar and returns encrypted' do
14
- expect ( PuppetX ::Binford2k ::NodeEncrypt ) . to receive ( :encrypt ) . with ( 'foobar' , 'testhost.example.com' ) . and_return ( 'encrypted' )
14
+ expect ( PuppetX ::Puppetlabs ::NodeEncrypt ) . to receive ( :encrypt ) . with ( 'foobar' , 'testhost.example.com' ) . and_return ( 'encrypted' )
15
15
expect ( scope . function_node_encrypt ( [ 'foobar' ] ) ) . to eq ( 'encrypted' )
16
16
end
17
17
18
18
if defined? ( Puppet ::Pops ::Types ::PSensitiveType ::Sensitive )
19
19
it 'receives sensitive value and returns encrypted' do
20
- expect ( PuppetX ::Binford2k ::NodeEncrypt ) . to receive ( :encrypt ) . with ( 'foobar' , 'testhost.example.com' ) . and_return ( 'encrypted' )
20
+ expect ( PuppetX ::Puppetlabs ::NodeEncrypt ) . to receive ( :encrypt ) . with ( 'foobar' , 'testhost.example.com' ) . and_return ( 'encrypted' )
21
21
expect ( scope . function_node_encrypt ( [ Puppet ::Pops ::Types ::PSensitiveType ::Sensitive . new ( 'foobar' ) ] ) ) . to eq ( 'encrypted' )
22
22
end
23
23
end
Original file line number Diff line number Diff line change 2
2
3
3
require 'openssl'
4
4
require 'spec_helper'
5
- require 'puppet_x/binford2k /node_encrypt'
5
+ require 'puppet_x/puppetlabs /node_encrypt'
6
6
7
7
ca_crt_pem = "-----BEGIN CERTIFICATE-----
8
8
MIIGGjCCBAKgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMVgwVgYDVQQDDE9QdXBw
252
252
uSI28VzZYavkITj+2D6tMys=
253
253
-----END PKCS7-----"
254
254
255
- describe PuppetX ::Binford2k ::NodeEncrypt do
255
+ describe PuppetX ::Puppetlabs ::NodeEncrypt do
256
256
let ( :node ) { 'testhost.example.com' }
257
257
258
258
it 'decrypts values which have been encrypted' do
You can’t perform that action at this time.
0 commit comments