upload/koji: ensure that Koji type instance is always logged-in

Previously, Koji instance could be both logged-in and not logged-in.
This change disallows it: Now, the Koji instance is created by calling
koji.Login, so it must be always logged-in. This change should lead to more
robust code.
This commit is contained in:
Ondřej Budai 2020-08-19 14:48:26 +02:00 committed by Tom Gundersen
parent f77f570202
commit bc02da786d
3 changed files with 36 additions and 41 deletions

View file

@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"log"
"net/http"
"os"
"path"
"time"
@ -38,13 +39,7 @@ func main() {
}
defer file.Close()
k, err := koji.New(server)
if err != nil {
println(err.Error())
return
}
err = k.Login("osbuild", "osbuildpass")
k, err := koji.Login(server, "osbuild", "osbuildpass", http.DefaultTransport)
if err != nil {
println(err.Error())
return