Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
skip root requirement for ignite version
Browse files Browse the repository at this point in the history
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
  • Loading branch information
chanwit committed Sep 7, 2019
1 parent 8e6b372 commit ec2f8f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
15 changes: 15 additions & 0 deletions cmd/ignite/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/weaveworks/ignite/pkg/providers"
"github.com/weaveworks/ignite/pkg/providers/ignite"
runtimeflag "github.com/weaveworks/ignite/pkg/runtime/flag"
"github.com/weaveworks/ignite/pkg/util"
versioncmd "github.com/weaveworks/ignite/pkg/version/cmd"
)

Expand All @@ -37,6 +38,20 @@ func NewIgniteCommand(in io.Reader, out, err io.Writer) *cobra.Command {
// Set the desired logging level, now that the flags are parsed
logs.Logger.SetLevel(logLevel)

// TODO Some commands do not need to check root
// Currently it seems to be only ignite version that does not require root
if cmd.Name() == "version" && cmd.Parent().Name() == "ignite" {
return
}

// Ignite needs to run as root for now, see
// https://github.com/weaveworks/ignite/issues/46
// TODO: Remove this when ready
util.GenericCheckErr(util.TestRoot())

// Create the directories needed for running
util.GenericCheckErr(util.CreateDirectories())

// Populate the providers after flags have been parsed
if err := providers.Populate(ignite.Providers); err != nil {
log.Fatal(err)
Expand Down
8 changes: 0 additions & 8 deletions cmd/ignite/ignite.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ func main() {

// Run runs the main cobra command of this application
func Run() error {
// Ignite needs to run as root for now, see
// https://github.com/weaveworks/ignite/issues/46
// TODO: Remove this when ready
util.GenericCheckErr(util.TestRoot())

// Create the directories needed for running
util.GenericCheckErr(util.CreateDirectories())

// Preload necessary providers
util.GenericCheckErr(providers.Populate(ignite.Preload))

Expand Down

0 comments on commit ec2f8f8

Please sign in to comment.