Prechádzať zdrojové kódy

FD3-699 update comando para actualizar las dhcp options en host y subnet

Espinoza Guillermo 6 rokov pred
rodič
commit
a8fbcb7a55

+ 10 - 2
src/HostBundle/Command/DHCPOptionsUpdateCommand.php

@@ -42,7 +42,11 @@ EOT
         $result = $dhcpService->formatDhcpOptions($output);
         
         $io->newLine(2);
-        $io->success('Total entities updated: ' . $result);
+        if ($result == 0) {
+            $io->warning('Nothing to update');
+        } else {
+            $io->success('Total entities updated: ' . $result);
+        }
         $io->newLine(2);
         
         $io->section("Updating SubNet entities:");
@@ -50,7 +54,11 @@ EOT
         $result = $dhcpService->formatDhcpOptions($output, SubNet::class);
         
         $io->newLine(2);
-        $io->success('Total entities updated: ' . $result);
+        if ($result == 0) {
+            $io->warning('Nothing to update');
+        } else {
+            $io->success('Total entities updated: ' . $result);
+        }
         $io->newLine(2);
         
         $output->writeln(['', 'Done!']);

+ 3 - 0
src/HostBundle/Services/DHCPOptionsService.php

@@ -34,6 +34,7 @@ class DHCPOptionsService
     
     /**
      * @param OutputInterface $output
+     * @param string $class Host|SubNet
      *
      * @return int
      */
@@ -50,6 +51,7 @@ class DHCPOptionsService
         $progressBar = new ProgressBar($output, count($hosts));
         $progressBar->setFormat('custom');
         $progressBar->start();
+        $progressBar->setMessage('Start...');
         foreach ($hosts as $host) {
             $mtaOptions = $cpeOptions = '';
             $options = $host->getOptions();
@@ -94,6 +96,7 @@ class DHCPOptionsService
             }
             $progressBar->advance();
         }
+        $progressBar->setMessage('Finished...');
         $progressBar->finish();
         
         $this->em->flush();