Ejemplo n.º 1
0
        public ActionResult Version(Guid tid, Guid aid)
        {
            var targetAppVersions = new TargetAppVersions();
            var versions = new Versions();
            var apps = new Apps();
            var targets = new Targets();
            var groups = new Groups();

            Version version;
            var versionKey = targetAppVersions.GetTargetAppVersion(tid, aid);
            if (versionKey.HasValue)
            {
                try
                {
                    version = versions.GetVersion(versionKey.Value);
                }
                catch (Exception)
                {
                    version = null;
                }
            }
            else
            {
                version = null;
            }

            var app = apps.GetApp(aid);
            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetAppVersionDetails()
            {
                Version = version,
                App = app,
                Target = target,
                Group = group,
            };
            return View(model);
        }
Ejemplo n.º 2
0
        private Guid GetInstallVersion(Guid appKey)
        {
            var targetAppVersionController = new TargetAppVersions(config);
            System.Guid? updatedVersionKey = targetAppVersionController.GetTargetAppVersion(config.TargetKey, appKey);
            if (updatedVersionKey.HasValue)
                return updatedVersionKey.Value;

            var versionController = new Versions(config);
            var res = versionController.SearchAppVersions(appKey, pageSize: 1);
            if (res.Versions.Count() > 0)
                return res.Versions.First().Key;

            throw new AppDeploymentException(string.Format("Failed updating application \"{0}\", no versions found.", appKey));
        }
Ejemplo n.º 3
0
 public void Update(Guid appKey, Guid versionKey)
 {
     var targetAppVersionController = new TargetAppVersions(config);
     VersionCheckResult changeResult = targetAppVersionController.TargetAppVersionChanged(config.TargetKey, appKey, versionKey);
     if (changeResult == VersionCheckResult.Changed)
     {
         System.Guid? updatedVersionKey = targetAppVersionController.GetTargetAppVersion(config.TargetKey, appKey);
         if (updatedVersionKey.HasValue)
             RunUpdate(appKey, updatedVersionKey.Value);
     }
     else if (changeResult == VersionCheckResult.NotSet)
     {
         // Check for latest version
         var versionController = new Versions(config);
         var res = versionController.SearchAppVersions(appKey, pageSize: 1);
         if (res.Versions.Count() != 1)
         {
             throw new AppDeploymentException(string.Format("Failed updating application \"{0}\", no versions found.", appKey));
         }
         if (res.Versions.Single().Key != versionKey)
         {
             RunUpdate(appKey, res.Versions.Single().Key);
         }
     }
 }