summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@sentrium.io>2019-06-06 09:16:59 -0500
committerGitHub <noreply@github.com>2019-06-06 09:16:59 -0500
commit4998359981fea5e0cabda9f685a0a20d57d44163 (patch)
tree7d912fa34cc49f5bbdaac3c9a6f1cf7435c678c6
parentec0d803a673a85e1159305fcab335679b9fad720 (diff)
parente4fe8143d9a9d86eafe04fed3cd788659b46f465 (diff)
downloadvyatta-cfg-4998359981fea5e0cabda9f685a0a20d57d44163.tar.gz
vyatta-cfg-4998359981fea5e0cabda9f685a0a20d57d44163.zip
Merge pull request #18 from jestabro/config-migrate
T1334: Migration script runner rewrite
-rwxr-xr-xscripts/init/vyos-router4
-rwxr-xr-xscripts/vyatta-load-config.pl7
-rwxr-xr-xscripts/vyatta-save-config.pl4
-rw-r--r--src/cparse/cparse_lex.l3
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;
}