Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
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);
            }
        }