604ef7ecb4
FetchNetworkConfig is currently only used by ConfigDrive to read the network config file from the disk.
45 lines
777 B
Go
45 lines
777 B
Go
package url
|
|
|
|
import (
|
|
"github.com/coreos/coreos-cloudinit/pkg"
|
|
)
|
|
|
|
type remoteFile struct {
|
|
url string
|
|
}
|
|
|
|
func NewDatasource(url string) *remoteFile {
|
|
return &remoteFile{url}
|
|
}
|
|
|
|
func (f *remoteFile) IsAvailable() bool {
|
|
client := pkg.NewHttpClient()
|
|
_, err := client.Get(f.url)
|
|
return (err == nil)
|
|
}
|
|
|
|
func (f *remoteFile) AvailabilityChanges() bool {
|
|
return true
|
|
}
|
|
|
|
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.GetRetry(f.url)
|
|
}
|
|
|
|
func (f *remoteFile) FetchNetworkConfig(filename string) ([]byte, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (f *remoteFile) Type() string {
|
|
return "url"
|
|
}
|