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 515fcb6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
15 changes: 15 additions & 0 deletions cmd/ignite/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"github.com/weaveworks/ignite/pkg/util"
"io"
"os"

Expand Down Expand Up @@ -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
14 changes: 3 additions & 11 deletions cmd/ignite/ignite.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package main

import (
"os"

"github.com/weaveworks/ignite/cmd/ignite/cmd"
"github.com/weaveworks/ignite/pkg/providers"
"github.com/weaveworks/ignite/pkg/providers/ignite"
"github.com/weaveworks/ignite/pkg/util"
"os"

"github.com/weaveworks/ignite/cmd/ignite/cmd"
)

func main() {
Expand All @@ -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 515fcb6

Please sign in to comment.