public bool Stage(Droplet droplet, Instance instance) { bool rv = false; using (FileData file = GetStagedApplicationFile(droplet.ExecutableUri)) { if (null != file) { InstancePaths paths = GetInstancePaths(instance); Directory.CreateDirectory(paths.DropletsPath); Directory.CreateDirectory(paths.BaseAppPath); using (var gzipStream = new GZipInputStream(file.FileStream)) { var tarArchive = TarArchive.CreateInputTarArchive(gzipStream); tarArchive.ExtractContents(paths.DropletsPath); tarArchive.Close(); } var instanceApplicationDirInfo = new DirectoryInfo(paths.BaseAppPath); Utility.CopyDirectory(new DirectoryInfo(paths.DropletsPath), instanceApplicationDirInfo); rv = true; } } return(rv); }
public bool Stage(Droplet droplet, Instance instance) { bool rv = false; DirectoryInfo instanceApplicationDirInfo = null; using (FileData file = GetStagedApplicationFile(droplet.ExecutableUri)) { if (null != file) { InstancePaths paths = GetInstancePaths(instance); Directory.CreateDirectory(paths.DropletsPath); Directory.CreateDirectory(paths.BaseAppPath); using (var gzipStream = new GZipInputStream(file.FileStream)) { using (var tarArchive = TarArchive.CreateInputTarArchive(gzipStream)) { tarArchive.ExtractContents(paths.DropletsPath); tarArchive.Close(); } } instanceApplicationDirInfo = new DirectoryInfo(paths.BaseAppPath); Utility.CopyDirectory(new DirectoryInfo(paths.DropletsPath), instanceApplicationDirInfo); rv = true; } } if (rv && null != instanceApplicationDirInfo) { DirectorySecurity appDirSecurity = instanceApplicationDirInfo.GetAccessControl(); appDirSecurity.AddAccessRule( new FileSystemAccessRule( IIS_IUSRS, FileSystemRights.Write | FileSystemRights.Read | FileSystemRights.Delete | FileSystemRights.Modify, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow)); instanceApplicationDirInfo.SetAccessControl(appDirSecurity); } return(rv); }
public void CleanupInstanceDirectory(Instance instance, bool force = false) { if (force || (false == disableDirCleanup)) { InstancePaths paths = GetInstancePaths(instance); try { if (Directory.Exists(paths.DropletsPath)) { Directory.Delete(paths.DropletsPath, true); } if (Directory.Exists(paths.BaseAppPath)) { Directory.Delete(paths.BaseAppPath, true); } } catch (Exception ex) { log.Error(ex); } } }
public string GetApplicationPathFor(Instance instance) { InstancePaths paths = GetInstancePaths(instance); return(paths.FullAppPath); }