Skip to content

Commit

Permalink
config: don't use notices in early/low level code
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Nov 12, 2015
1 parent 59b865c commit 435e47e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/etc/inc/config.lib.inc
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ function parse_config()
$backups = $cnf->getBackups();
if (count($backups) > 0) {
// load last backup
syslog(LOG_ERR, sprintf('parse_config(): %s', gettext('No (valid) config.xml found, attempting last known config restore.')));
file_notice("config.xml", gettext("No (valid) config.xml found, attempting last known config restore."), "OPNsenseConfigurator", "");
syslog(LOG_ERR, gettext('No valid config.xml found, attempting last known config restore.'));
$cnf->restoreBackup($backups[0]);
} else {
// we don't have backups, try to load the default
syslog(LOG_ERR, sprintf('parse_config(): %s', gettext('No config.xml found, attempting to restore factory config.')));
syslog(LOG_ERR, gettext('No valid config.xml found, attempting to restore factory config.'));
$cnf->restoreBackup('/usr/local/etc/config.xml');
}
}
Expand Down Expand Up @@ -195,8 +194,7 @@ function write_config($desc = 'Unknown', $backup = true)
$cnf->save($revision_info, $backup);
} catch (OPNsense\Core\ConfigException $e) {
// write failure
log_error(gettext("WARNING: Config contents could not be saved. Could not open file!"));
file_notice('config.xml', sprintf("%s\n", gettext('Unable to open /conf/config.xml for writing in write_config()')));
syslog(LOG_ERR, gettext('WARNING: Config contents could not be saved. Could not open file!'));
return -1;
}

Expand Down

0 comments on commit 435e47e

Please sign in to comment.