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 #430 from chanwit/backport_non-root_version
Browse files Browse the repository at this point in the history
backport: skip root requirement for ignite version
  • Loading branch information
stealthybox authored Sep 16, 2019
2 parents be96924 + bec2177 commit 6679950
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 14 deletions.
21 changes: 21 additions & 0 deletions cmd/ignite/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"github.com/weaveworks/ignite/pkg/network"
networkflag "github.com/weaveworks/ignite/pkg/network/flag"
"github.com/weaveworks/ignite/pkg/providers"
"github.com/weaveworks/ignite/pkg/providers/ignite"
"github.com/weaveworks/ignite/pkg/util"
versioncmd "github.com/weaveworks/ignite/pkg/version/cmd"
)

Expand All @@ -37,6 +39,25 @@ func NewIgniteCommand(in io.Reader, out, err io.Writer) *cobra.Command {
logs.Logger.SetLevel(logLevel)
// Set the desired network plugin
providers.NetworkPlugin = providers.NetworkPlugins[network.ActivePlugin]

// 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 {
logrus.Fatal(err)
}
},
Long: dedent.Dedent(fmt.Sprintf(`
Ignite is a containerized Firecracker microVM administration tool.
Expand Down
10 changes: 1 addition & 9 deletions cmd/ignite/ignite.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ 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())

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

c := cmd.NewIgniteCommand(os.Stdin, os.Stdout, os.Stderr)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ require (
gotest.tools v2.2.0+incompatible // indirect
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719
k8s.io/klog v0.4.0 // indirect
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf
sigs.k8s.io/yaml v1.1.0
)

Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e h1:XmA6L9IPRdUr28a+SK/oMchGgQy159wvzXA5tJ7l+40=
Expand Down Expand Up @@ -354,8 +353,8 @@ k8s.io/klog v0.4.0 h1:lCJCxf/LIowc2IGS9TPjWDyXY4nOmdGdfcwwDQCOURQ=
k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 h1:TRb4wNWoBVrH9plmkp2q86FIDppkbrEXdXlxU3a3BMI=
k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058 h1:di3XCwddOR9cWBNpfgXaskhh6cgJuwcK54rvtwUaC10=
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4=
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf h1:EYm5AW/UUDbnmnI+gK0TJDVK9qPLhM+sRHYanNKw0EQ=
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
18 changes: 18 additions & 0 deletions vendor/k8s.io/kube-openapi/pkg/common/common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ k8s.io/apimachinery/pkg/util/validation
k8s.io/apimachinery/pkg/util/net
# k8s.io/klog v0.4.0
k8s.io/klog
# k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058
# k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf
k8s.io/kube-openapi/pkg/common
k8s.io/kube-openapi/pkg/util/proto
# sigs.k8s.io/yaml v1.1.0
Expand Down

0 comments on commit 6679950

Please sign in to comment.