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 testGetPublicDNSFromInstanceIdReturnsNullWithEmptyInstances() { $this->setExpectationsForMockEc2(array('Reservations' => array(0 => array('Instances' => array())))); $dns = $this->aws->getPublicDNSFromInstanceId('test-id'); $this->assertNull($dns); }