private void DeployMissingPlugins(int agentId, IEnumerable <string> requiredPlugins)
        {
            AgentDeployer.log.DebugFormat("DeployMissingPlugins started, AgentId:{0}, RequiredPlugins:{1}", (object)agentId, (object)string.Join(",", requiredPlugins));
            AgentManager agentManager = new AgentManager(this.agentInfoDal);
            AgentInfo    agentInfo    = agentManager.GetAgentInfo(agentId);

            if (agentInfo == null)
            {
                throw new ArgumentException(string.Format("Agent with Id:{0} not found", (object)agentId));
            }
            foreach (string pluginId in agentInfo.get_Plugins().Where <AgentPluginInfo>((Func <AgentPluginInfo, bool>)(p => p.get_Status() == 5 || p.get_Status() == 12)).Select <AgentPluginInfo, string>((Func <AgentPluginInfo, string>)(p => p.get_PluginId())).ToArray <string>())
            {
                AgentDeployer.log.DebugFormat("DeployMissingPlugins - Redeploying plugin {0}", (object)pluginId);
                agentManager.StartRedeployingPlugin(agentId, pluginId);
            }
            foreach (string pluginId in requiredPlugins.Where <string>((Func <string, bool>)(requiredPluginId => agentInfo.get_Plugins().All <AgentPluginInfo>((Func <AgentPluginInfo, bool>)(installedPlugin => installedPlugin.get_PluginId() != requiredPluginId)))))
            {
                AgentDeployer.log.DebugFormat("DeployMissingPlugins - Deploying plugin {0}", (object)pluginId);
                agentManager.StartDeployingPlugin(agentId, pluginId);
            }
            agentInfo = agentManager.GetAgentInfo(agentId);
            if (agentInfo == null || agentInfo.get_AgentStatus() != 8 && !agentInfo.get_Plugins().Any <AgentPluginInfo>((Func <AgentPluginInfo, bool>)(p => p.get_Status() == 3)) && !agentInfo.get_Plugins().Any <AgentPluginInfo>((Func <AgentPluginInfo, bool>)(p => p.get_Status() == 13)))
            {
                return;
            }
            AgentDeployer.log.Debug((object)"DeployMissingPlugins - Approve update");
            agentManager.ApproveUpdate(agentId);
        }
        private int DeployAgent(AgentDeploymentSettings settings)
        {
            AgentDeployer.log.Debug((object)"DeployAgent started");
            AgentManager agentManager = new AgentManager(this.agentInfoDal);
            int          agentId      = agentManager.StartDeployingAgent(settings);

            agentManager.UpdateAgentNodeId(agentId, settings.get_NodeId());
            AgentDeployer.log.DebugFormat("DeployAgent finished, AgentId:{0}", (object)agentId);
            return(agentId);
        }
示例#3
0
        // Token: 0x06000904 RID: 2308 RVA: 0x00041240 File Offset: 0x0003F440
        private int DeployAgent(AgentDeploymentSettings settings)
        {
            AgentDeployer.log.Debug("DeployAgent started");
            AgentManager agentManager = new AgentManager(this.agentInfoDal);
            int          num          = agentManager.StartDeployingAgent(settings);

            agentManager.UpdateAgentNodeId(num, settings.NodeId);
            AgentDeployer.log.DebugFormat("DeployAgent finished, AgentId:{0}", num);
            return(num);
        }
示例#4
0
        // Token: 0x06000901 RID: 2305 RVA: 0x00040F7C File Offset: 0x0003F17C
        public int StartDeployingAgent(AgentDeploymentSettings settings)
        {
            AgentDeployer.log.Debug("StartDeployingAgent entered");
            AgentDeploymentWatcher instance = AgentDeploymentWatcher.GetInstance(this.agentInfoDal);

            instance.Start();
            int       num       = this.DeployAgent(settings);
            AgentInfo agentInfo = new AgentManager(this.agentInfoDal).GetAgentInfo(num);

            instance.AddOrUpdateDeploymentInfo(AgentDeploymentInfo.Calculate(agentInfo, settings.RequiredPlugins, null));
            this.DeployMissingPlugins(num, settings.RequiredPlugins);
            return(num);
        }
        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);
        }
示例#6
0
        // Token: 0x06000917 RID: 2327 RVA: 0x00041AB0 File Offset: 0x0003FCB0
        private AgentDeploymentInfo LoadAgentDeploymentInfo(int agentId)
        {
            AgentInfo agentInfo = new AgentManager(this.AgentInfoDal).GetAgentInfo(agentId);

            if (agentInfo != null)
            {
                string[] agentDiscoveryPluginIds = DiscoveryHelper.GetAgentDiscoveryPluginIds();
                return(AgentDeploymentInfo.Calculate(agentInfo, agentDiscoveryPluginIds, null));
            }
            return(new AgentDeploymentInfo
            {
                Agent = new AgentInfo
                {
                    AgentId = agentId
                },
                StatusInfo = new AgentDeploymentStatusInfo(agentId, AgentDeploymentStatus.Failed, "Agent not found.")
            });
        }
示例#7
0
        // Token: 0x06000903 RID: 2307 RVA: 0x0004104C File Offset: 0x0003F24C
        private void DeployMissingPlugins(int agentId, IEnumerable <string> requiredPlugins)
        {
            AgentDeployer.log.DebugFormat("DeployMissingPlugins started, AgentId:{0}, RequiredPlugins:{1}", agentId, string.Join(",", requiredPlugins));
            AgentManager agentManager = new AgentManager(this.agentInfoDal);
            AgentInfo    agentInfo    = agentManager.GetAgentInfo(agentId);

            if (agentInfo == null)
            {
                throw new ArgumentException(string.Format("Agent with Id:{0} not found", agentId));
            }
            foreach (string text in (from p in agentInfo.Plugins
                                     where p.Status == 5 || p.Status == 12
                                     select p.PluginId).ToArray <string>())
            {
                AgentDeployer.log.DebugFormat("DeployMissingPlugins - Redeploying plugin {0}", text);
                agentManager.StartRedeployingPlugin(agentId, text);
            }
            foreach (string text2 in from requiredPluginId in requiredPlugins
                     where agentInfo.Plugins.All((AgentPluginInfo installedPlugin) => installedPlugin.PluginId != requiredPluginId)
                     select requiredPluginId)
            {
                AgentDeployer.log.DebugFormat("DeployMissingPlugins - Deploying plugin {0}", text2);
                agentManager.StartDeployingPlugin(agentId, text2);
            }
            agentInfo = agentManager.GetAgentInfo(agentId);
            if (agentInfo != null)
            {
                if (agentInfo.AgentStatus != 8)
                {
                    if (!agentInfo.Plugins.Any((AgentPluginInfo p) => p.Status == 3))
                    {
                        if (!agentInfo.Plugins.Any((AgentPluginInfo p) => p.Status == 13))
                        {
                            return;
                        }
                    }
                }
                AgentDeployer.log.Debug("DeployMissingPlugins - Approve update");
                agentManager.ApproveUpdate(agentId);
            }
        }