#2313 PR merged: Cleanup and enhance 320_migrate_network_configuration_files.sh (issue 2310)

Labels: enhancement, bug, cleanup, fixed / solved / done

jsmeix opened issue at 2020-01-15 16:08:

Just an initial "submit early submit often" part of today.
More will come tomorrow.
Not yet tested at all (only bash -n does not show a syntax error).
Currently it is an incomplete first part up to the line

# change the ip addresses in the configuration files if a mapping is available

of a general cleanup as first step which I do primarily
to get some basic understanding of the code.
Not yet any actual enhancement (that will be the second step).

  • Brief description of the changes in this pull request:

Overhaul 320_migrate_network_configuration_files.sh
to make it working sufficiently with nowadays network ifcfg file syntax, cf.
https://github.com/rear/rear/issues/2310#issuecomment-574574414

jsmeix commented at 2020-01-17 13:43:

Only FYI:
Nothing more for this week - continuing next week...
Have a nice weekend!

jsmeix commented at 2020-01-29 16:24:

Hmmm...
That thingy gets bigger and bigger and still not finished.
I wonder if I do it actually right (overengineering?)

For the fun of it:
Currently there are 427-155=272 more lines
consisting of 182-39=143 more comment lines
and 272-143=129 more lines of actual code
so 52% of the 272 more lines are comments where
comments increased from 39 to 182 i.e. 4.66 times more comments
and actual code increased from 155-39=116 lines to 427-182=245 lines
which is 2.11 times more actual code.

jsmeix commented at 2020-02-07 10:47:

I also marked it as "bug" because I found a few places
where - as far as I can understand the code - it could not work.

jsmeix commented at 2020-02-07 14:49:

So I have now cleaned up and enhanced the whole
320_migrate_network_configuration_files.sh code
plus some bugfixes
BUT
nothing is tested yet.

mutable-dan commented at 2020-02-07 15:15:

will test on s390

jsmeix commented at 2020-02-07 15:24:

@mutable-dan
thank you for testing it.

@rmetrich @pcahyna @gozora @gdha @schabrolles
as time permits you may have a look here
perhaps you even notice errors by plain looking at my code
https://github.com/rear/rear/blob/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

In particular I won't find time to test it
on Red Hat or Debian/Ubuntu.

gozora commented at 2020-02-19 08:29:

I'll can test on Debian through this weekend (22-23 Feb 2020).

V.

jsmeix commented at 2020-02-19 10:20:

@gozora
thank you for testing it.

pcahyna commented at 2020-02-19 20:22:

Cc @yontalcar

jsmeix commented at 2020-03-02 13:06:

@gozora
thank you for your test!

jsmeix commented at 2020-03-02 13:10:

@yontalcar
would you test it for Red Hat?
Or could you have a look at the code changes
perhaps you notice issues by plain looking at my changes?

jsmeix commented at 2020-03-02 13:18:

@tumbajamba
could you test if things work better for you with the current
320_migrate_network_configuration_files.sh
of this pull request here
https://raw.githubusercontent.com/rear/rear/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

I think your initial issue in
https://github.com/rear/rear/issues/2310#issue-549644154
should now be fixed (hopefully).

On a test system replace your
usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh
with the one of this pull request here
and then do a rear -D mkrescue/mkbackup
plus rear -D recover on another test system.

tumbajamba commented at 2020-03-02 13:35:

@tumbajamba
could you test if things work better for you with the current
320_migrate_network_configuration_files.sh
of this pull request here
https://raw.githubusercontent.com/rear/rear/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

I think your initial issue in
#2310 (comment)
should now be fixed (hopefully).

On a test system replace your
usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh
with the one of this pull request here
and then do a rear -D mkrescue/mkbackup
plus rear -D recover on another test system.

Hello @jsmeix

Thx for your work! Can I just copy the content of this link:
https://raw.githubusercontent.com/rear/rear/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

and save it as 320_migrate_network_configuration_files.sh

and just replace my current 320_migrate_network_configuration_files.sh with it. Is it correct?

Regards
Vadim

yontalcar commented at 2020-03-02 13:43:

@jsmeix
I'll take a look

jsmeix commented at 2020-03-02 14:04:

@tumbajamba
yes, replace your current
320_migrate_network_configuration_files.sh
with the content of
https://raw.githubusercontent.com/rear/rear/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

FYI in general regarding
Testing current ReaR upstream GitHub master code
see the section with that title in
https://en.opensuse.org/SDB:Disaster_Recovery

So in this particular case you could do on a test system (as root):

git clone https://github.com/rear/rear.git

mv rear rear.github.master

cd rear.github.master

mv usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh.original

wget -O usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh https://raw.githubusercontent.com/rear/rear/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

vi etc/rear/local.conf

usr/sbin/rear -D mkbackup

and then rear -D recover on another test system.

tumbajamba commented at 2020-03-02 14:08:

@tumbajamba
yes, replace your current
320_migrate_network_configuration_files.sh
with the content of
https://raw.githubusercontent.com/rear/rear/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

FYI in general regarding
Testing current ReaR upstream GitHub master code
see the section with that title in
https://en.opensuse.org/SDB:Disaster_Recovery

So in this particular case you could do on a test system (as root):

git clone https://github.com/rear/rear.git

mv rear rear.github.master

cd rear.github.master

mv usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh.original

wget -O usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh https://raw.githubusercontent.com/rear/rear/47e6a4c463e4cccaef700e6db62201510841c2ec/usr/share/rear/finalize/GNU/Linux/320_migrate_network_configuration_files.sh

vi etc/rear/local.conf

usr/sbin/rear -D mkbackup

and then rear -D recover on another test system.

Got it! Thx a lot, I'll give it a try tomorrow ;-)

jsmeix commented at 2020-03-05 09:14:

I added "needs sponsorship" (i.e. I need substantial help) because since
https://github.com/rear/rear/issues/2310#issuecomment-594591924
it does no longer look as if I could do that alone in a reasonable way.

jsmeix commented at 2020-03-09 16:15:

If there are no objections until this Friday (dated scary 13th of March ;-)
I would like to merge it as is because afterwards I would like
to further enhance it according to
https://github.com/rear/rear/issues/2312#issuecomment-574606451

a simple and generically working basic method
to set up networking at the end of "rear recover"
...
a new TARGET_SYSTEM_NETWORK_SETUP_COMMANDS
where the user can specify his particular comands to set up
networking at the end of "rear recover" as he needs it

jsmeix commented at 2020-03-13 13:26:

Phew!
Now it is merged.

Let's see how the new one behaves in real world practice.
Of course when there are issues I will try to fix them (as good as I can).

Thanks to all who helped here and
thanks in advance to all who will help in the future!


[Export of Github issue for rear/rear.]