Ejemplo n.º 1
0
        public _InstructionSet()
        {
            Connection = null;

            DeploymentManagerRelease = "Empty";

            ID        = Guid.NewGuid();
            BranchIP  = "";
            Assigned  = DateTime.MinValue;
            Received  = DateTime.MinValue;
            Started   = DateTime.MinValue;
            Completed = DateTime.MinValue;
            DeploymentControllerID      = "Empty";
            DeploymentManagerIP         = "Empty";
            DeploymentController        = "Empty";
            InstructionSetTemplate      = "Empty";
            InstructionSetContainer     = new Dictionary <string, object>();
            ProcessName                 = "Unknown";
            InitiationSource            = "Empty";
            ContinuousExecution         = false;
            ContinuousExecutionInterval = 60;
            ExecuteStaticInSandboxes    = false;
            CachePostMortem             = false;
            PostMortemMetaData          = new Sys.Serialization.Dictionary <string, string>();
        }
Ejemplo n.º 2
0
        public _InstructionSet(_InstructionSet iSet)
        {
            if (iSet == null)
            {
                throw new ArgumentNullException(nameof(iSet));
            }

            Connection = iSet.Connection;
            DeploymentManagerRelease = iSet.DeploymentManagerRelease;
            ID                          = iSet.ID;
            BranchIP                    = iSet.BranchIP;
            Assigned                    = iSet.Assigned;
            Received                    = iSet.Received;
            Started                     = iSet.Started;
            Completed                   = iSet.Completed;
            DeploymentManagerIP         = iSet.DeploymentManagerIP;
            DeploymentControllerID      = iSet.DeploymentControllerID;
            DeploymentController        = iSet.DeploymentController;
            InstructionSetTemplate      = iSet.InstructionSetTemplate;
            InitiationSource            = iSet.InitiationSource;
            ProcessName                 = iSet.ProcessName;
            ContinuousExecution         = iSet.ContinuousExecution;
            ContinuousExecutionInterval = iSet.ContinuousExecutionInterval;
            ExecuteStaticInSandboxes    = iSet.ExecuteStaticInSandboxes;
            CachePostMortem             = iSet.CachePostMortem;
            ProcessName                 = iSet.ProcessName;
            PostMortemMetaData          = new Sys.Serialization.Dictionary <string, string>(iSet.PostMortemMetaData);

            _Instructions        = iSet._Instructions;
            _InstructionDocument = iSet._InstructionDocument;
            _SerializationSourceInstructionDocument = iSet._SerializationSourceInstructionDocument;
        }
        public _DeploymentController()
        {
            AllowThreadedAssignment = true;
            PollError = "";
            PreprocessPerformsDiscovery = false;

            InstructionSetTemplate            = "MyTemplate";
            OverrideInstructionSetProcessName = "";

            SandboxAppConfigXml = new List <string>();

            TemplateKVP        = new STEM.Sys.Serialization.Dictionary <string, string>();
            PostMortemMetaData = new Sys.Serialization.Dictionary <string, string>();

            TemplateKVP["[MANAGERS]"] = "Reserved";
            TemplateKVP["[BRANCHES]"] = "Reserved";
            TemplateKVP["[NOSOURCE]"] = "Reserved";

            TemplateKVP["[ControllerVersionNumber]"] = "Reserved";
            TemplateKVP["[BranchIP]"]   = "Reserved";
            TemplateKVP["[BranchName]"] = "Reserved";
            TemplateKVP["[ISetID]"]     = "Reserved";
            TemplateKVP["[NewGuid]"]    = "Reserved";
            TemplateKVP["[DeploymentControllerName]"]  = "Reserved";
            TemplateKVP["[DeploymentControllerID]"]    = "Reserved";
            TemplateKVP["[SwitchboardRowID]"]          = "Reserved";
            TemplateKVP["[DeploymentManagerIP]"]       = "Reserved";
            TemplateKVP["[InitiationSource]"]          = "Reserved";
            TemplateKVP["[InstructionSetProcessName]"] = "Reserved";
            TemplateKVP["[PollerSourceString]"]        = "Reserved";
            TemplateKVP["[PollerFileFilter]"]          = "Reserved";
            TemplateKVP["[PollerDirectoryFilter]"]     = "Reserved";
            TemplateKVP["[UtcNow]"] = "yyyy-MM-dd HH.mm.ss.fff";
        }
Ejemplo n.º 4
0
        public void Execute(SurgeBranchManager branchManager)
        {
            try
            {
                DateTime start = DateTime.UtcNow;

                List <MessageConnection> managers;
                lock (DeploymentManagers)
                    managers = DeploymentManagers.ToList();

                List <string> results = null;

                foreach (string dir in STEM.Sys.IO.Path.ExpandRangedPath(Directory))
                {
                    if (System.IO.Directory.Exists(dir))
                    {
                        if (TargetType == PollerTarget.Files)
                        {
                            results = STEM.Sys.IO.Directory.STEM_GetFiles(dir, FileFilter, DirectoryFilter, Recurse ? System.IO.SearchOption.AllDirectories : System.IO.SearchOption.TopDirectoryOnly, false);
                        }
                        else
                        {
                            results = STEM.Sys.IO.Directory.STEM_GetDirectories(dir, DirectoryFilter, Recurse ? System.IO.SearchOption.AllDirectories : System.IO.SearchOption.TopDirectoryOnly, false);
                        }

                        STEM.Sys.Serialization.Dictionary <string, List <string> > ret = new Sys.Serialization.Dictionary <string, List <string> >();
                        foreach (string d in results.Select(i => System.IO.Path.GetDirectoryName(i)).Distinct())
                        {
                            ret[d] = results.Where(i => System.IO.Path.GetDirectoryName(i) == d).Select(i => System.IO.Path.GetFileName(i)).ToList();
                        }

                        PollResult p = new PollResult()
                        {
                            PollTimeMilliseconds = (DateTime.UtcNow - start).TotalMilliseconds, Listing = ret, DeploymentControllerID = DeploymentControllerID, PollError = ""
                        };

                        foreach (MessageConnection d in managers)
                        {
                            d.Send(p);
                        }
                    }
                    else
                    {
                        PollResult p = new PollResult()
                        {
                            PollTimeMilliseconds = (DateTime.UtcNow - start).TotalMilliseconds, Listing = new Sys.Serialization.Dictionary <string, List <string> >(), DeploymentControllerID = DeploymentControllerID, PollError = dir + " does not exist."
                        };

                        foreach (MessageConnection d in managers)
                        {
                            d.Send(p);
                        }
                    }
                }
            }
            catch { }
        }
        public DeploymentManagerConfiguration()
        {
            DeploymentControllers   = new List <FileDescription>();
            InstructionSetTemplates = new List <FileDescription>();
            AdHocInstructionSets    = new List <FileDescription>();
            InstructionSetStatics   = new Sys.Serialization.Dictionary <string, List <FileDescription> >();
            HistoricalDescriptions  = new List <FileDescription>();

            SwitchboardConfigurationDescription = new FileDescription();
            LastUpdate = DateTime.MinValue;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor
 /// </summary>
 public Instruction()
 {
     ID = Guid.NewGuid();
     FlowControlLabel   = "";
     FailureActionLabel = "";
     FailureAction      = FailureAction.Continue;
     Message            = "Unexecuted";
     Stage = Stage.Ready;
     ExecutionStageHistory = new List <Stage>();
     Start                  = Finish = DateTime.MinValue;
     Stop                   = false;
     Exceptions             = new List <Exception>();
     PostMortemMetaData     = new Sys.Serialization.Dictionary <string, string>();
     PopulatePostMortemMeta = true;
     OrdinalPosition        = 0;
 }
Ejemplo n.º 7
0
        protected override bool _Run()
        {
            List <Exception> exceptions = new List <Exception>();

            STEM.Sys.Serialization.Dictionary <string, string> fileSizes = new Sys.Serialization.Dictionary <string, string>();
            List <string> filesActioned = new List <string>();

            if (PopulatePostMortemMeta)
            {
                PostMortemMetaData["FilesRequested"] = STEM.Sys.Serializable.Serialize(FileList);
            }

            foreach (string file in FileList)
            {
                if (!File.Exists(file))
                {
                    continue;
                }

                CB_SourcePath      = Path.GetDirectoryName(file);
                CB_ExpandSource    = false;
                CB_FileFilter      = Path.GetFileName(file);
                CB_DirectoryFilter = "*";
                CB_RecurseSource   = false;

                base._Run();

                if (PopulatePostMortemMeta)
                {
                    if (Exceptions.Count == 0)
                    {
                        if (PostMortemMetaData.ContainsKey("FileSize"))
                        {
                            string fs = PostMortemMetaData["FileSize"];

                            fileSizes[file] = fs;
                        }

                        filesActioned.Add(file);
                    }
                }

                if (PostMortemMetaData.ContainsKey("FileSize"))
                {
                    PostMortemMetaData.Remove("FileSize");
                }

                if (PostMortemMetaData.ContainsKey("FilesActioned"))
                {
                    PostMortemMetaData.Remove("FilesActioned");
                }

                exceptions.AddRange(Exceptions);
                Exceptions.Clear();
            }

            if (PopulatePostMortemMeta)
            {
                PostMortemMetaData["FilesActioned"] = STEM.Sys.Serializable.Serialize(filesActioned);
                PostMortemMetaData["FileSizes"]     = STEM.Sys.Serializable.Serialize(fileSizes);
            }

            if (exceptions.Count > 0)
            {
                Exceptions.AddRange(exceptions);
            }

            return(Exceptions.Count == 0);
        }
Ejemplo n.º 8
0
 public TokenReplace() : base()
 {
     ReplaceInInstructions = ReplaceIn.All;
     WindowsReplacementMap = new Sys.Serialization.Dictionary <string, string>();
     LinuxReplacementMap   = new Sys.Serialization.Dictionary <string, string>();
 }