コード例 #1
0
 /**
  * Migrates all instances known, or in a cluster
  */
 protected function migrateAllInstances()
 {
     if (null !== ($_clusterId = $this->option('cluster-id'))) {
         $_instances = $this->findClusterInstances($_clusterId, ['instance_id_text']);
     } else {
         $_instances = Instance::orderBy('instance_id_text')->get(['instance_id_text']);
     }
     $_results = [];
     if (!empty($_instances)) {
         foreach ($_instances as $_instance) {
             $_id = $_instance->instance_id_text;
             try {
                 $_results[$_id] = $this->migrateSingleInstance($_id);
                 $this->info('* <comment>' . $_id . ':</comment> <info>success</info>');
             } catch (\Exception $_ex) {
                 $_results[$_id] = ['success' => false, 'output' => $_ex->getMessage(), 'exit_code' => $_ex->getCode()];
                 $this->info('* <comment>' . $_id . ':</comment> <error>failure</error>');
             }
         }
     }
     return $_results;
 }