|
@@ -61,35 +61,50 @@ EOT
|
|
'password' => $input->getOption('api-password'),
|
|
'password' => $input->getOption('api-password'),
|
|
];
|
|
];
|
|
|
|
|
|
|
|
+ // deshabilito filtros, entre ellos soft_delete
|
|
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
|
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
|
- if ($this->cablemodem = $em->getRepository('CablemodemBundle:Cablemodem')->findOneByMac($this->mac)) {
|
|
|
|
|
|
+ $filters = $em->getFilters();
|
|
|
|
+ $enabledFilters = $filters->getEnabledFilters();
|
|
|
|
+ foreach ($enabledFilters as $filter_name => $filter) {
|
|
|
|
+ $filters->disable($filter_name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $this->cablemodem = $em->getRepository('CablemodemBundle:Cablemodem')->findOneByMac($this->mac);
|
|
|
|
+ if ($this->cablemodem) {
|
|
// Crea el Host
|
|
// Crea el Host
|
|
- $this->io->section('Creating DHCP Host');
|
|
|
|
|
|
+ if ($this->input->getOption('delete') != true) {
|
|
|
|
+ $this->io->section('Creating or updating DHCP Host');
|
|
|
|
+ } else {
|
|
|
|
+ $this->io->section('Deleting DHCP Host if exists');
|
|
|
|
+ }
|
|
$this->io->success('RESULT: ' . $this->createHost());
|
|
$this->io->success('RESULT: ' . $this->createHost());
|
|
|
|
|
|
// Crea o elimina si existe el Host CPE
|
|
// Crea o elimina si existe el Host CPE
|
|
$cpeFixedIP = $this->cablemodem->getCpeFixedIP();
|
|
$cpeFixedIP = $this->cablemodem->getCpeFixedIP();
|
|
if ($cpeFixedIP) {
|
|
if ($cpeFixedIP) {
|
|
- $this->io->section('Creating DHCP CPE Host');
|
|
|
|
|
|
+ $this->io->section('Creating or updating DHCP CPE Host');
|
|
$this->io->success('RESULT: ' . $this->createHost('cpe'));
|
|
$this->io->success('RESULT: ' . $this->createHost('cpe'));
|
|
} else {
|
|
} else {
|
|
- $this->io->section('Deleting DHCP CPE Host');
|
|
|
|
|
|
+ $this->io->section('Deleting DHCP CPE Host if exists');
|
|
$this->io->success('RESULT: ' . $this->deleteHost('cpe'));
|
|
$this->io->success('RESULT: ' . $this->deleteHost('cpe'));
|
|
}
|
|
}
|
|
|
|
|
|
// Crea o elimina si existe el Host MTA
|
|
// Crea o elimina si existe el Host MTA
|
|
$mtaFixedIP = $this->cablemodem->getMtaFixedIP();
|
|
$mtaFixedIP = $this->cablemodem->getMtaFixedIP();
|
|
if ($mtaFixedIP) {
|
|
if ($mtaFixedIP) {
|
|
- $this->io->section('Creating DHCP MTA Host');
|
|
|
|
|
|
+ $this->io->section('Creating or updating DHCP MTA Host');
|
|
$this->io->success('RESULT: ' . $this->createHost('mta'));
|
|
$this->io->success('RESULT: ' . $this->createHost('mta'));
|
|
} else {
|
|
} else {
|
|
- $this->io->section('Deleting DHCP MTA Host');
|
|
|
|
|
|
+ $this->io->section('Deleting DHCP MTA Host if exists');
|
|
$this->io->success('RESULT: ' . $this->deleteHost('mta'));
|
|
$this->io->success('RESULT: ' . $this->deleteHost('mta'));
|
|
}
|
|
}
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
$output->writeln("<error>Cablemodem mac {$this->mac} not found</error>");
|
|
$output->writeln("<error>Cablemodem mac {$this->mac} not found</error>");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ foreach ($enabledFilters as $filter_name => $filter) {
|
|
|
|
+ $filters->enable($filter_name);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|