Пример #1
0
        public Plan(dynamic spec)
        {
            this.spec = spec;
            this.deployment = spec["deployment"];
            this.jobs = null;
            this.packages = new Collection<Package>();
            string jobName = "";

            dynamic jobSpec = spec["job"];
            dynamic packageSpecs = spec["packages"];

            if (jobSpec != null && jobSpec.ToString() != "")
            {
                jobName = jobSpec["name"].Value;
                this.jobs = new Collection<Job>();

                if (IsLegacySpec(jobSpec))
                {
                    Job job = new Job(jobName, jobSpec["template"], jobSpec,spec);
                    this.jobs.Add(job);
                }
                else
                {
                    foreach (var templateSpec in jobSpec["templates"])
                    {
                        Job job = new Job(jobName, templateSpec["name"].Value, templateSpec, spec);
                        jobs.Add(job);

                    }
                }

            }

            if (packageSpecs != null)
            {

                foreach (var i in packageSpecs)
                {
                    this.packages.Add(new Package(i.Value));
                }

            }
        }
Пример #2
0
 private string SymlinkPathInJob(Job job)
 {
     return Path.Combine(job.InstallPath, "packages", name);
 }
Пример #3
0
 public void InstallForJob(Job job)
 {
     try
     {
         Helpers.FetchBitsAndSymlink(installPath, linkPath, blobstoreId, checksum);
         if (job != null) CreateSymlinkInJob(job);
     }
     catch(Exception e)
     {
         throw new InstallationException("Install job error.", e);
     }
 }
Пример #4
0
        private void CreateSymlinkInJob(Job job)
        {
            string symlinkPath = SymlinkPathInJob(job);
            Directory.CreateDirectory(new DirectoryInfo(symlinkPath).Parent.FullName);

            Util.CreateSymLink(installPath, symlinkPath);
        }