ImportJob: remove import-source related logic
This commit is contained in:
parent
c6c3543e5a
commit
47b9da3be0
|
@ -4,7 +4,6 @@ namespace Icinga\Module\Director\Job;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Module\Director\Hook\JobHook;
|
use Icinga\Module\Director\Hook\JobHook;
|
||||||
use Icinga\Module\Director\Import\Import;
|
|
||||||
use Icinga\Module\Director\Objects\ImportSource;
|
use Icinga\Module\Director\Objects\ImportSource;
|
||||||
use Icinga\Module\Director\Web\Form\QuickForm;
|
use Icinga\Module\Director\Web\Form\QuickForm;
|
||||||
|
|
||||||
|
@ -25,27 +24,10 @@ class ImportJob extends JobHook
|
||||||
|
|
||||||
protected function runForSource(ImportSource $source)
|
protected function runForSource(ImportSource $source)
|
||||||
{
|
{
|
||||||
$import = new Import($source);
|
if ($this->getSetting('run_import') === 'y') {
|
||||||
try {
|
$source->runImport();
|
||||||
if ($import->providesChanges()) {
|
} else {
|
||||||
|
$source->checkForChanges();
|
||||||
if ($this->getSetting('run_import') === 'y') {
|
|
||||||
if ($import->run()) {
|
|
||||||
$source->import_state = 'in-sync';
|
|
||||||
} else {
|
|
||||||
$source->import_state = 'failing';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$source->import_state = 'pending-changes';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$source->import_state = 'failing';
|
|
||||||
$source->last_error_message = $e->getMessage();
|
|
||||||
}
|
|
||||||
if ($source->hasBeenModified()) {
|
|
||||||
$source->store();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue