mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
update
This commit is contained in:
parent
33035378a9
commit
543cb26da1
@ -284,22 +284,24 @@ func (c *Checker) createProject() error {
|
||||
}
|
||||
|
||||
// version 0.1.1's reponse code is 200
|
||||
if resp.StatusCode != http.StatusCreated ||
|
||||
resp.StatusCode != http.StatusOK {
|
||||
if resp.StatusCode == http.StatusConflict {
|
||||
return ErrConflict
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
message, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
c.logger.Errorf("an error occurred while reading message from response: %v", err)
|
||||
}
|
||||
|
||||
return fmt.Errorf("failed to create project %s on %s with user %s: %d %s",
|
||||
c.project, c.dstURL, c.dstUsr, resp.StatusCode, string(message))
|
||||
if resp.StatusCode == http.StatusCreated ||
|
||||
resp.StatusCode == http.StatusOK {
|
||||
return nil
|
||||
}
|
||||
|
||||
if resp.StatusCode == http.StatusConflict {
|
||||
return ErrConflict
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
message, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
c.logger.Errorf("an error occurred while reading message from response: %v", err)
|
||||
}
|
||||
|
||||
return fmt.Errorf("failed to create project %s on %s with user %s: %d %s",
|
||||
c.project, c.dstURL, c.dstUsr, resp.StatusCode, string(message))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user