Closed jreidinger closed 1 year ago
:heavy_check_mark: Public Jenkins job #321 successfully finished :heavy_check_mark: Created OBS submit request #1064238
:heavy_check_mark: Internal Jenkins job #216 successfully finished :heavy_check_mark: Created IBS submit request #289752
Problem
The issue is that bootloader ( yeah, not network ) crash with calling method on nil. Reason why it gets nil is that it failed to find
/etc/sysconfig/bootloader
. In logs I see several other failed reads e.g. to/etc/sysconfig/kdump
. When manually reproduce it I notice that files are there. So only idea is switched SCR. So I check when it was last changed and it was in save_network to local one, but not back. So problem is that network switch SCR to '/' and do not restore it back.Solution
Quickly from logs it is obvious that issue is at return from block at https://github.com/yast/yast-network/blob/master/src/lib/network/clients/save_network.rb#L98 where I though that return is from method and replace with break will fix it. But to be sure I write also test program. Another part is issue is that on_local method is not robust enough and e.g. if exception is returned it also do not get restore SCR chroot at https://github.com/yast/yast-network/blob/master/src/lib/network/clients/save_network.rb#L74 .
So to verify this ruby behavior I create testing program:
and get following output ( on both ruby 2.5 and ruby 3.1.2 ):
So conclusion for me is that replacing return with break does not help with skipping calls after
block.call
which really surprise me ( feel free to enlighten me why ). So only correct solution ( that is correct also to handle properly exceptions ) is to enclose restore of SCR to ensure block.Testing
Added a new unit testsadly save_network unit test is so messy and overmocked that I failed to test new behavior