diff options
-rw-r--r-- | it.class | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -742,15 +742,20 @@ static function cexec(/* $cmd, $values1 = array(), ... */) /** * distribute local files to all cluster hosts of the current service. no stderr if called with @ - * @params $files filename or array of files to distribute + * @params $args Variable number of options (e.g. --twofirst), filename or array of files to distribute * @see it::exec, /opt/ultra/bin/cdist */ -static function cdist(/* $file1, ... */) +static function cdist(...$args) { - foreach (func_get_args() as $arg) - $files = array_merge((array)$files, (array)$arg); + foreach ($args as $arg) + { + if (is_string($arg) && $arg[0] == '-') + $opts[$arg] = true; + else + $files = array_merge((array)$files, (array)$arg); + } - return ($errs = it::exec('cdist -q {FILES} 2>&1', ['FILES' => $files])) ? it::error(['title' => $errs]) : true; + return ($errs = it::exec('cdist -q {-opts} {files} 2>&1', ['-opts' => $opts, 'files' => $files])) ? it::error(['title' => $errs]) : true; } |