private AgentDeploymentInfo LoadAgentDeploymentInfo(int agentId)
        {
            AgentInfo agentInfo1 = new AgentManager(this.AgentInfoDal).GetAgentInfo(agentId);

            if (agentInfo1 != null)
            {
                string[] discoveryPluginIds = DiscoveryHelper.GetAgentDiscoveryPluginIds();
                return(AgentDeploymentInfo.Calculate(agentInfo1, (IEnumerable <string>)discoveryPluginIds, (string)null));
            }
            AgentDeploymentInfo agentDeploymentInfo = new AgentDeploymentInfo();
            AgentInfo           agentInfo2          = new AgentInfo();

            agentInfo2.set_AgentId(agentId);
            agentDeploymentInfo.set_Agent(agentInfo2);
            agentDeploymentInfo.set_StatusInfo(new AgentDeploymentStatusInfo(agentId, (AgentDeploymentStatus)2, "Agent not found."));
            return(agentDeploymentInfo);
        }
Exemplo n.º 2
0
        public void StartDeployingPlugins(
            int agentId,
            IEnumerable <string> requiredPlugins,
            Action <AgentDeploymentStatus> onFinishedCallback = null)
        {
            AgentDeployer.log.Debug((object)"StartDeployingPlugins entered");
            AgentDeploymentInfo deploymentInfo = AgentDeploymentInfo.Calculate(new AgentManager(this.agentInfoDal).GetAgentInfo(agentId), requiredPlugins, (string)null);

            deploymentInfo.set_StatusInfo(new AgentDeploymentStatusInfo(agentId, (AgentDeploymentStatus)0));
            AgentDeploymentWatcher instance = AgentDeploymentWatcher.GetInstance(this.agentInfoDal);

            instance.AddOrUpdateDeploymentInfo(deploymentInfo);
            if (onFinishedCallback != null)
            {
                instance.SetOnFinishedCallback(agentId, onFinishedCallback);
            }
            this.DeployMissingPlugins(agentId, requiredPlugins);
        }