Example #1
0
 public function nodesFromSSHConfigHosts($paths = array())
 {
     $configPaths = array();
     if (is_string($paths)) {
         $configPaths[] = $paths;
     } else {
         $configPaths = $paths;
     }
     if (sizeof($configPaths) < 1) {
         $configPaths = array("/etc/ssh_config", "/etc/ssh/ssh_config", Env::get("homedir") . "/.ssh/config");
     }
     $nodesOptions = SSHConfig::parseToNodeOptionsFromFiles($configPaths);
     foreach ($nodesOptions as $key => $option) {
         $this->node($key, $option);
     }
 }
Example #2
0
 public function testRunLocally1()
 {
     $this->runtimeTask->getOutput()->setVerbosity(3);
     $homedir = Env::get("homedir");
     $node = new Node();
     $node->setName("127.0.0.1");
     $process = new Process($this->runtimeTask, $node);
     $process->runLocally("echo helloworld", array("cwd" => $homedir));
     $output = $process->getRuntimeTask()->getOutput()->fetch();
     $this->assertRegExp("/helloworld/", $output);
     $os = php_uname('s');
     if (preg_match('/Windows/i', $os)) {
         $regexp = '/Real command: cmd.exe \\/C "cd ' . preg_quote($homedir, '/') . ' & echo helloworld"/';
     } else {
         $regexp = '/Real command: bash -l -c "cd ' . preg_quote($homedir, '/') . ' && echo helloworld"/';
     }
     $this->assertRegExp($regexp, $output);
 }
Example #3
0
 public function getDefaultUsername()
 {
     return $this->defaultUsername ? $this->defaultUsername : Env::get("server.username");
 }
Example #4
0
 public function testSetAndGet()
 {
     Env::set("aaa", "bbb");
     $this->assertEquals("bbb", Env::get("aaa"));
 }