diff options
author | Christian Schneider | 2021-02-03 09:08:30 +0100 |
---|---|---|
committer | Christian Schneider | 2021-02-03 09:08:30 +0100 |
commit | 34b71000b9e7a3db54c7826c790dfc1781ad430a (patch) | |
tree | 342ddd3083a2cc4082dfdb3ea210b71113387498 /it.class | |
parent | 28ac1153604f962093594bcd9b44998636fadb9a (diff) | |
download | itools-34b71000b9e7a3db54c7826c790dfc1781ad430a.tar.gz itools-34b71000b9e7a3db54c7826c790dfc1781ad430a.tar.bz2 itools-34b71000b9e7a3db54c7826c790dfc1781ad430a.zip |
Support options, e.g. --twofirst as arguments to it::cdist()
Diffstat (limited to 'it.class')
-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; } |