turbot / steampipe

Zero-ETL, infinite possibilities. Live query APIs, code & more with SQL. No DB required.
https://steampipe.io
GNU Affero General Public License v3.0
6.84k stars 264 forks source link

Re-install of steampipe does not create any configuration #2791

Closed jackdelab closed 1 year ago

jackdelab commented 1 year ago

Describe the bug Uninstall and re-install of steampipe did not create any of the needed configuration files. Almost all commands fail with "Error: workspace profile /Users/jack/.steampipe/workspace does not exist"

Uninstall and re-install were both done with Brew. Uninstalled version: steampipe version 0.8.4 Newly installed version: steampipe version 0.17.2

$ ll ~/.steampipe
ls: /Users/jack/.steampipe: No such file or directory

Steampipe version (steampipe -v) $ steampipe -v steampipe version 0.17.2

To reproduce

brew uninstall steampipe
brew update
brew tap turbot/tap
brew install steampipe
steampipe plugin list

Expected behavior steampipe lists no installed plugins

Actual behavior "Error: workspace profile /Users/jack/.steampipe/workspace does not exist"

Additional context

jackdelab commented 1 year ago

Update: I manually re-added config files, re-installed plugins, and got it to the point where it was working with steampipe --workspace=default <command> but not with steampipe <command>, I would get Error: workspace profile /Users/jack/.steampipe/workspace does not exist

Adding the following workspace configuration to ~/.steampipe/config/worspaces.spc made the error go away:

workspace "/Users/jack/.steampipe/workspace" {
  query_timeout       = 300
}

Not sure how that is the assumed workspace name for my machine, but that definitely seems incorrect to me

kaidaguerre commented 1 year ago

Hey @jackdelab that definitely does not sound correct.

Please could you run

env | grep steampipe

just to check if you have any steampipe env vars set.

kaidaguerre commented 1 year ago

Please could you also run:

STEAMPIPE_DIAGNOSTICS=config_json steampipe query

and let me know the result (redacting keys as appropriate)

jackdelab commented 1 year ago

I did run env | grep steampipe at the time, and there were no vars set.

$ STEAMPIPE_DIAGNOSTICS=config_json steampipe query
{
 "cloud-host": "cloud.steampipe.io",
 "cloud-token": "",
 "install-dir": "/Users/jack/.steampipe",
 "mod-location": "/Users/jack",
 "snapshot-location": "",
 "workspace": "/Users/jack/.steampipe/workspace",
 "workspace-database": "local"
}
kaidaguerre commented 1 year ago

and what is the contents of /Users/jack/.steampipe/config/default.spc please

jackdelab commented 1 year ago
└─$ cat /Users/jack/.steampipe/config/default.spc

#
# For detailed descriptions, see the reference documentation
# at https://steampipe.io/docs/reference/cli-args
#

# options "connection" {
#   cache     = true # true, false
#   cache_ttl = 300  # expiration (TTL) in seconds
# }

# options "database" {
#   port          = 9193    # any valid, open port number
#   listen        = "local" # local, network
#   search_path   =  ""     # comma-separated string
# }

# options "terminal" {
#   multi               = false   # true, false
#   output              = "table" # json, csv, table, line
#   header              = true    # true, false
#   separator           = ","     # any single char
#   timing              = false   # true, false
#   search_path         =  ""     # comma-separated string
#   search_path_prefix  =  ""     # comma-separated string
#   watch               =  true   # true, false
#   autocomplete       =  true   # true, false
# }

# options "general" {
#   update_check = true # true, false
# }
kaidaguerre commented 1 year ago

Ok I'm officially stumped. I can't see where it is getting that workspace profile path from.

If I get a diagnostic build together with some extra output, would you be ok to give that a run?

jackdelab commented 1 year ago

yes, of course

kaidaguerre commented 1 year ago

@jackdelab I have release a diagnostics build: https://github.com/turbot/steampipe/releases/tag/v0.17.3-diags.0

This is not available via brew - you will need to install the binary directly. What platform are you on?

jackdelab commented 1 year ago

@kaidaguerre I am on macos AMD64. I downloaded the diagnostics build, what output would you like?

kaidaguerre commented 1 year ago

@jackdelab sorry missed your reply.

Please run

STEAMPIPE_DIAGNOSTICS=config_json  STEAMPIPE_LOG_LEVEL=TRACE steampipe query
jackdelab commented 1 year ago
└─$ STEAMPIPE_DIAGNOSTICS=config_json  STEAMPIPE_LOG_LEVEL=TRACE steampipe query
2022-12-02 22:48:41.189 UTC [TRACE] steampipe: loadWorkspaceProfile
2022-12-02 22:48:41.189 UTC [TRACE] steampipe: STEAMPIPE_WORKSPACE =
2022-12-02 22:48:41.189 UTC [TRACE] steampipe: --workspace = /Users/jack/.steampipe/workspace
2022-12-02 22:48:41.189 UTC [TRACE] steampipe: installDir = /Users/jack/.steampipe
2022-12-02 22:48:41.189 UTC [TRACE] steampipe: workspaceProfileDir = /Users/jack/.steampipe/config
2022-12-02 22:48:41.189 UTC [TRACE] steampipe: NewWorkspaceProfileLoader workspaceProfilePath = /Users/jack/.steampipe/config
2022-12-02 22:48:41.195 UTC [TRACE] steampipe: parse complete after 1 decode passes
2022-12-02 22:48:41.195 UTC [TRACE] steampipe: WorkspaceProfileLoader get: name default, workspaceProfilePath: /Users/jack/.steampipe/config
2022-12-02 22:48:41.195 UTC [TRACE] steampipe: load configured profile /Users/jack/.steampipe/workspace
2022-12-02 22:48:41.195 UTC [TRACE] steampipe: WorkspaceProfileLoader get: name /Users/jack/.steampipe/workspace, workspaceProfilePath: /Users/jack/.steampipe/config
2022-12-02 22:48:41.195 UTC [TRACE] steampipe: ensureInstallDir /Users/jack/.steampipe
2022-12-02 22:48:41.200 UTC [TRACE] steampipe: No memory limit set
{
 "cloud-host": "cloud.steampipe.io",
 "cloud-token": "",
 "install-dir": "/Users/jack/.steampipe",
 "mod-location": "/Users/jack",
 "snapshot-location": "",
 "workspace": "/Users/jack/.steampipe/workspace",
 "workspace-database": "local"
}

└─$ alias | grep -i steampipe
alias steampipe='steampipe --workspace=/Users/jack/.steampipe/workspace'

└─$ env | grep -i steampipe

I will admit my embarrassment, it seems the issue with the bogus workspace was caused by me, and I am not sure when. According to my IDE's file history function, I've had that alias set for at least the past 7 months. It apparently had no noticeable effects until upgrading to the latest version

pskrbasu commented 1 year ago

Hi, @jackdelab hope the issue got resolved.

It apparently had no noticeable effects until upgrading to the latest version - Yes since you were using quite an old version(0.8.4) which did not have the --workspace feature, you never saw any effects.

Thanks