Skip to content

Commit

Permalink
Merge branch 'treydock-fix-pool'
Browse files Browse the repository at this point in the history
  • Loading branch information
waveclaw committed Apr 29, 2020
2 parents 490a937 + 5b8a6af commit 9015f62
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/rhsm_pool/subscription_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ def self.consumed_pools
subscription.store(:active, value)
next
end
m = %r{^\s*System Type:\s*([^:]+)$}.match(line)
m = %r{^\s*(System|Entitlement) Type:\s*([^:]+)$}.match(line)
unless m.nil?
value = m[1].strip.to_sym
value = m[2].strip.to_sym
subscription.store(:system_type, value)
# this is the last item output
subscription.store(:provider, :subscription_manager)
Expand Down
15 changes: 15 additions & 0 deletions spec/unit/provider/rhsm_pool/subscription_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
System Type: Physical
EOD

entitlement_data = raw_data.sub('System Type','Entitlement Type')

title1 = '1a2b3c4d5e6f1234567890abcdef12345'
title2 = '1234abc'

Expand All @@ -60,6 +62,7 @@
provider: :subscription_manager,
}


provider_class = Puppet::Type.type(:rhsm_pool).provider(:subscrption_manager)

describe provider_class, '#rhsm_pool.provider' do
Expand Down Expand Up @@ -173,6 +176,18 @@
end
end

describe 'system_type on RHEL 7.8 as entitlement_type' do
it 'prefetches the data' do
expect(provider.class).to respond_to(:prefetch)
end
it 'but returns system_type instead for consistency with legacy' do
expect(provider.class).to receive(:subscription_manager).with(
'list', '--consumed'
).and_return(entitlement_data)
provider.class.prefetch(properties)
end
end

context 'ensure' do
it 'exists? should return false when the resource is absent' do
provider.set(ensure: :absent)
Expand Down

0 comments on commit 9015f62

Please sign in to comment.