Commit 89fa64db authored by Ad Schellevis's avatar Ad Schellevis

(mvc) BaseModel add getVersion() to retrieve the running config version,...

(mvc) BaseModel add getVersion() to retrieve the running config version, commit changes to in memory config after every migration step.

Errors will be send to syslog, current policy is to always upgrade and ignore migration errors.
(there's not really a way back, other then undo pkg install and revert the full config)
parent aaa0ddaf
...@@ -541,6 +541,7 @@ abstract class BaseModel ...@@ -541,6 +541,7 @@ abstract class BaseModel
$migobj = $mig_class->newInstance(); $migobj = $mig_class->newInstance();
try { try {
$migobj->run($this); $migobj->run($this);
$this->serializeToConfig();
} catch (\Exception $e) { } catch (\Exception $e) {
$logger->error("failed migrating from version " . $logger->error("failed migrating from version " .
$this->internal_current_model_version . $this->internal_current_model_version .
...@@ -554,4 +555,13 @@ abstract class BaseModel ...@@ -554,4 +555,13 @@ abstract class BaseModel
} }
} }
} }
/**
* return current version number
* @return null|string
*/
public function getVersion()
{
return $this->internal_current_model_version;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment