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

-o json doesn't produce JSON formatted output #101

Open
ekquasar opened this issue May 9, 2023 · 6 comments
Open

-o json doesn't produce JSON formatted output #101

ekquasar opened this issue May 9, 2023 · 6 comments

Comments

@ekquasar
Copy link

ekquasar commented May 9, 2023

The command using -o json still produces table-formatted output:

> fsoc -o json uql "FETCH id FROM entities(k8s:workload)"

✓ Platform API call (POST /monitoring/v1/query/execute)
 id                                            
===============================================
 k8s:deployment:JT6tRLs2ODen18HIbDIB1w         
 k8s:deployment:b6N73TQ4P0CPIzgOXcJ59Q         
 k8s:deployment:Ez43uF6+O4qSdb1JCHzn/Q         
 k8s:deployment:KdZMpMLAMBu5pr9fr+thQg         
 k8s:deployment:dLbyCKq/OSChG8DXlHC7sg         
 k8s:deployment:4we+hv8mPpOqzQpFV7DE+g
...

Using latest FSOC:

> fsoc version

fsoc version 0.37.0

While moving the -o json to the end of the command works:

> fsoc uql "FETCH id FROM entities(k8s:workload)" -o json

✓ Platform API call (POST /monitoring/v1/query/execute)                      
{                                                                            
    "model": {                                                               
        "id": "string"                                                       
    },                                                                       
    "data": [                                                                
        {                                                                    
            "id": "k8s:deployment:JT6tRLs2ODen18HIbDIB1w"                    
        },                                                                   
        {                                                                    
            "id": "k8s:deployment:b6N73TQ4P0CPIzgOXcJ59Q"                    
        },                                                                   
        {                                                           
...

, the above is still a bug IMHO.

@pnickolov
Copy link
Contributor

Thank you @ekquasar ; will look into this. The UQL commands override the -o flag, so I expect this may be caused by this interaction.

@pnickolov
Copy link
Contributor

@ekquasar , following up on this, I believe this is a cobra limitation, see https://umarcor.github.io/cobra/#concepts. If not satisfied enough to close this issue, LMK and I will look further.

@ekquasar
Copy link
Author

Fair enough. Nonetheless, from a user standpoint, it looks like Cisco code is broken whether or not it's a dependency issue.

Maybe just drop the -o json option from the CLI documentation if it doesn't work?

@pnickolov
Copy link
Contributor

pnickolov commented Nov 21, 2023

@ekquasar, following up on this: I agree the dependency behavior doesn't excuse it.
Strictly, nothing is broken as fsoc help uql provides the usage of fsoc uql [flags] (not fsoc [flags] uql [flags]).

That said, I will look into this when possible, as it will be better if we can support this usage form as well.

@forrestdevelops
Copy link
Contributor

@pnickolov Can I pick this up?

@ekquasar
Copy link
Author

fsoc solution download <solution-name> -o json | jq fails.

Still buggy, but when it works it's a crucial feature - super productivity gain. Oh you injure me so, FSOC.

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

No branches or pull requests

3 participants