Sfoglia il codice sorgente

Merge branch 'ftth#94' into 'master'

Ftth#94

See merge request interlink-sa/flowdat3/modules/ftth!202
Jean Sumara Leopoldo 4 anni fa
parent
commit
c2ccbeac14
2 ha cambiato i file con 19 aggiunte e 34 eliminazioni
  1. 18 0
      Dockerfile
  2. 1 34
      src/FTTHBundle/Admin/OLTAdmin.php

+ 18 - 0
Dockerfile

@@ -43,6 +43,24 @@ RUN chmod 0600 /opt/keys/*; \
     chmod 777 -R var/cache/ var/logs/ var/sessions/; \
     rm -rf /var/lib/apt/lists/*
 
+ARG WITH_XDEBUG=false
+ARG HOST_MACHINE=1.1.1.1
+
+RUN if [ $WITH_XDEBUG = "true" ] ; then \
+        apt-get update; \
+        apt-get install php-xdebug; \
+        echo "error_reporting = E_ALL" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "display_startup_errors = On" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "display_errors = On" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "xdebug.remote_enable=1" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "xdebug.remote_handler=dbgp" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "xdebug.remote_port=10000" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "xdebug.remote_autostart=1" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "xdebug.remote_connect_back=0" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "xdebug.idekey=docker" >> /etc/php/7.0/mods-available/xdebug.ini; \
+        echo "xdebug.remote_host=$HOST_MACHINE" >> /etc/php/7.0/mods-available/xdebug.ini; \
+    fi ;
+
 CMD env; \
     cp /opt/ftth/keys/fullchain.pem /usr/share/ca-certificates/$HOST_BASE; \
     echo $HOST_BASE >> /etc/ca-certificates.conf; \

+ 1 - 34
src/FTTHBundle/Admin/OLTAdmin.php

@@ -2,15 +2,10 @@
 
 namespace FTTHBundle\Admin;
 
-use FTTHBundle\Entity\OLT;
-use FTTHBundle\Entity\ONU;
 use FTTHBundle\Form\AnchorType;
 use Sonata\AdminBundle\Datagrid\DatagridMapper;
 use Sonata\AdminBundle\Datagrid\ListMapper;
 use Sonata\AdminBundle\Form\FormMapper;
-use Sonata\AdminBundle\Form\Type\CollectionType;
-use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
-use Sonata\AdminBundle\Form\Type\ModelType;
 use Sonata\AdminBundle\Show\ShowMapper;
 use WorkflowBundle\Admin\WorkflowBaseAdmin;
 
@@ -101,7 +96,7 @@ class OLTAdmin extends WorkflowBaseAdmin
                             'help' => 'form.help_ssh_connect',
                         ])
                         ->add('sshPort')
-                        ->add('oltTimeout')
+                        ->add('oltTimeout','integer', array('attr' => array('min' => 10, 'max' => 50)))
                     ->end()
                 ->end()
                 ->tab('autodiscovery')
@@ -171,32 +166,4 @@ class OLTAdmin extends WorkflowBaseAdmin
         ;
     }
 
-    /**
-     * @param OLT $olt
-     * @throws \Exception
-     */
-    public function prePersist($olt)
-    {
-        $this->validateTimeout($olt);
-    }
-
-    /**
-     * @param OLT $olt
-     * @throws \Exception
-     */
-    public function preUpdate($olt)
-    {
-        $this->validateTimeout($olt);
-    }
-
-    /**
-     * @param OLT $olt
-     * @throws \Exception
-     */
-    private function validateTimeout($olt){
-        if($olt->getOltTimeout() > 50){
-            throw new \Exception("El tiempo de espera debe ser inferior al tiempo de procesamiento");
-        }
-    }
-
 }