mirror of
https://github.com/rancher/os.git
synced 2025-07-03 10:06:13 +00:00
Sort SSH keys from metadata so that diff functions will be consistent
This commit is contained in:
parent
b7bbad4072
commit
618cd741d8
@ -4,6 +4,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
@ -109,13 +110,23 @@ func mergeMetadata(cc *CloudConfig, md datasource.Metadata) *CloudConfig {
|
|||||||
out.Hostname = md.Hostname
|
out.Hostname = md.Hostname
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, key := range md.SSHPublicKeys {
|
|
||||||
|
// Sort SSH keys by key name
|
||||||
|
keys := []string{}
|
||||||
|
for k := range md.SSHPublicKeys {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Sort(sort.StringSlice(keys))
|
||||||
|
|
||||||
|
for _, k := range keys {
|
||||||
if !dirty {
|
if !dirty {
|
||||||
out = &(*cc)
|
out = &(*cc)
|
||||||
dirty = true
|
dirty = true
|
||||||
}
|
}
|
||||||
out.SSHAuthorizedKeys = append(out.SSHAuthorizedKeys, key)
|
out.SSHAuthorizedKeys = append(out.SSHAuthorizedKeys, md.SSHPublicKeys[k])
|
||||||
}
|
}
|
||||||
|
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user