Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

acorn secret reveal -o json has incorrect values. #1812

Closed
sangee2004 opened this issue Jun 19, 2023 · 2 comments
Closed

acorn secret reveal -o json has incorrect values. #1812

sangee2004 opened this issue Jun 19, 2023 · 2 comments
Assignees
Labels
area/automation kind/bug Something isn't working
Milestone

Comments

@sangee2004
Copy link
Contributor

sangee2004 commented Jun 19, 2023

acorn version v0.7.1-15-g167b9f5e+167b9f5e

Steps to reproduce the problem:

  1. Create a secret
 acorn secret create --data test1=value1 --data test2=value2 mytestsec
  1. Use acorn secret reveal to reveal the secret.
 % acorn secret reveal mytestsec        
NAME        TYPE      KEY       VALUE
mytestsec   opaque    test1     value1
mytestsec   opaque    test2     value2

  1. Use acorn secret reveal -o json to reveal the secret. Notice that there are 2 entries returned . Each entries has details of both keys test1 and test2. The values are incorrect in one of them and empty in the other entry.
acorn secret reveal mytestsec -o json
{
    "items": [
        {
            "kind": "Secret",
            "apiVersion": "api.acorn.io/v1",
            "metadata": {
                "name": "mytestsec",
                "namespace": "acorn",
                "uid": "1a2dea61-83d9-4d55-93c2-9c37698f0835-s-p",
                "resourceVersion": "1517564",
                "creationTimestamp": "2023-06-19T22:53:14Z"
            },
            "type": "opaque",
            "data": {
                "test1": "dmFsdWUx",
                "test2": "dmFsdWUy"
            },
            "keys": [
                "test1",
                "test2"
            ]
        },
        {
            "kind": "Secret",
            "apiVersion": "api.acorn.io/v1",
            "metadata": {
                "name": "mytestsec",
                "namespace": "acorn",
                "uid": "1a2dea61-83d9-4d55-93c2-9c37698f0835-s-p",
                "resourceVersion": "1517564",
                "creationTimestamp": "2023-06-19T22:53:14Z"
            },
            "type": "opaque",
            "data": {
                "test1": "dmFsdWUx",
                "test2": "dmFsdWUy"
            },
            "keys": [
                "test1",
                "test2"
            ]
        }
    ]
}
@sangee2004 sangee2004 added the kind/bug Something isn't working label Jun 19, 2023
@sangee2004 sangee2004 added this to the v0.8.0 milestone Jun 19, 2023
@iwilltry42 iwilltry42 self-assigned this Jun 22, 2023
@iwilltry42
Copy link
Contributor

iwilltry42 commented Jun 22, 2023

Regression introduced by #1806

  1. "Wrong" values because it's now printing the plain Secret Objects, with values not decoded
  2. Duplicate entry, because it's printing on a loop over the included keys

Question is if we actually want to have the raw object output here.
--> Answer: Yes, but with data decoded

@sangee2004
Copy link
Contributor Author

Tested with acorn version v0.8.0-alpha7-98-gbb130866+bb130866

acorn secret reveal -o json works as expected.

acorn secret reveal mytestsec -o json 
{
    "items": [
        {
            "kind": "Secret",
            "apiVersion": "api.acorn.io/v1",
            "metadata": {
                "name": "mytestsec",
                "namespace": "testnew1",
                "generation": 2,
                "creationTimestamp": "2023-07-17T18:54:24Z",
                "finalizers": [
                    "acorn-us-east-2.manager.acorn.io/secret"
                ]
            },
            "type": "opaque",
            "data": {
                "test1": "value1",
                "test2": "value2"
            },
            "keys": [
                "test1",
                "test2"
            ]
        }
    ]
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/automation kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants