Corrected the logic for calculating the expiration no of days #4451
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Earlier ILM rule's set value of expiration days was getting deducted from current time and so the final value of no of days to expiration was coming as a -ve value (as expiration day would be in future and deducting from current day would result into a -ve value). Reversed the order of arguments to subtract function and works as expected.
Now the corrected output of command
mc ilm rule ls <minio-cluster-name>/<bucket-name>
looks as belowMotivation and Context
fixes bug #4446
How to test this PR?
Follow the below steps to test the PR
Step-1: Create a bucket using minio console
Step-2: Set the ilm rule using below command
Step-3: Check the minio console to see if rule gets listed as enabled
Step-4: Verify the changes using mc command
mc ilm rule ls myminio/102938-4-300
. The output should be as below