Selaa lähdekoodia

make:updateImages command updated

Guillermo Espinoza 6 vuotta sitten
vanhempi
commit
8e2563b4da
1 muutettua tiedostoa jossa 18 lisäystä ja 3 poistoa
  1. 18 3
      tools/src/UpdateImages.php

+ 18 - 3
tools/src/UpdateImages.php

@@ -47,6 +47,7 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Question\ConfirmationQuestion;
 use Symfony\Component\Console\Question\ConfirmationQuestion;
+use Symfony\Component\Console\Question\Question;
 use Symfony\Component\Yaml\Yaml;
 use Symfony\Component\Yaml\Yaml;
 
 
 class UpdateImages extends ReleaseImages
 class UpdateImages extends ReleaseImages
@@ -126,6 +127,20 @@ class UpdateImages extends ReleaseImages
             $dObj->dirExists()->realpath();
             $dObj->dirExists()->realpath();
             $this->_dObj = $dObj;
             $this->_dObj = $dObj;
 
 
+            $path = $dObj->dirExists()->realpath()->getPath();
+
+            // hosts file not exists, then build it
+            if (file_exists($path . "/hosts") === false) {
+                copy(getcwd() . "/hosts", $path . "/hosts");
+                $this->public_ip = $input->getOption('public_ip');
+                while (!filter_var($this->public_ip, FILTER_VALIDATE_IP)) {
+                    $helper = $this->getHelper('question');
+                    $question = new Question('IP pública del cliente para acceder a Flowdat ? (Default: 127.0.0.1)', '127.0.0.1');
+                    $this->public_ip = $helper->ask($input, $output, $question);
+                }
+                $this->addHosts();
+            }
+
             // agrego las opciones del input a la configuracion _modues
             // agrego las opciones del input a la configuracion _modues
             $this->addConfigOptions($input, $version);
             $this->addConfigOptions($input, $version);
             // creo el archivo de log de como se ejecuto
             // creo el archivo de log de como se ejecuto
@@ -157,12 +172,12 @@ class UpdateImages extends ReleaseImages
             );
             );
 
 
             // copio el playbook
             // copio el playbook
-            copy(getcwd() . "/playbookUpdateSupport.yml", $dObj->dirExists()->realpath()->getPath() . "/playbook.yml");
+            copy(getcwd() . "/playbookUpdateSupport.yml", $path . "/playbook.yml");
 
 
             if ($this->isModuleAvailable(new Kea())) {
             if ($this->isModuleAvailable(new Kea())) {
-                copy(getcwd() . "/get_kea_files.sh", $dObj->dirExists()->realpath()->getPath() . "/get_kea_files.sh");
+                copy(getcwd() . "/get_kea_files.sh", $path . "/get_kea_files.sh");
             }
             }
-            copy(getcwd() . "/get_supervisord_files.sh", $dObj->dirExists()->realpath()->getPath() . "/get_supervisord_files.sh");
+            copy(getcwd() . "/get_supervisord_files.sh", $path . "/get_supervisord_files.sh");
         } catch (\Throwable $t) {
         } catch (\Throwable $t) {
             $output->writeln($t->getTraceAsString());
             $output->writeln($t->getTraceAsString());
         } finally {
         } finally {