Files
teleport/lib/tbot/cli/start_empty.go
T
Tim Buckley b529bdf11c MWI: Add tbot start noop to start or configure bots with no services (#63624)
* MWI: Add `tbot start noop`

This adds a new `noop` start/configure mode to tbot that starts no
services.

While of dubious utility on its own, the intent is to add a CLI flow
that mirrors our [documentation flow], where we first onboard a bot,
then configure services in a follow-up guide. Currently,
`tbot configure` can only generate a configuration with a service, so
it isn't able to help generate the initial empty YAML config file.

Additionally, it is useful for verifying onboarding config and making
sure the bot can join the cluster.

[documentation flow]: https://goteleport.com/docs/machine-workload-identity/deployment/linux/

* Fix lint
2026-02-09 17:59:09 +00:00

58 lines
1.7 KiB
Go

/*
* Teleport
* Copyright (C) 2026 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cli
import (
"fmt"
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/gravitational/trace"
"github.com/gravitational/teleport/lib/tbot/config"
)
// NoopCommand implements `tbot start noop` and
// `tbot configure identity`.
type NoopCommand struct {
*sharedStartArgs
*genericMutatorHandler
}
// NewNoopCommand initializes the command and flags for identity outputs
// and returns a struct that will contain the parse result.
func NewNoopCommand(parentCmd *kingpin.CmdClause, action MutatorAction, mode CommandMode) *NoopCommand {
cmd := parentCmd.Command("noop", fmt.Sprintf("%s tbot with no configured services to test onboarding config.", mode)).Alias("no-op")
c := &NoopCommand{}
c.sharedStartArgs = newSharedStartArgs(cmd)
c.genericMutatorHandler = newGenericMutatorHandler(cmd, c, action)
return c
}
func (c *NoopCommand) ApplyConfig(cfg *config.BotConfig, l *slog.Logger) error {
if err := c.sharedStartArgs.ApplyConfig(cfg, l); err != nil {
return trace.Wrap(err)
}
return nil
}