Skip to content

Commit

Permalink
Add check if home folder has been purged
Browse files Browse the repository at this point in the history
  • Loading branch information
vogti committed Dec 11, 2023
1 parent 3692af3 commit 0df360f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/polypheny/control/control/ServiceManager.java
Expand Up @@ -862,6 +862,14 @@ public static boolean purgePolyphenyFolder( ClientCommunicationStream clientComm
throw new RuntimeException( "Unable to purge Polypheny home folder!" );
}
}

// Check if everything has been deleted
for ( File f : polyphenyDir.listFiles() ) {
if ( f.getName().equals( "uuid" ) || f.getName().equals( "certs" ) ) {
continue;
}
throw new RuntimeException( "Unable to delete certain files in the Polypheny home folder!" );
}
}

// Check if there are any test backups of the home folder (e.g., created for integration tests). There should not be any, but if there is, delete it as this folder would be restored on startup
Expand All @@ -874,6 +882,10 @@ public static boolean purgePolyphenyFolder( ClientCommunicationStream clientComm
}
throw new RuntimeException( "Unable to purge backup of Polypheny home holder!" + polyphenyTestBackupDir.getAbsolutePath() );
}
// Check if folder has been deleted
if ( polyphenyTestBackupDir.exists() ) {
throw new RuntimeException( "Unable to purge backup of Polypheny home holder!" + polyphenyTestBackupDir.getAbsolutePath() );
}
}

log.info( "> Polypheny home folder has been purged!" );
Expand Down

0 comments on commit 0df360f

Please sign in to comment.