Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Sep 25, 2023
1 parent c279af4 commit ea11e3e
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
* This is a workaround for an issue with broken log rotation present in Exasol's `docker-db` version 7.0.x and below.
*/
public class LogRotationWorkaround implements Workaround {
static final Logger LOGGER = LoggerFactory.getLogger(LogRotationWorkaround.class);
@SuppressWarnings("java:S1075") // This is a fixed path. It won't change.
static final String ANACRON_SPOOL = "/var/spool/anacron/cron.daily";
private static final Logger LOGGER = LoggerFactory.getLogger(LogRotationWorkaround.class);
private final ExasolContainer<? extends ExasolContainer<?>> exasol;

/**
Expand All @@ -43,9 +41,7 @@ public boolean isNecessary() {
final ExasolDockerImageReference reference = this.exasol.getDockerImageReference();
if (reference.hasMajor() && //
((reference.getMajor() < 7) //
|| ((reference.getMajor() == 7) && reference.hasMinor() && (reference.getMinor() < 1))))

{
|| ((reference.getMajor() == 7) && reference.hasMinor() && (reference.getMinor() < 1)))) {
LOGGER.trace("Log rotation workaround required, since Exasol version is below 7.1.");
return true;
} else {
Expand All @@ -61,8 +57,9 @@ public void apply() throws WorkaroundException {
final ExecResult result = this.exasol.execInContainer("sed", "-i", "-es/'bucketfsd[^']*log' //",
"/etc/cron.daily/exa-logrotate");
if (result.getExitCode() != ExitCode.OK) {
throw new WorkaroundException("Unable to apply log rotation workaround. Error during comand execution: "
+ result.getStderr());
throw new WorkaroundException(
"Unable to apply log rotation workaround. Error during command execution: "
+ result.getStderr());
}
} catch (final UnsupportedOperationException | IOException | SshException exception) {
throw new WorkaroundException("Unable to apply log rotation workaround.", exception);
Expand Down

0 comments on commit ea11e3e

Please sign in to comment.