pavedroad-io / roadctl

A kubectl compatible CLI for managing and creating applications and defining/managing CI/CD environments. The roadctl command uses blueprints based on provent design patterns driven by produciton metrics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Search for template directory if not found

jscharber opened this issue · comments

Issuing template commands when not in the parent directory causes backtraces.

Three changes are required.

  • Search for a template directory
  • Allows template directory to be specified in an environment variable
  • Allows template directory to be specified as a command-line option
  • Return error message if the template directory can't be located

Sample error

$ roadctl describe templates datamgr 
panic: runtime error: slice bounds out of range [:-4]

goroutine 1 [running]:
github.com/pavedroad-io/roadctl/cmd.tplDescribeResponse.RespondWithText(0x0, 0x0, 0x0, 0xc0000953e0, 0xc0000953d0)
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/cmd/templates.go:573 +0x2be
github.com/pavedroad-io/roadctl/cmd.runDescribe(0xe7a5a0, 0xc0000a28a0, 0x2, 0x2)
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/cmd/describe.go:74 +0x1a2
github.com/pavedroad-io/roadctl/cmd.glob..func8(0xe7a5a0, 0xc0000a28a0, 0x2, 0x2)
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/cmd/describe.go:43 +0x49
github.com/spf13/cobra.(*Command).execute(0xe7a5a0, 0xc0000a2820, 0x2, 0x2, 0xe7a5a0, 0xc0000a2820)
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/vendor/github.com/spf13/cobra/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xe79e20, 0xe7ad20, 0xc000113f20, 0x43d03a)
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/vendor/github.com/spf13/cobra/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/vendor/github.com/spf13/cobra/command.go:864
github.com/pavedroad-io/roadctl/cmd.Execute()
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/cmd/root.go:56 +0x31
main.main()
	/home/jscharber/eng/src/github.com/pavedroad-io/roadctl/roadctl.go:35 +0x93