summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-08-16 10:53:18 -0700
committerGitHub <noreply@github.com>2021-08-16 10:53:18 -0700
commit8f4fcb9188da05973f8f2530243e43d42cf33246 (patch)
tree476a8633df5d385fd9ad0e579fb0ada7010d9ce0 /lib/chef
parent15541a8a549db0117d52faefd31fec6d76e822ad (diff)
parentdc275631251323d9ab82dfd65347738ef25c2e20 (diff)
downloadchef-8f4fcb9188da05973f8f2530243e43d42cf33246.tar.gz
Merge pull request #11534 from jasonwbarnett/flush-cache-after-subscription-is-added
Flush package cache after attaching to rhsm subscription
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/resource/rhsm_subscription.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/resource/rhsm_subscription.rb b/lib/chef/resource/rhsm_subscription.rb
index 5ae04bbfcd..d4eb49250b 100644
--- a/lib/chef/resource/rhsm_subscription.rb
+++ b/lib/chef/resource/rhsm_subscription.rb
@@ -32,11 +32,11 @@ class Chef
name_property: true
action :attach, description: "Attach the node to a subscription pool." do
- execute "Attach subscription pool #{new_resource.pool_id}" do
- command "subscription-manager attach --pool=#{new_resource.pool_id}"
- default_env true
- action :run
- not_if { subscription_attached?(new_resource.pool_id) }
+ unless subscription_attached?(new_resource.pool_id)
+ converge_by("attach subscription pool #{new_resource.pool_id}") do
+ shell_out!("subscription-manager attach --pool=#{new_resource.pool_id}")
+ build_resource(:package, "rhsm_subscription-#{new_resource.pool_id}-flush_cache").run_action(:flush_cache)
+ end
end
end