waveclaw / puppet-subscription_manager

Handle Client Registration to RedHat Satellite 6 or Katello
https://rhn.redhat.com
Other
6 stars 34 forks source link

Do not create rhsm_repo instances for invalid repos #86

Closed treydock closed 4 years ago

treydock commented 4 years ago

I ran into issues where locks in Satellite would produce errors in subscription-manager and the parsed repo was empty Hash and breaking Puppet.

I use this:

resources { 'rhsm_repo': purge => true }

And got this:

2019-09-17 10:55:05 -0400 /Stage[main]/Satellite::Yumrepos::Redhat/Resources[rhsm_repo] (err): Failed to generate additional resources using 'generate': No resource and no name in property hash in subscription_manager instance

Debug output that shows the issue:

2019-09-17 10:54:58 -0400 Puppet (debug): Executing: '/sbin/subscription-manager repos'
2019-09-17 10:55:05 -0400 Puppet (debug): REPOS: Internal Server Error): Required lock is already taken by other running tasks.
Please inspect their state, fix their errors and resume them.

Required lock: update
Conflicts with tasks:
  https://satellite<OMIT>/foreman_tasks/tasks/37265fb0 7a8f 4b6d aa30 5e5facd82370

+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+

<SNIP>

2019-09-17 10:55:05 -0400 Puppet (debug): PARSED REPO: {}
2019-09-17 10:55:05 -0400 Puppet (debug): PARSED REPO: {}

<SNIP>
ManfredP commented 4 years ago

Good to hear, that I'm not the only one having conflicting tasks during repo queries. I had the same problem, fixed it in a similar way, came here to file a PR and saw that there is already one open. Nice work, I hope it will get merged soon.

wilrodriguez commented 4 years ago

Sweet. I have this problem too. I'm also looking to try and make a change so that it'll rely on its fact cache if it exists instead of querying, which I think might actually be causing some of the additional load on our satellite, resulting in some of these errors.