File tree Expand file tree Collapse file tree 6 files changed +16
-21
lines changed
Expand file tree Collapse file tree 6 files changed +16
-21
lines changed Original file line number Diff line number Diff line change 66# Note that changes in the inspected code, or installation of new
77# versions of RuboCop, may require this file to be generated again.
88
9- # Offense count: 8
10- # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
11- # SupportedStyles: always, named_only
12- RSpec/NamedSubject :
13- Exclude :
14- - ' spec/classes/certificates_spec.rb'
15- - ' spec/classes/redact_spec.rb'
16-
179# Offense count: 1
1810# This cop supports unsafe autocorrection (--autocorrect-all).
1911# Configuration parameters: EnforcedStyle.
Original file line number Diff line number Diff line change @@ -99,8 +99,6 @@ extra_gemfiles = [
9999extra_gemfiles . each do |gemfile |
100100 next unless File . file? ( gemfile ) && File . readable? ( gemfile )
101101
102- # rubocop:disable Security/Eval
103- eval ( File . read ( gemfile ) , binding )
104- # rubocop:enable Security/Eval
102+ eval ( File . read ( gemfile ) , binding ) # rubocop:disable Security/Eval
105103end
106104# vim: syntax=ruby
Original file line number Diff line number Diff line change 88 This function simply encrypts the String or Sensitive passed to it using the certificate
99 belonging to the client the catalog is being compiled for.
1010 DOC
11- ) do |args |
11+ ) do |args |
1212 content = args . first
1313 content = content . unwrap if defined? ( Puppet ::Pops ::Types ::PSensitiveType ::Sensitive ) && content . is_a? ( Puppet ::Pops ::Types ::PSensitiveType ::Sensitive )
1414
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module PuppetX
4- class NodeEncrypt # rubocop:disable Style/Documentation
4+ # Helper class for encrypting and decrypting data for nodes
5+ class NodeEncrypt
56 def self . encrypted? ( data )
67 raise ArgumentError , 'Only strings can be encrypted' unless data . instance_of? ( String )
78
Original file line number Diff line number Diff line change 44require 'puppet_x/node_encrypt'
55
66describe 'node_encrypt::certificates' do
7+ subject ( :node_encrypt_certificates ) { catalogue }
8+
79 before ( :each ) do
810 Puppet [ :ca_server ] = 'ca.example.com'
911 Puppet [ :confdir ] = '/etc/puppetlabs/puppet'
2325 end
2426
2527 it {
26- expect ( subject ) . to contain_ini_setting ( 'public certificates mountpoint path' ) . with (
28+ expect ( node_encrypt_certificates ) . to contain_ini_setting ( 'public certificates mountpoint path' ) . with (
2729 {
2830 ensure : 'present' ,
2931 path : '/etc/puppetlabs/puppet/fileserver.conf' ,
3335 }
3436
3537 it {
36- expect ( subject ) . to contain_puppet_authorization__rule ( 'public certificates mountpoint whitelist' ) . with (
38+ expect ( node_encrypt_certificates ) . to contain_puppet_authorization__rule ( 'public certificates mountpoint whitelist' ) . with (
3739 {
3840 match_request_path : '^/puppet/v3/file_(metadata|content)s?/public_certificates' ,
3941 match_request_type : 'regex' ,
6062 it { is_expected . not_to contain_ini_setting ( 'public certificates mountpoint whitelist' ) }
6163
6264 it {
63- expect ( subject ) . to contain_file ( '/etc/puppetlabs/puppet/ssl/certs' ) . with (
65+ expect ( node_encrypt_certificates ) . to contain_file ( '/etc/puppetlabs/puppet/ssl/certs' ) . with (
6466 {
6567 ensure : 'directory' ,
6668 source : 'puppet://ca.example.com/public_certificates/'
Original file line number Diff line number Diff line change 33require 'spec_helper'
44
55describe 'redact' do
6+ subject ( :function_redact ) { catalogue }
7+
68 let ( :node ) { 'test.example.com' }
79 let ( :facts ) do
810 {
1820 end
1921
2022 it {
21- expect ( subject ) . to contain_class ( 'redact' ) . with (
23+ expect ( function_redact ) . to contain_class ( 'redact' ) . with (
2224 {
2325 param : 'a param' ,
2426 redacted : '<<redacted>>' ,
2830 }
2931
3032 it {
31- expect ( subject ) . to contain_redact__thing ( 'one' ) . with (
33+ expect ( function_redact ) . to contain_redact__thing ( 'one' ) . with (
3234 {
3335 param : 'a param' ,
3436 redacted : '<<redacted>>' ,
3840 }
3941
4042 it {
41- expect ( subject ) . to contain_redact__thing ( 'two' ) . with (
43+ expect ( function_redact ) . to contain_redact__thing ( 'two' ) . with (
4244 {
4345 param : 'a param' ,
4446 redacted : '<<redacted>>' ,
4850 }
4951
5052 it {
51- expect ( subject ) . to contain_redact__thing ( 'three' ) . with (
53+ expect ( function_redact ) . to contain_redact__thing ( 'three' ) . with (
5254 {
5355 param : 'a param' ,
5456 redacted : '<<redacted>>' ,
5860 }
5961
6062 it {
61- expect ( subject ) . to contain_redact__thing ( 'four' ) . with (
63+ expect ( function_redact ) . to contain_redact__thing ( 'four' ) . with (
6264 {
6365 param : 'a param' ,
6466 redacted : '<<redacted>>' ,
You can’t perform that action at this time.
0 commit comments