Exit with non-zero code when trying to do interactive onboarding and --batch is set
This commit is contained in:
parent
6c49bd694f
commit
d55cccc236
4 changed files with 14 additions and 1 deletions
4
ooni.go
4
ooni.go
|
|
@ -23,6 +23,7 @@ type Context struct {
|
|||
Config *config.Config
|
||||
DB sqlbuilder.Database
|
||||
Location *utils.LocationInfo
|
||||
IsBatch bool
|
||||
|
||||
Home string
|
||||
TempDir string
|
||||
|
|
@ -60,6 +61,9 @@ func (c *Context) LocationLookup() error {
|
|||
// config option is set to false
|
||||
func (c *Context) MaybeOnboarding() error {
|
||||
if c.Config.InformedConsent == false {
|
||||
if c.IsBatch == true {
|
||||
return errors.New("cannot run onboarding in batch mode")
|
||||
}
|
||||
if err := onboard.Onboarding(c.Config); err != nil {
|
||||
return errors.Wrap(err, "onboarding")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue