Beispiel #1
0
 /**
  * Create the scp command
  *
  * @param Node $node The node
  *
  * @return string
  */
 protected function getScpCommand(Node $node)
 {
     return rtrim('scp -r ' . trim($node->get('scpOptions')));
 }
Beispiel #2
0
 /**
  * Wrap the command in an expect command
  *
  * @param string $sshCommand The command
  * @param Node   $node       The node
  *
  * @return void
  */
 protected function addExpect(&$sshCommand, Node $node)
 {
     $pass = $node->get('pass');
     if ($pass) {
         $expectFile = dirname(dirname(__DIR__));
         $expectFile .= '/res/script/password.expect';
         $sshCommand = sprintf('expect %s %s %s', escapeshellarg($expectFile), escapeshellarg($pass), $sshCommand);
     }
 }
Beispiel #3
0
 /**
  * Handles special variable names
  *
  * @param string $key   Current part of the complete variable name
  * @param mixed  $value The value
  *
  * @return void
  */
 private function filterSpecialNames(&$key, &$value)
 {
     if ($key === 'node' && is_array($value)) {
         $key = 'nodes';
         $value = array($value);
     }
     if ($key === 'nodes') {
         $nodes = array();
         foreach ($value as $id => $options) {
             if ($options instanceof Node) {
                 $node = $options;
             } else {
                 $node = new Node($this);
                 $node->setFromArray($options);
             }
             $node->set('id', $id);
             $nodes[$id] = $node;
         }
         $value = $nodes;
     }
 }