Skip to content

Commit 968a8ac

Browse files
Merge pull request #1429 from andeman/main
fix Error: Transaction store file transactionstore.yaml is corrupt
2 parents 77cce4e + 86a2f64 commit 968a8ac

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lib/puppet/provider/mysql_login_path/sensitive.rb

+5
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ class Puppet::Provider::MysqlLoginPath::Sensitive < Puppet::Pops::Types::PSensit
66
def ==(other)
77
return true if other.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive) && unwrap == other.unwrap
88
end
9+
10+
def encode_with(coder)
11+
coder.tag = nil
12+
coder.scalar = 'Puppet::Provider::MysqlLoginPath::Sensitive <<encrypted>>'
13+
end
914
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
ensure_module_defined('Puppet::Provider::MysqlLoginPath')
6+
require 'puppet/provider/mysql_login_path/sensitive'
7+
require 'psych'
8+
9+
RSpec.describe Puppet::Provider::MysqlLoginPath::Sensitive do
10+
subject(:sensitive) { described_class.new('secret') }
11+
12+
describe 'Puppet::Provider::MysqlLoginPath::Sensitive' do
13+
it 'encodes its value correctly into transactionstore.yaml' do
14+
psych_encoded = Psych.load(Psych.dump(sensitive))
15+
expect(psych_encoded).to eq 'Puppet::Provider::MysqlLoginPath::Sensitive <<encrypted>>'
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)