From 11a4360f8818e8732f104f5584fec3d6caf2e66a Mon Sep 17 00:00:00 2001 From: Christian A. Weber Date: Mon, 13 Jan 2014 20:24:19 +0100 Subject: add it::cdist() and it::cexec() --- it.class | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'it.class') diff --git a/it.class b/it.class index d62a57c..c8b4d19 100644 --- a/it.class +++ b/it.class @@ -569,7 +569,7 @@ static function shell_command(/* $cmd, $values1 = array(), ... */) foreach ($args as $arg) $values = array_merge($values, (array)$arg); - #for escapeshellarg in it::_exec_quotevalue + # for escapeshellarg in it::_exec_quotevalue $oldlocale = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, 'de_CH'); foreach (it::match('({(-?)([a-z0-9]\w*)})', $cmd, array('all' => true)) as $tags) @@ -615,6 +615,28 @@ static function _exec_quotevalue($value, $errmsg = "") } +/** + * execute a command on all cluster hosts of the current service + * @params see it::exec() + * @see it::exec, /opt/ultra/bin/cdist + */ +static function cexec(/* $cmd, $values1 = array(), ... */) +{ + return it::exec('cdist -c {CMD}', 'CMD' => call_user_func_array('it::shell_command', func_get_args())); +} + + +/** + * distribute local files to all cluster hosts of the current service + * @params $files filename or array of files to distribute + * @see it::exec, /opt/ultra/bin/cdist + */ +static function cdist(/* $cmd, $values1 = array(), ... */) +{ + return it::exec('cdist {FILES}', 'FILES' => func_get_args()); +} + + /** * Convert an image to a given size and type (ensures input is an image) * @param $p['in'] Input filename (mandatory) -- cgit v1.2.3