fix certificates auth export command (#3110)

* fix certificates auth export command

* actually fix command config logic

* fix test-certificates.sh

* simplify
This commit is contained in:
Bryan White 2019-09-24 09:38:18 -07:00 committed by Matt Robinson
parent ab3e3f827c
commit 515799267f
2 changed files with 13 additions and 11 deletions

View File

@ -200,22 +200,24 @@ func cmdExportAuth(cmd *cobra.Command, args []string) error {
}
var emails []string
switch {
case len(args) > 0 && !authCfg.All:
if authCfg.All {
if authCfg.EmailsPath != "" {
return errs.New("Either use `--emails-path` or positional args, not both.")
return errs.New("Cannot use `--emails-path` with --all.")
}
emails = args
case len(args) == 0 || authCfg.All:
emails, err = authDB.UserIDs(ctx)
if err != nil {
return err
}
default:
emails, err = parseEmailsList(authCfg.EmailsPath, authCfg.Delimiter)
if err != nil {
return errs.Wrap(err)
} else {
if authCfg.EmailsPath != "" {
emails, err = parseEmailsList(authCfg.EmailsPath, authCfg.Delimiter)
if err != nil {
return errs.Wrap(err)
}
} else if len(args) == 0 {
return errs.New("Need either `--emails-path` or positional args.")
}
emails = append(emails, args...)
}
var (

View File

@ -78,7 +78,7 @@ for i in {0..4}; do
fi
done
exported_auths=$(_certificates auth export)
exported_auths=$(_certificates auth export --all)
_certificates run --min-difficulty 0 --authorization-addr $AUTHS_HTTP_ADDR &
CERTS_PID=$!
@ -96,7 +96,7 @@ done
kill_certificates_server
# Expect 10 authorizations total.
auths=$(_certificates auth export)
auths=$(_certificates auth export --all)
require_lines 10 "$auths" $LINENO
for i in {1..4}; do