public function fire($arguments, $options)
 {
     $instanceId = array_get($arguments, CommandRules::INSTANCE_ID);
     $logFile = array_get($arguments, CommandRules::LOGFILE);
     $user = array_get($options, CommandRules::USER);
     $keyFile = array_get($options, CommandRules::KEY_FILE);
     $host = $this->aws->getPublicDNSFromInstanceId($instanceId);
     if (is_null($host)) {
         $this->command->error('Error: Could not find Host from Instance ID. Please try again.');
     } else {
         $connection = $this->connectionFactory->createConnection($instanceId, $host, $user, $keyFile);
         $connection->run(array('tail -f ' . $logFile), function ($line) {
             $this->command->info($line);
         });
     }
 }
 public function fire($arguments, $options)
 {
     $envName = array_get($arguments, CommandRules::ENV);
     $logFile = array_get($arguments, CommandRules::LOGFILE);
     $user = array_get($options, CommandRules::USER);
     $keyFile = array_get($options, CommandRules::KEY_FILE);
     $hosts = $this->aws->getPublicDNSFromEBEnvironmentName($envName);
     if (count($hosts) === 0) {
         $this->command->error('Error: Could not find instances associated with environment');
     } else {
         $connections = array();
         foreach ($hosts as $host) {
             $connections[] = $this->connectionFactory->createConnection($host, $host, $user, $keyFile);
         }
         foreach ($connections as $connection) {
             $connection->run(array('tail -f ' . $logFile), function ($line) {
                 $this->command->info($line);
             });
         }
     }
 }
Esempio n. 3
0
 public function testGetPublicDNSFromEBNameReturnsNullWithEmptyInstances()
 {
     $this->setExpectationsForMockEc2(array('Reservations' => array(0 => array('Instances' => array()))));
     $dnsArray = $this->aws->getPublicDNSFromEBEnvironmentName('test-id');
     $this->assertEmpty($dnsArray);
 }