Reverting fix on KV 2 for duplicate paths (#12008)
* revert changes * changelog * add test coverage for max versions
This commit is contained in:
parent
0bc339a2f8
commit
5fe59a685b
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug-fix
|
||||
ui: Revert fix for PR [11423](https://github.com/hashicorp/vault/pull/11423).
|
||||
```
|
|
@ -248,13 +248,6 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
|||
secretData.set(secretData.pathAttr, key);
|
||||
}
|
||||
|
||||
if (this.mode === 'create') {
|
||||
key = JSON.stringify({
|
||||
backend: secret.backend,
|
||||
id: key,
|
||||
});
|
||||
}
|
||||
|
||||
return secretData
|
||||
.save()
|
||||
.then(() => {
|
||||
|
@ -376,14 +369,8 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
|||
return;
|
||||
}
|
||||
|
||||
this.persistKey(key => {
|
||||
let secretKey;
|
||||
try {
|
||||
secretKey = JSON.parse(key).id;
|
||||
} catch (error) {
|
||||
secretKey = key;
|
||||
}
|
||||
this.transitionToRoute(SHOW_ROUTE, secretKey);
|
||||
this.persistKey(() => {
|
||||
this.transitionToRoute(SHOW_ROUTE, this.model.path || this.model.id);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -64,6 +64,29 @@ module('Acceptance | secrets/secret/create', function(hooks) {
|
|||
assert.ok(showPage.editIsPresent, 'shows the edit button');
|
||||
});
|
||||
|
||||
test('it can create a secret with a non default max version', async function(assert) {
|
||||
let enginePath = `kv-${new Date().getTime()}`;
|
||||
let secretPath = 'maxVersions';
|
||||
let maxVersions = 101;
|
||||
await mountSecrets.visit();
|
||||
await mountSecrets.enable('kv', enginePath);
|
||||
await click('[data-test-secret-create="true"]');
|
||||
await fillIn('[data-test-secret-path="true"]', secretPath);
|
||||
await fillIn('[data-test-input="maxVersions"]', maxVersions);
|
||||
await fillIn('[data-test-secret-key]', 'key');
|
||||
await click('[data-test-secret-save]');
|
||||
await settled();
|
||||
await click('[data-test-secret-edit="true"]');
|
||||
await settled();
|
||||
|
||||
let savedMaxVersions = document.querySelector('[data-test-input="maxVersions"]').value;
|
||||
assert.equal(
|
||||
maxVersions,
|
||||
savedMaxVersions,
|
||||
'max_version displays the saved number set when creating the secret'
|
||||
);
|
||||
});
|
||||
|
||||
test('it disables save when validation errors occur', async function(assert) {
|
||||
let enginePath = `kv-${new Date().getTime()}`;
|
||||
await mountSecrets.visit();
|
||||
|
|
Loading…
Reference in New Issue