浏览代码

make:updateImages command updated

Guillermo Espinoza 6 年之前
父节点
当前提交
8e2563b4da
共有 1 个文件被更改,包括 18 次插入3 次删除
  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\Output\OutputInterface;
 use Symfony\Component\Console\Question\ConfirmationQuestion;
+use Symfony\Component\Console\Question\Question;
 use Symfony\Component\Yaml\Yaml;
 
 class UpdateImages extends ReleaseImages
@@ -126,6 +127,20 @@ class UpdateImages extends ReleaseImages
             $dObj->dirExists()->realpath();
             $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
             $this->addConfigOptions($input, $version);
             // creo el archivo de log de como se ejecuto
@@ -157,12 +172,12 @@ class UpdateImages extends ReleaseImages
             );
 
             // 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())) {
-                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) {
             $output->writeln($t->getTraceAsString());
         } finally {