diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2024-01-16 12:52:26 +0000 | 
|---|---|---|
| committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2024-01-16 12:52:26 +0000 | 
| commit | 813237d9766f636394b9ab385bb825fbf83202b3 (patch) | |
| tree | de236269f6e20abc6a85cf01d104b8e80a16a550 | |
| parent | 9171b2912a6adbe88de4eeacbcc83cea5c941e48 (diff) | |
| download | vyos-1x-813237d9766f636394b9ab385bb825fbf83202b3.tar.gz vyos-1x-813237d9766f636394b9ab385bb825fbf83202b3.zip | |
T5889: Fix migration scripts nat 5-to-6
The current migration drop interface name for NAT where not should
```
nat {
    source {
        rule 100 {
            outbound-interface {
                name "eth0"
        ...
        }
    }
}
```
After migration we lost interface:
/home/vyos# /opt/vyatta/etc/config-migrate/migrate/nat/5-to-6 tmp.conf
/home/vyos#
/home/vyos# cat tmp.conf | grep "nat {" -A 10
nat {
    source {
        rule 100 {
            outbound-interface {
                interface-name ""
         ...
        }
    }
}
```
This commit fixes it.
| -rwxr-xr-x | src/migration-scripts/nat/5-to-6 | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/src/migration-scripts/nat/5-to-6 b/src/migration-scripts/nat/5-to-6 index de3830582..c83b93d84 100755 --- a/src/migration-scripts/nat/5-to-6 +++ b/src/migration-scripts/nat/5-to-6 @@ -51,8 +51,9 @@ for direction in ['source', 'destination']:          for iface in ['inbound-interface','outbound-interface']:              if config.exists(base + [iface]):                  tmp = config.return_value(base + [iface]) -                config.delete(base + [iface]) -                config.set(base + [iface, 'interface-name'], value=tmp) +                if tmp: +                    config.delete(base + [iface]) +                    config.set(base + [iface, 'interface-name'], value=tmp)  try:      with open(file_name, 'w') as f: | 
