Skip to content

Commit f3dc01f

Browse files
author
Andreas Stuerz
committed
fix Error: Transaction store file /opt/puppetlabs/puppet/cache/state/transactionstore.yaml is corrupt
1 parent 236e5a8 commit f3dc01f

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/puppet/provider/mysql_login_path/sensitive.rb

Lines changed: 5 additions & 0 deletions
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 = 'PPuppet::Provider::MysqlLoginPath::Sensitive <<encrypted>>'
13+
end
914
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
require 'puppet/provider/mysql_login_path/sensitive'
5+
require 'psych'
6+
7+
RSpec.describe Puppet::Provider::MysqlLoginPath::Sensitive do
8+
subject(:sensitive) { described_class.new('secret') }
9+
10+
describe 'Puppet::Provider::MysqlLoginPath::Sensitive' do
11+
it 'encodes its value correctly into transactionstore.yaml' do
12+
psych_encoded = Psych.load(Psych.dump(sensitive))
13+
expect(psych_encoded).to eq 'Puppet::Provider::MysqlLoginPath::Sensitive <<encrypted>>'
14+
end
15+
end
16+
end

0 commit comments

Comments
 (0)