Commands fail when currentvault names no vault (closes #156)
check / check (push) Waiting to run
check / check (push) Waiting to run
An empty currentvault, or one naming a vault that does not exist, made `secret list` report an empty vault with exit 0 and `secret add` fail on a missing directory. ResolveVaultSymlink now refuses an empty or invalid name, or one with no directory under vaults.d, with an error that wraps ErrVaultNotFound, names the file and says to run `secret vault select <name>`. Every command that uses the current vault gets it; `secret vault list` and `secret info` still run. newSizeTestVault wrote a full path into currentvault, which resolved only because the last path element was taken as the name; it now relies on CreateVault selecting the vault. Model: opus-5-5
This commit was merged in pull request #182.
This commit is contained in:
@@ -36,17 +36,11 @@ func newSizeTestVault(t *testing.T) (afero.Fs, *vault.Vault) {
|
||||
|
||||
fs := afero.NewMemMapFs()
|
||||
|
||||
// Create vault
|
||||
// Create vault, which selects it as the current vault
|
||||
_, err := vault.CreateVault(fs, testStateDir, testVaultName,
|
||||
testMnemonicBuffer(t), nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Set current vault
|
||||
currentVaultPath := filepath.Join(testStateDir, "currentvault")
|
||||
vaultPath := filepath.Join(testStateDir, "vaults.d", testVaultName)
|
||||
err = afero.WriteFile(fs, currentVaultPath, []byte(vaultPath), 0o600)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Get vault and set up long-term key
|
||||
vlt, err := vault.GetCurrentVault(fs, testStateDir)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user