Skip to content

Commit 4ba189f

Browse files
committed
prevent failures when caching non-existing rhsm_identity
1 parent 70812c8 commit 4ba189f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/facter/rhsm_identity.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module Facter::Util::RhsmIdentity
2929
module_function
3030

3131
def rhsm_identity
32-
value = nil
32+
value = ''
3333
begin
3434
output = Facter::Core::Execution.execute(
3535
'/usr/sbin/subscription-manager identity',

spec/facter/util/rhsm_identity_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@
4646
end
4747
it 'returns the nothing for no data' do
4848
expect(Facter::Core::Execution).to receive(:execute).and_return('')
49-
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq(nil)
49+
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq('')
5050
end
5151
it 'returns the nothing for no command' do
5252
expect(Facter::Core::Execution).to receive(:execute).and_return(nil)
53-
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq(nil)
53+
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq('')
5454
end
5555
it 'returns the nothing for an error' do
5656
expect(Facter::Core::Execution).to receive(:execute) {
5757
throw Facter::Core::Execution::ExecutionFailure
5858
}
5959
expect(Facter).to receive(:debug)
60-
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq(nil)
60+
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq('')
6161
end
6262
end

0 commit comments

Comments
 (0)