diff options
author | John Estabrook <jestabro@sentrium.io> | 2019-06-06 09:16:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-06 09:16:59 -0500 |
commit | 4998359981fea5e0cabda9f685a0a20d57d44163 (patch) | |
tree | 7d912fa34cc49f5bbdaac3c9a6f1cf7435c678c6 | |
parent | ec0d803a673a85e1159305fcab335679b9fad720 (diff) | |
parent | e4fe8143d9a9d86eafe04fed3cd788659b46f465 (diff) | |
download | vyatta-cfg-4998359981fea5e0cabda9f685a0a20d57d44163.tar.gz vyatta-cfg-4998359981fea5e0cabda9f685a0a20d57d44163.zip |
Merge pull request #18 from jestabro/config-migrate
T1334: Migration script runner rewrite
-rwxr-xr-x | scripts/init/vyos-router | 4 | ||||
-rwxr-xr-x | scripts/vyatta-load-config.pl | 7 | ||||
-rwxr-xr-x | scripts/vyatta-save-config.pl | 4 | ||||
-rw-r--r-- | src/cparse/cparse_lex.l | 3 |
4 files changed, 13 insertions, 5 deletions
diff --git a/scripts/init/vyos-router b/scripts/init/vyos-router index a211795..e9a8cae 100755 --- a/scripts/init/vyos-router +++ b/scripts/init/vyos-router @@ -83,9 +83,9 @@ init_bootfile () { # if necessary, migrate initial config migrate_bootfile () { - if [ -x $vyatta_sbindir/vyatta_config_migrate.pl ]; then + if [ -x $vyos_libexec_dir/run-config-migration.py ]; then log_progress_msg migrate - sg ${GROUP} -c "$vyatta_sbindir/vyatta_config_migrate.pl $BOOTFILE" + sg ${GROUP} -c "$vyos_libexec_dir/run-config-migration.py $BOOTFILE" fi } diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index c52851c..d432af9 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -38,6 +38,7 @@ my $sbindir = $ENV{vyatta_sbindir}; my $bootpath = $etcdir . "/config"; my $load_file = $bootpath . "/config.boot"; my $url_tmp_file = $bootpath . "/config.boot.$$"; +my $vyos_libexec_dir = $ENV{vyos_libexec_dir}; # @@ -169,6 +170,10 @@ while (<$cfg>) { $valid_cfg = 1; last; } + elsif (/vyos-config-version/) { + $valid_cfg = 1; + last; + } } if ( $xorp_cfg or !$valid_cfg ) { if ($xorp_cfg) { @@ -191,7 +196,7 @@ my $login = getlogin() || getpwuid($<) || "unknown"; syslog( "warning", "Load config [$orig_load_file] by $login" ); # do config migration -system("$sbindir/vyatta_config_migrate.pl $load_file"); +system("$vyos_libexec_dir/run-config-migration.py $load_file"); # note: "load" is now handled in the backend so only "merge" is actually # handled in this script. "merge" hasn't been moved into the backend since diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl index 0799dd4..19941a7 100755 --- a/scripts/vyatta-save-config.pl +++ b/scripts/vyatta-save-config.pl @@ -77,7 +77,7 @@ if ($mode eq 'local' and !($save_file =~ /^\//)) { $save_file = "$bootpath/$save_file"; } -my $version_str = `/opt/vyatta/sbin/vyatta_current_conf_ver.pl`; +my $version_str = `/usr/libexec/vyos/system-versions-foot.py`; # when presenting to users, show shortened /config path my $shortened_save_file = get_short_config_path($save_file); @@ -88,7 +88,7 @@ if ($mode eq 'local') { # first check if this file exists, and if so ensure this is a config file. if (-e $save_file) { - my $result = `grep ' === vyatta-config-version:' $save_file`; + my $result = `grep -e ' === vyatta-config-version:' -e '// vyos-config-version:' $save_file`; if (!defined $result || length($result) == 0) { print "File exists and is not a Vyatta configuration file, aborting save!\n"; exit 1; diff --git a/src/cparse/cparse_lex.l b/src/cparse/cparse_lex.l index 8fcd5f3..462c558 100644 --- a/src/cparse/cparse_lex.l +++ b/src/cparse/cparse_lex.l @@ -115,6 +115,9 @@ free_str() return COMMENT; } +"//".* { /* Do nothing. */ +} + <INITIAL>! { node_deactivated = 1; } |