mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
Automatic merge from release/2.6.0 -> release/2.7.0
* commit 'f6fedf390f43e2ea1c0ef55b67f00bc7bdd5dfad': fix: 1. remote file will retry glance if peer url is not available 2. ssh authorized keys ends with \n
This commit is contained in:
@@ -2838,6 +2838,7 @@ func (self *SHost) AllowPerformAddNetif(ctx context.Context,
|
||||
}
|
||||
|
||||
func (self *SHost) PerformAddNetif(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
log.Debugf("add_netif %s", data)
|
||||
mac, _ := data.GetString("mac")
|
||||
if len(mac) == 0 || len(netutils.FormatMacAddr(mac)) == 0 {
|
||||
return nil, httperrors.NewBadRequestError("Invaild mac address")
|
||||
|
||||
@@ -182,5 +182,5 @@ func MergeAuthorizedKeys(oldKeys string, pubkeys *sshkeys.SSHKeys) string {
|
||||
for _, val := range allkeys {
|
||||
keys = append(keys, val)
|
||||
}
|
||||
return strings.Join(keys, "\n")
|
||||
return strings.Join(keys, "\n") + "\n"
|
||||
}
|
||||
|
||||
@@ -147,7 +147,19 @@ func (r *SRemoteFile) fetch(preChksum string) bool {
|
||||
return fetchSucc
|
||||
}
|
||||
|
||||
// retry download
|
||||
func (r *SRemoteFile) download(getData bool, preChksum string) bool {
|
||||
result := r.downloadInternal(getData, preChksum)
|
||||
if !result && len(r.downloadUrl) > 0 {
|
||||
log.Errorf("download from cached url %s failed, try direct download from %s ...", r.downloadUrl, r.url)
|
||||
r.downloadUrl = ""
|
||||
result = r.downloadInternal(getData, preChksum)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (r *SRemoteFile) downloadInternal(getData bool, preChksum string) bool {
|
||||
os.Remove(r.tmpPath)
|
||||
fi, err := os.Create(r.tmpPath)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
|
||||
Reference in New Issue
Block a user