set local_file bundleconfig to true if target prefix is file:// (#823)

set local file bundleconfig to true if target prefix is file://

Signed-off-by: Santhosh <santhosh@spectrocloud.com>
This commit is contained in:
Santhosh 2023-02-07 18:13:03 +05:30 committed by Itxaka
parent b37a34beae
commit 0a62e316e0

View File

@ -20,7 +20,10 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
const DefaultWebUIListenAddress = ":8080" const (
DefaultWebUIListenAddress = ":8080"
FilePrefix = "file://"
)
type Install struct { type Install struct {
Auto bool `yaml:"auto,omitempty"` Auto bool `yaml:"auto,omitempty"`
@ -53,11 +56,11 @@ type Config struct {
type Bundles []Bundle type Bundles []Bundle
type Bundle struct { type Bundle struct {
Repository string `yaml:"repository,omitempty"` Repository string `yaml:"repository,omitempty"`
Rootfs string `yaml:"rootfs_path,omitempty"` Rootfs string `yaml:"rootfs_path,omitempty"`
DB string `yaml:"db_path,omitempty"` DB string `yaml:"db_path,omitempty"`
LocalFile bool `yaml:"local_file,omitempty"`
Targets []string `yaml:"targets,omitempty"` Targets []string `yaml:"targets,omitempty"`
} }
const DefaultHeader = "#cloud-config" const DefaultHeader = "#cloud-config"
@ -84,6 +87,9 @@ func (b Bundles) Options() (res [][]bundles.BundleOption) {
if bundle.DB != "" { if bundle.DB != "" {
opts = append(opts, bundles.WithDBPath(bundle.DB)) opts = append(opts, bundles.WithDBPath(bundle.DB))
} }
if bundle.LocalFile {
opts = append(opts, bundles.WithLocalFile(true))
}
res = append(res, opts) res = append(res, opts)
} }
} }