secrethub / secrethub-cli

A secrets management platform that every engineer can use with minimal code changes.
https://secrethub.io
Apache License 2.0
135 stars 23 forks source link

Error applying migration: unknown command "list" for "op" #401

Closed garethtdavies closed 1 year ago

garethtdavies commented 1 year ago

Used the secrethub CLI to generate the migration plan but have the following error applying it:

op --version 2.9.1
secrethub --version 0.43.0, build 3962e85
secrethub migrate apply --plan-file=./1password-migration-plan.yml
[1/5] Checking vault: creds-keys
[ERROR] 2022/12/07 08:42:11 unknown command "list" for "op"
Usage:  op [command] [flags]

Management Commands:
  account     Manage your locally configured 1Password accounts
  connect     Manage Connect instances and Connect tokens in your 1Password account
  document    Perform CRUD operations on Document items in your vaults
  events-api  Manage Events API integrations in your 1Password account
  group       Manage the groups in your 1Password account
  item        Perform CRUD operations on the 1Password items in your vaults
  plugin      Manage the shell plugins you use to authenticate third-party CLIs
  user        Manage users within this 1Password account
  vault       Manage permissions and perform CRUD operations on your 1Password vaults

Commands:
  completion  Generate shell completion information
  inject      Inject secrets into a config file
  read        Read a secret using the secrets reference syntax
  run         Pass secrets as environment variables to a process
  signin      Sign in to a 1Password account
  signout     Sign out of a 1Password account
  update      Check for and download updates.
  whoami      Get information about a signed-in account

Global Flags:
      --account account    Select the account to execute the command by account shorthand, sign-in address, account ID, or user ID. For a list
                           of available accounts, run 'op account list'. Can be set as the OP_ACCOUNT environment variable.
      --cache              Store and use cached information. Cache is enabled by default. The cache is not available on Windows. (default true)
      --config directory   Use this configuration directory.
      --debug              Enable debug mode. Can also be enabled by setting the OP_DEBUG environment variable to true.
      --encoding type      Use this character encoding type. Default: UTF-8. Supported: SHIFT_JIS, gbk.
      --format string      Use this output format. Can be 'human-readable' or 'json'. Can be set as the OP_FORMAT environment variable.
                           (default "human-readable")
  -h, --help               Get help for op.
      --iso-timestamps     Format timestamps according to ISO 8601 / RFC 3339. Can be set as the OP_ISO_TIMESTAMPS environment variable.
      --no-color           Print output without color.
      --session token      Authenticate with this session token. 1Password CLI outputs session tokens for successful 'op signin' commands when
                           1Password app integration is not enabled.

Run 'op [command] --help' for more information on the command.
Encountered an error: could not check vault existence: could not list vaults: 1password: op list vaults: exit status 1
SimonBarendse commented 1 year ago

Thanks for filing a bug report @garethtdavies ! This definitely shouldn't be happening.

It looks like we incorrectly detect the version number in SecretHub CLI. op list vaults is a 1Password CLI v1 command, and since you're on the latest version (v2.9.1) it should be using op vault list instead.

SimonBarendse commented 1 year ago

@garethtdavies could you upgrade your SecretHub CLI version to v0.44.1? We've released a patch in that version that should fix this.

garethtdavies commented 1 year ago

Ah, thanks. Wasn't updating via brew so manually downloaded secrethub-v0.44.1-darwin-amd64.tar.gz and that cured it. Thanks.