Skip to content

Commit

Permalink
Merge pull request #21 from lluiscampos/mender-setup-fixes
Browse files Browse the repository at this point in the history
Remove debug messages and amend demo certificate path
  • Loading branch information
lluiscampos authored Jan 10, 2024
2 parents 0d775ea + 1d037e3 commit 0218f98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,14 @@ func SetupCLI(args []string) error {
func (runOptions *runOptionsType) commonCLIHandler(
ctx *cli.Context) (*conf.MenderConfig, error) {

fmt.Println("runOptions datastore: ", runOptions.dataStore)

// Handle config flags
config, err := conf.LoadConfig(
runOptions.config, runOptions.fallbackConfig)
if err != nil {
return nil, err
}

// Make sure that paths that are not configurable via the config file is conconsistent with
// Make sure that paths that are not configurable via the config file is consistent with
// --data flag
config.ArtifactScriptsPath = path.Join(runOptions.dataStore, "scripts")
config.ModulesWorkPath = path.Join(runOptions.dataStore, "modules", "v3")
Expand Down Expand Up @@ -223,13 +221,9 @@ func (runOptions *runOptionsType) handleCLIOptions(ctx *cli.Context) error {
// Check that user has permission to directories so that
// the user doesn't have to perform the setup before raising
// an error.
fmt.Println("runOptions config: ", runOptions.config)
fmt.Println("runOptions config: ", path.Dir(runOptions.config))
if err = checkWritePermissions(path.Dir(runOptions.config)); err != nil {
return err
}
fmt.Println("runOptions config datastore: ", runOptions.dataStore)
fmt.Println("runOptions config datastore: ", path.Dir(runOptions.dataStore))
if err = checkWritePermissions(runOptions.dataStore); err != nil {
return err
}
Expand Down Expand Up @@ -336,7 +330,6 @@ func upgradeHelpPrinter(defaultPrinter func(w io.Writer, templ string, data inte
}

func checkWritePermissions(dir string) error {
fmt.Println("Checking the permissions for: ", dir)
_, err := os.Stat(dir)
if os.IsNotExist(err) {
err := os.MkdirAll(dir, 0755)
Expand Down
2 changes: 1 addition & 1 deletion cli/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const ( // state enum

var (
// needed so that we can override it when testing
DefaultMenderDemoCertDir = "/usr/share/doc/mender-client/examples"
DefaultMenderDemoCertDir = "/usr/share/doc/mender-auth/examples"
DefaultLocalTrustMenderDir = "/usr/local/share/ca-certificates/mender"
DefaultLocalTrustMenderPrefix = "mender-demo-"
DefaultLocalTrustMenderFormat = "mender-demo-%d.crt"
Expand Down

0 comments on commit 0218f98

Please sign in to comment.