// ToolsURL returns a valid tools URL constructed from source. // source may be a directory, or a URL like file://foo or http://foo. func ToolsURL(source string) (string, error) { if source == "" { return "", nil } return envutils.GetURL(source, storage.BaseToolsPath) }
// ImageMetadataURL returns a valid image metadata URL constructed from source. // source may be a directory, or a URL like file://foo or http://foo. func ImageMetadataURL(source, stream string) (string, error) { if source == "" { return "", nil } // If the image metadata is coming from the official cloud images site, // set up the correct path according to the images stream requested. if source == UbuntuCloudImagesURL || source == JujuStreamsImagesURL { cloudImagesPath := ReleasedImagesPath if stream != "" && stream != ReleasedStream { cloudImagesPath = stream } source = fmt.Sprintf("%s/%s", source, cloudImagesPath) } return utils.GetURL(source, storage.BaseImagesPath) }