Skip to content

Commit ef206db

Browse files
committed
(maint) - Move NodeEncrypt class to puppetlabs directory
1 parent c8de198 commit ef206db

File tree

10 files changed

+22
-22
lines changed

10 files changed

+22
-22
lines changed

.rubocop_todo.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ RSpec/NamedSubject:
5959
RSpec/StubbedMock:
6060
Exclude:
6161
- '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'
6363

6464
# Offense count: 1
6565
# This cop supports unsafe autocorrection (--autocorrect-all).
6666
# Configuration parameters: EnforcedStyle.
6767
# SupportedStyles: nested, compact
6868
Style/ClassAndModuleChildren:
6969
Exclude:
70-
- 'lib/puppet_x/binford2k/node_encrypt.rb'
70+
- 'lib/puppet_x/puppetlabs/node_encrypt.rb'

lib/puppet/face/node/encrypt.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'puppet/face'
4-
require 'puppet_x/binford2k/node_encrypt'
4+
require 'puppet_x/puppetlabs/node_encrypt'
55

66
Puppet::Face.define(:node, '0.0.1') do
77
action :encrypt do
@@ -45,7 +45,7 @@
4545
text = args.join(' ')
4646
end
4747

48-
PuppetX::Binford2k::NodeEncrypt.encrypt(text, options[:target])
48+
PuppetX::Puppetlabs::NodeEncrypt.encrypt(text, options[:target])
4949
end
5050
end
5151

@@ -76,11 +76,11 @@
7676

7777
when_invoked do |options|
7878
if options.include? :data
79-
PuppetX::Binford2k::NodeEncrypt.decrypt(options[:data])
79+
PuppetX::Puppetlabs::NodeEncrypt.decrypt(options[:data])
8080
elsif options.include? :env
81-
PuppetX::Binford2k::NodeEncrypt.decrypt(ENV.fetch(options[:env], nil))
81+
PuppetX::Puppetlabs::NodeEncrypt.decrypt(ENV.fetch(options[:env], nil))
8282
else
83-
PuppetX::Binford2k::NodeEncrypt.decrypt($stdin.read)
83+
PuppetX::Puppetlabs::NodeEncrypt.decrypt($stdin.read)
8484
end
8585
end
8686
end

lib/puppet/functions/node_decrypt.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative '../../puppet_x/binford2k/node_encrypt'
3+
require_relative '../../puppet_x/puppetlabs/node_encrypt'
44

55
# Decrypt data with node_encrypt. This is intended to be used as a
66
# Deferred function on the _agent_ via the node_encrypted::secret wrapper.
@@ -12,7 +12,7 @@
1212

1313
def decrypt(content)
1414
Puppet::Pops::Types::PSensitiveType::Sensitive.new(
15-
PuppetX::Binford2k::NodeEncrypt.decrypt(content),
15+
PuppetX::Puppetlabs::NodeEncrypt.decrypt(content),
1616
)
1717
end
1818
end

lib/puppet/functions/node_encrypt.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative '../../puppet_x/binford2k/node_encrypt'
3+
require_relative '../../puppet_x/puppetlabs/node_encrypt'
44

55
# @summary
66
# Encrypt data with node_encrypt.
@@ -16,7 +16,7 @@
1616

1717
def simple_encrypt(content)
1818
certname = closure_scope['clientcert']
19-
PuppetX::Binford2k::NodeEncrypt.encrypt(content, certname)
19+
PuppetX::Puppetlabs::NodeEncrypt.encrypt(content, certname)
2020
end
2121

2222
def sensitive_encrypt(content)

lib/puppet/parser/functions/node_encrypt.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative '../../../puppet_x/binford2k/node_encrypt'
3+
require_relative '../../../puppet_x/puppetlabs/node_encrypt'
44

55
Puppet::Parser::Functions.newfunction(:node_encrypt,
66
type: :rvalue,
@@ -14,5 +14,5 @@
1414
content = content.unwrap if defined?(Puppet::Pops::Types::PSensitiveType::Sensitive) && content.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)
1515

1616
certname = lookupvar('clientcert')
17-
PuppetX::Binford2k::NodeEncrypt.encrypt(content, certname)
17+
PuppetX::Puppetlabs::NodeEncrypt.encrypt(content, certname)
1818
end

lib/puppet_x/binford2k/node_encrypt.rb lib/puppet_x/puppetlabs/node_encrypt.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module PuppetX
4-
module Binford2k
4+
module Puppetlabs
55
class NodeEncrypt # rubocop:disable Style/Documentation
66
def self.encrypted?(data)
77
raise ArgumentError, 'Only strings can be encrypted' unless data.instance_of?(String)

spec/classes/certificates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'spec_helper'
4-
require 'puppet_x/binford2k/node_encrypt'
4+
require 'puppet_x/puppetlabs/node_encrypt'
55

66
describe 'node_encrypt::certificates' do
77
before(:each) do

spec/defines/file_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'spec_helper'
4-
require 'puppet_x/binford2k/node_encrypt'
4+
require 'puppet_x/puppetlabs/node_encrypt'
55

66
describe 'node_encrypt::file' do
77
context 'when ensuring present' do
@@ -48,7 +48,7 @@
4848
end
4949

5050
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')
5252
end
5353

5454
it {

spec/functions/node_encrypt_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'spec_helper'
4-
require 'puppet_x/binford2k/node_encrypt'
4+
require 'puppet_x/puppetlabs/node_encrypt'
55

66
describe 'node_encrypt' do
77
let(:node) { 'testhost.example.com' }
@@ -11,13 +11,13 @@
1111
end
1212

1313
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')
1515
expect(scope.function_node_encrypt(['foobar'])).to eq('encrypted')
1616
end
1717

1818
if defined?(Puppet::Pops::Types::PSensitiveType::Sensitive)
1919
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')
2121
expect(scope.function_node_encrypt([Puppet::Pops::Types::PSensitiveType::Sensitive.new('foobar')])).to eq('encrypted')
2222
end
2323
end

spec/unit/puppet_x/binford2k/node_encrypt_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'openssl'
44
require 'spec_helper'
5-
require 'puppet_x/binford2k/node_encrypt'
5+
require 'puppet_x/puppetlabs/node_encrypt'
66

77
ca_crt_pem = "-----BEGIN CERTIFICATE-----
88
MIIGGjCCBAKgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMVgwVgYDVQQDDE9QdXBw
@@ -252,7 +252,7 @@
252252
uSI28VzZYavkITj+2D6tMys=
253253
-----END PKCS7-----"
254254

255-
describe PuppetX::Binford2k::NodeEncrypt do
255+
describe PuppetX::Puppetlabs::NodeEncrypt do
256256
let(:node) { 'testhost.example.com' }
257257

258258
it 'decrypts values which have been encrypted' do

0 commit comments

Comments
 (0)