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 var emails []string
switch { if authCfg.All {
case len(args) > 0 && !authCfg.All:
if authCfg.EmailsPath != "" { 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) emails, err = authDB.UserIDs(ctx)
if err != nil { if err != nil {
return err return err
} }
default: } else {
emails, err = parseEmailsList(authCfg.EmailsPath, authCfg.Delimiter) if authCfg.EmailsPath != "" {
if err != nil { emails, err = parseEmailsList(authCfg.EmailsPath, authCfg.Delimiter)
return errs.Wrap(err) 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 ( var (

View File

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