TUN-3819: Remove client-side check that deleted tunnels have no connections
This commit is contained in:
parent
89b738f8fa
commit
ded9dec4f0
|
@ -223,12 +223,7 @@ func (sc *subcommandContext) delete(tunnelIDs []uuid.UUID) error {
|
||||||
if !tunnel.DeletedAt.IsZero() {
|
if !tunnel.DeletedAt.IsZero() {
|
||||||
return fmt.Errorf("Tunnel %s has already been deleted", tunnel.ID)
|
return fmt.Errorf("Tunnel %s has already been deleted", tunnel.ID)
|
||||||
}
|
}
|
||||||
// Check if tunnel has existing connections and if force flag is set, cleanup connections
|
if forceFlagSet {
|
||||||
if len(tunnel.Connections) > 0 {
|
|
||||||
if !forceFlagSet {
|
|
||||||
return fmt.Errorf("You can not delete tunnel %s because it has active connections. To see connections run the 'list' command. If you believe the tunnel is not active, you can use a -f / --force flag with this command.", id)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := client.CleanupConnections(tunnel.ID); err != nil {
|
if err := client.CleanupConnections(tunnel.ID); err != nil {
|
||||||
return errors.Wrapf(err, "Error cleaning up connections for tunnel %s", tunnel.ID)
|
return errors.Wrapf(err, "Error cleaning up connections for tunnel %s", tunnel.ID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,8 @@ var (
|
||||||
forceDeleteFlag = &cli.BoolFlag{
|
forceDeleteFlag = &cli.BoolFlag{
|
||||||
Name: "force",
|
Name: "force",
|
||||||
Aliases: []string{"f"},
|
Aliases: []string{"f"},
|
||||||
Usage: "Allows you to delete a tunnel, even if it has active connections.",
|
Usage: "Cleans up any stale connections before the tunnel is deleted. cloudflared will not " +
|
||||||
|
"delete a tunnel with connections without this flag.",
|
||||||
EnvVars: []string{"TUNNEL_RUN_FORCE_OVERWRITE"},
|
EnvVars: []string{"TUNNEL_RUN_FORCE_OVERWRITE"},
|
||||||
}
|
}
|
||||||
selectProtocolFlag = altsrc.NewStringFlag(&cli.StringFlag{
|
selectProtocolFlag = altsrc.NewStringFlag(&cli.StringFlag{
|
||||||
|
|
Loading…
Reference in New Issue