public function run($commandHandlerString) { $commandHandler = new $commandHandlerString(); if ($commandHandler->preExec()) { $result = $this->shellExecService->shellExec($commandHandler->getCommand()); $commandHandler->postExec($result->isOk()); return $result->isOk(); } return false; }
public function getPublicSshKeyFromPrivateKey() { if (!$this->isSshKeygenPresent()) { return null; } $keyFilename = $this->configService->getPrivateKeyFilename(); if (!file_exists($keyFilename)) { return null; } $result = $this->shellExecService->shellExec("ssh-keygen -P '' -q -y -f '{$keyFilename}'"); if (!$result->isOk()) { return null; } $output = $result->getOutput(); return $output[0]; }