ec2: allow spaces seperated hostname in metadata
AWS hostname metadata will return space seperated hostname and domain names when DHCPOptionSet is using multiple domain names. This patch will cater for this scenario.
This commit is contained in:
@@ -69,7 +69,7 @@ func (ms metadataService) FetchMetadata() ([]byte, error) {
|
||||
}
|
||||
|
||||
if hostname, err := ms.fetchAttribute(fmt.Sprintf("%s/hostname", ms.MetadataUrl())); err == nil {
|
||||
attrs["hostname"] = hostname
|
||||
attrs["hostname"] = strings.Split(hostname, " ")[0]
|
||||
} else if _, ok := err.(pkg.ErrNotFound); !ok {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user