rhsm_repository: Properly handle no repos (#51938)
When no repos are defined, the `repo` variable is undefined. Therefore
append it only to the result if a repo was found. Otherwise Ansible will
fail with an UnboundLocalError.
(cherry picked from commit 0469134f16
)
This commit is contained in:
parent
2d4096daf0
commit
6cef018b71
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/rhsm_repository-handle-no-repos.yml
Normal file
2
changelogs/fragments/rhsm_repository-handle-no-repos.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- rhsm_repository - handle systems without any repos
|
|
@ -156,7 +156,7 @@ def get_repository_list(module, list_parameter):
|
|||
"enabled": True if repo_enabled == '1' else False
|
||||
}
|
||||
|
||||
repo_result.append(repo)
|
||||
repo_result.append(repo)
|
||||
|
||||
return repo_result
|
||||
|
||||
|
|
Loading…
Reference in a new issue