mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Set firstrun to avoid use before definition (#4667)
* Set firstrun to avoid use before definition At the moment if zypper updates itself the parse_zypper_xml function calls itself with packages not None, but in check_mode zypper still needs to update itself -> rc = 103 and firstrun is undefined * Add changelog frament * Update changelogs/fragments/4651-zypper-checkmode-fix.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Georg Vogt <georg.vogt@tngtech.com> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
bb5dfef1cc
commit
aeeb09f0da
2 changed files with 4 additions and 0 deletions
2
changelogs/fragments/4651-zypper-checkmode-fix.yaml
Normal file
2
changelogs/fragments/4651-zypper-checkmode-fix.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- zypper - fix undefined variable when running in check mode (https://github.com/ansible-collections/community.general/pull/4667).
|
|
@ -323,6 +323,8 @@ def parse_zypper_xml(m, cmd, fail_not_found=True, packages=None):
|
||||||
if packages is None:
|
if packages is None:
|
||||||
firstrun = True
|
firstrun = True
|
||||||
packages = {}
|
packages = {}
|
||||||
|
else:
|
||||||
|
firstrun = False
|
||||||
solvable_list = dom.getElementsByTagName('solvable')
|
solvable_list = dom.getElementsByTagName('solvable')
|
||||||
for solvable in solvable_list:
|
for solvable in solvable_list:
|
||||||
name = solvable.getAttribute('name')
|
name = solvable.getAttribute('name')
|
||||||
|
|
Loading…
Reference in a new issue