Exemplo n.º 1
0
        /// <summary>
        /// Invokes a low-level <b>xe CLI</b> command on the remote XenServer host
        /// that returns text, throwing an exception on failure.
        /// </summary>
        /// <param name="command">The <b>xe CLI</b> command.</param>
        /// <param name="args">The optional arguments formatted as <b>name=value</b>.</param>
        /// <returns>The command response.</returns>
        /// <exception cref="XenException">Thrown if the operation failed.</exception>
        public CommandResponse SafeInvoke(string command, params string[] args)
        {
            VerifyNotDisposed();

            var response = SshProxy.RunCommand($"xe {command}", runOptions, args);

            if (response.ExitCode != 0)
            {
                throw new XenException($"XE-COMMAND: {command} MESSAGE: {response.ErrorText}");
            }

            return(response);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Invokes a low-level <b>xe CLI</b> command on the remote XenServer host
 /// that returns a list of items.
 /// </summary>
 /// <param name="command">The <b>xe CLI</b> command.</param>
 /// <param name="args">The optional arguments formatted as <b>name=value</b>.</param>
 /// <returns>The command <see cref="XenResponse"/>.</returns>
 public XenResponse InvokeItems(string command, params string[] args)
 {
     VerifyNotDisposed();
     return(new XenResponse(SshProxy.RunCommand($"xe {command}", runOptions, args)));
 }