示例#1
0
        private void FixHomeDir()
        {
            string userHomeDir = this.ContainerDir;
            string username    = null;
            string gearUuid    = this.Uuid;

            if (Environment.UserName.StartsWith(Prison.PrisonUser.GlobalPrefix))
            {
                username = Environment.UserName;
            }
            else
            {
                username = Prison.Prison.LoadPrisonAndAttach(PrisonIdConverter.Generate(this.Uuid)).User.Username;
            }
            if (!string.IsNullOrEmpty(userHomeDir))
            {
                LinuxFiles.TakeOwnershipOfGearHome(userHomeDir, username);

                Logger.Debug("Fixing symlinks for gear {0}", gearUuid);
                try
                {
                    LinuxFiles.FixSymlinks(Path.Combine(userHomeDir, "app-deployments"));
                }
                catch (Exception ex)
                {
                    Logger.Error("There was an error while trying to fix symlinks for gear {0}: {1} - {2}", gearUuid, ex.Message, ex.StackTrace);
                }
            }
            else
            {
                Logger.Warning("Not taking ownership or fixing symlinks for gear {0}. Could not locate its home directory.", gearUuid);
            }
        }
示例#2
0
        private static void FixHomeDir(string userHomeDir, string username, string gearUuid)
        {
            if (!string.IsNullOrEmpty(userHomeDir))
            {
                LinuxFiles.TakeOwnershipOfGearHome(userHomeDir, username);

                Logger.Debug("Fixing symlinks for gear {0}", gearUuid);
                try
                {
                    LinuxFiles.FixSymlinks(Path.Combine(userHomeDir, "app-deployments"));
                }
                catch (Exception ex)
                {
                    Logger.Error("There was an error while trying to fix symlinks for gear {0}: {1} - {2}", gearUuid, ex.Message, ex.StackTrace);
                }
            }
            else
            {
                Logger.Warning("Not taking ownership or fixing symlinks for gear {0}. Could not locate its home directory.", gearUuid);
            }
        }