361edeebc6
Move the old metadata-service datasource to url datasource. This new datasource checks for the existance of meta-data.json and if it doesn't exist, walks the meta-data directory to build a metadata blob.
29 lines
487 B
Go
29 lines
487 B
Go
package datasource
|
|
|
|
import "github.com/coreos/coreos-cloudinit/pkg"
|
|
|
|
type remoteFile struct {
|
|
url string
|
|
}
|
|
|
|
func NewRemoteFile(url string) *remoteFile {
|
|
return &remoteFile{url}
|
|
}
|
|
|
|
func (f *remoteFile) ConfigRoot() string {
|
|
return ""
|
|
}
|
|
|
|
func (f *remoteFile) FetchMetadata() ([]byte, error) {
|
|
return []byte{}, nil
|
|
}
|
|
|
|
func (f *remoteFile) FetchUserdata() ([]byte, error) {
|
|
client := pkg.NewHttpClient()
|
|
return client.Get(f.url)
|
|
}
|
|
|
|
func (f *remoteFile) Type() string {
|
|
return "url"
|
|
}
|