Add createImage.
This commit is contained in:
20
main.go
20
main.go
@@ -98,6 +98,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !exist() {
|
if !exist() {
|
||||||
|
createImage()
|
||||||
create()
|
create()
|
||||||
start()
|
start()
|
||||||
}
|
}
|
||||||
@@ -234,3 +235,22 @@ func delete(bypassError bool) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func createImage() {
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
|
resp, err := client.R().
|
||||||
|
SetHeader("x-forwarded-user", authUser).
|
||||||
|
Post(fmt.Sprintf("%s://%s/images/create?fromImage=%s", proxyScheme, proxyHost, imageName))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(resp.Body()))
|
||||||
|
|
||||||
|
if resp.IsError() {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user