Ejemplo n.º 1
0
        /*
         *  Same as StartTransaction*S*, but single command.
         */
        private Task <string> StartTransaction(IGammaClientTransaction trx, IGammaMachineInfo machine, string command)
        {
            trx.TransactionStarted();
            var task = GammaCmdExecutorServiceFacade.ExecuteCmdAsync(machine, command);

            BindCmdTaskWithTranscation(task, trx);
            return(task);
        }
Ejemplo n.º 2
0
        /*
         * return the task that run the command on the node.
         * and also bind the task with the transaction here.
         */
        private Task <string> StartTransactions(IGammaClientTransaction trx, IMachineInfo machine, string[] commands)
        {
            trx.TransactionStarted();
            var task = ProxyFacadeCmdExecutor.ExecuteCmdsSeqByNodeAsync(machine, commands);

            BindCmdTaskWithTranscation(task, trx);
            return(task);
        }
Ejemplo n.º 3
0
        private Task <string> StartTransactions(IGammaClientTransaction trx, IMachineInfo machine, GammaTXClearEnv clear_step)
        {
            trx.TransactionStarted();
            Task <string> task;

            if (clear_step != GammaTXClearEnv.REBOOT)
            {
                switch (clear_step)
                {
                case GammaTXClearEnv.REG:
                    task = GammaProxyFactory.GetCrsCleanerProxy(machine).RemoveOraKeysAsync();
                    break;

                case GammaTXClearEnv.GROUP:
                    task = GammaProxyFactory.GetCrsCleanerProxy(machine).RmOraGroupAsync();
                    break;

                case GammaTXClearEnv.FILE:
                    task = GammaProxyFactory.GetCrsCleanerProxy(machine).RemoveOraFilesAsync();
                    break;

                case GammaTXClearEnv.DISK:
                    task = GammaProxyFactory.GetCrsCleanerProxy(machine).CleanDiskAsync();
                    break;

                case GammaTXClearEnv.DRIVER:
                    task = GammaProxyFactory.GetCrsCleanerProxy(machine).RemoveDrvLtrAsync();
                    break;

                default:
                    task = GenerateCompletedTask(TX_RESULT_SUC);
                    break;
                }
                BindCmdTaskWithTranscation(task, trx);
            }
            else
            {
                /*
                 *  reboot node transaction no need to Bind, as it will always fails by its mean.
                 */
                var tmp = GammaProxyFactory.GetCrsCleanerProxy(machine).RestartComputerAsync();
                task = tmp.ContinueWith <string>((t) => {
                    trx.TransactionCompleted();
                    return(TX_RESULT_SUC);
                });
            }

            return(task);
        }
Ejemplo n.º 4
0
        private Task <string> StartTransactions(IGammaClientTransaction trx, IMachineInfo machine, GammaTXQATools tool, object qatoolArgs = null)
        {
            trx.TransactionStarted();
            Task <string> task;

            switch (tool)
            {
            case GammaTXQATools.GETLOG:
                if (qatoolArgs != null)
                {
                    bool tmp = (bool)qatoolArgs;
                    task = GammaProxyFactory.GetQAToolsProxy(machine).GetLogAsync(tmp);
                }
                else
                {
                    throw new Exception("Unexpected error when try to get operation option.");
                }
                break;

            case GammaTXQATools.CLEARLOG:
                task = GammaProxyFactory.GetQAToolsProxy(machine).ClearLogAsync();
                break;

            case GammaTXQATools.UPLOAD:
                if (qatoolArgs != null)
                {
                    GammaServiceLib.UploadRecord tmp = qatoolArgs as GammaServiceLib.UploadRecord;
                    task = GammaProxyFactory.GetQAToolsProxy(machine).UploadLogAsync(tmp);
                }
                else
                {
                    throw new Exception("Unexpected error when try to get upload information.");
                }
                break;

            default:
                task = GenerateCompletedTask(TX_RESULT_SUC);
                break;
            }
            BindCmdTaskWithTranscation(task, trx);
            return(task);
        }