diff --git a/command/debug_json2dot.go b/command/debug_json2dot.go deleted file mode 100644 index 5b05e1773..000000000 --- a/command/debug_json2dot.go +++ /dev/null @@ -1,66 +0,0 @@ -package command - -import ( - "fmt" - "os" - "strings" - - "github.com/hashicorp/terraform/dag" - "github.com/mitchellh/cli" -) - -// DebugJSON2DotCommand is a Command implementation that translates a json -// graph debug log to Dot format. -type DebugJSON2DotCommand struct { - Meta -} - -func (c *DebugJSON2DotCommand) Run(args []string) int { - args, err := c.Meta.process(args, true) - if err != nil { - return 1 - } - cmdFlags := c.Meta.extendedFlagSet("debug json2dot") - - if err := cmdFlags.Parse(args); err != nil { - return cli.RunResultHelp - } - - fileName := cmdFlags.Arg(0) - if fileName == "" { - return cli.RunResultHelp - } - - f, err := os.Open(fileName) - if err != nil { - c.Ui.Error(fmt.Sprintf(errInvalidLog, err)) - return cli.RunResultHelp - } - - dot, err := dag.JSON2Dot(f) - if err != nil { - c.Ui.Error(fmt.Sprintf(errInvalidLog, err)) - return cli.RunResultHelp - } - - c.Ui.Output(string(dot)) - return 0 -} - -func (c *DebugJSON2DotCommand) Help() string { - helpText := ` -Usage: terraform debug json2dot input.json - - Translate a graph debug file to dot format. - - This command takes a single json graph log file and converts it to a single - dot graph written to stdout. -` - return strings.TrimSpace(helpText) -} - -func (c *DebugJSON2DotCommand) Synopsis() string { - return "Convert json graph log to dot" -} - -const errInvalidLog = `Error parsing log file: %[1]s` diff --git a/command/debug_json2dot_test.go b/command/debug_json2dot_test.go deleted file mode 100644 index 3e72048ae..000000000 --- a/command/debug_json2dot_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package command - -import ( - "io/ioutil" - "os" - "strings" - "testing" - - "github.com/hashicorp/terraform/dag" - "github.com/mitchellh/cli" -) - -func TestDebugJSON2Dot(t *testing.T) { - // create the graph JSON output - logFile, err := ioutil.TempFile(testingDir, "tf") - if err != nil { - t.Fatal(err) - } - defer os.Remove(logFile.Name()) - - var g dag.Graph - g.SetDebugWriter(logFile) - - g.Add(1) - g.Add(2) - g.Add(3) - g.Connect(dag.BasicEdge(1, 2)) - g.Connect(dag.BasicEdge(2, 3)) - - ui := new(cli.MockUi) - c := &DebugJSON2DotCommand{ - Meta: Meta{ - testingOverrides: metaOverridesForProvider(testProvider()), - Ui: ui, - }, - } - - args := []string{ - logFile.Name(), - } - if code := c.Run(args); code != 0 { - t.Fatalf("bad: \n%s", ui.ErrorWriter.String()) - } - - output := ui.OutputWriter.String() - if !strings.HasPrefix(output, "digraph {") { - t.Fatalf("doesn't look like digraph: %s", output) - } - - if !strings.Contains(output, `subgraph "root" {`) { - t.Fatalf("doesn't contains root subgraph: %s", output) - } -} diff --git a/commands.go b/commands.go index 2e12ba92d..7ea882c89 100644 --- a/commands.go +++ b/commands.go @@ -318,12 +318,6 @@ func initCommands(config *cliconfig.Config, services *disco.Disco, providerSrc g }, nil }, - "debug json2dot": func() (cli.Command, error) { - return &command.DebugJSON2DotCommand{ - Meta: meta, - }, nil - }, - "force-unlock": func() (cli.Command, error) { return &command.UnlockCommand{ Meta: meta,