diff --git a/wsman/provider/wsmancli.py b/wsman/provider/wsmancli.py index 249a1f1..62700e1 100644 --- a/wsman/provider/wsmancli.py +++ b/wsman/provider/wsmancli.py @@ -23,6 +23,7 @@ # along with WSManAPI. If not, see . import sys +import tempfile from wsman import WSManProvider @@ -735,11 +736,25 @@ def invoke(self, reference, command, arguments, remote=None, raw=False): if isinstance(arguments, basestring): get_command += "--input=\"%s\"" % arguments elif isinstance(arguments, dict): + input_file = tempfile.NamedTemporaryFile() + input_file.write('\n' % (command, reference.resource_uri)) for k,v in arguments.items(): - get_command += '-k \"%s=%s\" ' % (k,v) - + if isinstance(v, list): + for vitem in v: + input_file.write('%s\n' % (k, vitem, k)) + else: + input_file.write('%s\n' % (k, v, k)) + input_file.write('\n' % command) + input_file.seek(0) + get_command += '--input \"%s\" ' % input_file.name + + log.debug ("Executing command %s" % get_command) + log.debug ("XML input file %s content:\n%s" % (input_file.name, input_file.read())) output = self.get_transport().execute(get_command) - + + if input_file: + input_file.close() + if raw: return output else: