Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error message when trying to add multiple expiry options … #5117

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

marktheunissen
Copy link
Contributor

@marktheunissen marktheunissen commented Jan 22, 2025

…in a single rule

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Description

Make an error message more descriptive about what the user can do to fix the problem.

Motivation and Context

Currently this ilm rule adding error is hard to understand:

mc ilm add play/locked-bucket-abc --expiry-date 2026-01-01 --noncurrent-expire-days 3 --expire-delete-marker --prefix /adgf
mc: <ERROR> Unable to generate new lifecycle rules for the input: only one parameter under Expiration can be specified.
  • There are many mc flags but it's not clear which ones are "under Expiration" (which is a reference to an internal Go struct, not something a user can see).
  • For example, --noncurrent-expire-days is NOT "under Expiration" even though it looks like it might be, as it contains the word "expire" in it.
  • --expire-days, --expire-date and --expire-all-object-versions are "under Expiration" but this is not clear.

The new error simply informs the user where they have made a mistake, and suggests that they can achieve what they want by adding a multiple rules:

 ❯ ./mc ilm add play/locked-bucket-abc --expiry-date 2026-01-01 --expire-delete-marker --prefix /adgf
mc: <ERROR> Unable to generate new lifecycle rules for the input: only one of expiry-date, expiry-days 
and expire-delete-marker can be used in a single rule. Try adding multiple rules to achieve the desired effect.

How to test this PR?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

Copy link
Contributor

@shtripat shtripat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@dormanze dormanze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@harshavardhana harshavardhana merged commit 5cfac09 into minio:master Jan 23, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants