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

Add missing JSON tags for NoncurrentVersionExpiration struct #1823

Merged
merged 1 commit into from
May 17, 2023

Conversation

kaankabalak
Copy link
Contributor

@kaankabalak kaankabalak commented May 16, 2023

The omission of the missing JSON tags on the NoncurrentVersionExpiration struct was causing the default value of NoncurrentDays to be shown even when it was not being entered.

Steps to reproduce:
1- Build mc with the latest version of minio-go. Then verify that NoncurrentDays is shown as 0 even when it is not entered.

$ cat test1.json
{
  "Rules": [
   {
    "ID": "chhjo4um3rd3sheeultg",
    "NoncurrentVersionExpiration": {
     "NewerNoncurrentVersions": 1
    },
    "Status": "Enabled"
   }
  ]
 }
$ ./mc ilm  import play/test < ~/test1.json
Lifecycle configuration imported successfully to `play/test`.
$ ./mc ilm  export play/test 
{
 "Rules": [
  {
   "ID": "chhjo4um3rd3sheeultg",
   "NoncurrentVersionExpiration": {
    "NoncurrentDays": 0,
    "NewerNoncurrentVersions": 1
   },
   "Status": "Enabled"
  }
 ]
}

2- Build mc with this branch of minio-go. Then verify that NoncurrentDays is not shown when it is not entered.

$ cat test1.json
{
  "Rules": [
   {
    "ID": "chhjo4um3rd3sheeultg",
    "NoncurrentVersionExpiration": {
     "NewerNoncurrentVersions": 1
    },
    "Status": "Enabled"
   }
  ]
 }
$ ./mc ilm  import play/test < ~/test1.json
Lifecycle configuration imported successfully to `play/test`.
$ ./mc ilm  export play/test 
{
 "Rules": [
  {
   "ID": "chhjo4um3rd3sheeultg",
   "NoncurrentVersionExpiration": {
    "NewerNoncurrentVersions": 1
   },
   "Status": "Enabled"
  }
 ]
}

The omission of the missing JSON tags on the NoncurrentVersionExpiration
struct was causing the default value of NoncurrentDays to be shown even
when it was not being entered
@kaankabalak kaankabalak self-assigned this May 16, 2023
Copy link
Member

@prakashsvmx prakashsvmx left a comment

Choose a reason for hiding this comment

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

Tested. LGTM 👍

with this change (✓)

diff --git a/go.mod b/go.mod
index c0bdd375..c44b1185 100644
--- a/go.mod
+++ b/go.mod
@@ -42,6 +42,8 @@ require (
        gopkg.in/yaml.v2 v2.4.0
 )
 
+replace github.com/minio/minio-go/v7 => /home/prakash/MinIO/GIT/go/src/github.com/prakashsvmx/minio-go
+
 require (
        github.com/charmbracelet/bubbles v0.15.0
        github.com/charmbracelet/lipgloss v0.7.1
diff --git a/go.sum b/go.sum
index 427dbbd3..318c8649 100644
--- a/go.sum
+++ b/go.sum
 ➜ ./mc --version                                
mc version DEVELOPMENT.2023-05-09T17-11-27Z (commit-id=aefb1db4db041d7fdd4b871cbdd996f025d58c7a)
Runtime: go1.19.3 linux/amd64
Copyright (c) 2015-2023 MinIO, Inc.
License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
 ➜ ./mc ilm rule export local22/test-pre-ilm-rule
{
 "Rules": [
  {
   "ID": "chicbu6h3vkqj3nojdgg",
   "NoncurrentVersionExpiration": {
    "NewerNoncurrentVersions": 1
   },
   "Status": "Enabled"
  }
 ]
}

current release

➜ mc ilm rule export local22/test-pre-ilm-rule
{
 "Rules": [
  {
   "ID": "chicbu6h3vkqj3nojdgg",
   "NoncurrentVersionExpiration": {
    "NoncurrentDays": 0,
    "NewerNoncurrentVersions": 1
   },
   "Status": "Enabled"
  }
 ]
}
 ➜ mc --version                                
mc version RELEASE.2023-05-04T18-10-16Z (commit-id=5a0d5116f4936f25b7a1a67c8119cdcad6112cce)
Runtime: go1.20.3 linux/amd64
Copyright (c) 2015-2023 MinIO, Inc.
License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>

@harshavardhana harshavardhana merged commit 78f1dd8 into minio:master May 17, 2023
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.

3 participants