Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .project

This file was deleted.

2 changes: 1 addition & 1 deletion lib/facter/rhsm_identity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Facter::Util::RhsmIdentity
module_function

def rhsm_identity
value = nil
value = ''
begin
output = Facter::Core::Execution.execute(
'/usr/sbin/subscription-manager identity',
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/rhsm_register/subscription_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def unregister
# trigger actions related to registration on update of the properties
def flush
if exists?
if identity.nil? || identity == :absent
if identity.nil? || identity == '' || identity == :absent
# no valid registration
elsif @property_hash[:name] && @property_hash[:name] != (@resource[:name])
# changing servers
Expand Down Expand Up @@ -138,7 +138,7 @@ def self.registration_settings
registration[:name] = ca_name
end
id = identity
if id
if !id.to_s.empty?
# propertly registered
registration[:identity] = id
registration[:ensure] = :present
Expand Down
6 changes: 3 additions & 3 deletions spec/facter/util/rhsm_identity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
end
it 'returns the nothing for no data' do
expect(Facter::Core::Execution).to receive(:execute).and_return('')
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq(nil)
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq('')
end
it 'returns the nothing for no command' do
expect(Facter::Core::Execution).to receive(:execute).and_return(nil)
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq(nil)
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq('')
end
it 'returns the nothing for an error' do
expect(Facter::Core::Execution).to receive(:execute) {
throw Facter::Core::Execution::ExecutionFailure
}
expect(Facter).to receive(:debug)
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq(nil)
expect(Facter::Util::RhsmIdentity.rhsm_identity).to eq('')
end
end