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

Commit

Permalink
Merge pull request #409 from chanwit/check_root_only_when_needed
Browse files Browse the repository at this point in the history
skip root requirement for ignite version
  • Loading branch information
stealthybox authored Sep 9, 2019
2 parents 372f22f + ec2f8f8 commit 51bb450
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 51bb450

Please sign in to comment.