mirror of https://github.com/docker/cli.git
cli/context/store: removeAllEndpointData(): accept name instead of ID
This allows callers to just pass the name, and handle the conversion to ID and path internally. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
42e275eaf6
commit
c3eb116f9c
|
@ -168,7 +168,7 @@ func (s *store) ResetTLSMaterial(name string, data *ContextTLSData) error {
|
||||||
|
|
||||||
func (s *store) ResetEndpointTLSMaterial(contextName string, endpointName string, data *EndpointTLSData) error {
|
func (s *store) ResetEndpointTLSMaterial(contextName string, endpointName string, data *EndpointTLSData) error {
|
||||||
id := contextdirOf(contextName)
|
id := contextdirOf(contextName)
|
||||||
if err := s.tls.removeAllEndpointData(id, endpointName); err != nil {
|
if err := s.tls.removeAllEndpointData(contextName, endpointName); err != nil {
|
||||||
return patchErrContextName(err, contextName)
|
return patchErrContextName(err, contextName)
|
||||||
}
|
}
|
||||||
if data == nil {
|
if data == nil {
|
||||||
|
|
|
@ -51,8 +51,8 @@ func (s *tlsStore) remove(contextID contextdir, endpointName, filename string) e
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *tlsStore) removeAllEndpointData(contextID contextdir, endpointName string) error {
|
func (s *tlsStore) removeAllEndpointData(name, endpointName string) error {
|
||||||
return os.RemoveAll(s.endpointDir(contextID, endpointName))
|
return os.RemoveAll(s.endpointDir(contextdirOf(name), endpointName))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *tlsStore) removeAllContextData(name string) error {
|
func (s *tlsStore) removeAllContextData(name string) error {
|
||||||
|
|
|
@ -62,7 +62,7 @@ func TestTlsListAndBatchRemove(t *testing.T) {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.DeepEqual(t, resAll, all)
|
assert.DeepEqual(t, resAll, all)
|
||||||
|
|
||||||
err = testee.removeAllEndpointData(contextID, "ep3")
|
err = testee.removeAllEndpointData(contextName, "ep3")
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
resEp1ep2, err := testee.listContextData(contextID)
|
resEp1ep2, err := testee.listContextData(contextID)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
Loading…
Reference in New Issue