Skip to content

Commit

Permalink
[JENKINS-47909] Prudent to add a log message when we are migrating a …
Browse files Browse the repository at this point in the history
…user record for any reason.
  • Loading branch information
jglick committed Nov 9, 2017
1 parent e2d3682 commit 5d2b824
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/java/hudson/model/User.java
Expand Up @@ -453,7 +453,9 @@ public synchronized void doSubmitDescription( StaplerRequest req, StaplerRespons
if (o instanceof User) {
if (idStrategy().equals(id, legacyUserDir.getName()) && !idStrategy().filenameOf(legacyUserDir.getName())
.equals(legacyUserDir.getName())) {
if (!legacyUserDir.renameTo(configFile.getParentFile())) {
if (legacyUserDir.renameTo(configFile.getParentFile())) {
LOGGER.log(Level.INFO, "Migrated user record from {0} to {1}", new Object[] {legacyUserDir, configFile.getParentFile()});
} else {
LOGGER.log(Level.WARNING, "Failed to migrate user record from {0} to {1}",
new Object[]{legacyUserDir, configFile.getParentFile()});
}
Expand All @@ -478,6 +480,7 @@ public synchronized void doSubmitDescription( StaplerRequest req, StaplerRespons
try {
Files.createDirectory(configFile.getParentFile().toPath());
Files.move(unsanitizedLegacyConfigFile.toPath(), configFile.toPath());
LOGGER.log(Level.INFO, "Migrated unsafe user record from {0} to {1}", new Object[] {unsanitizedLegacyConfigFile, configFile});
} catch (IOException | InvalidPathException e) {
LOGGER.log(
Level.WARNING,
Expand Down

0 comments on commit 5d2b824

Please sign in to comment.