From 25b9d829ebdf8f37c83420022b03e232764224f5 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 19 Nov 2021 11:49:00 -0600 Subject: [PATCH] Remove unused config files --- internal/config/basis.go | 33 ---------------------- internal/config/config.go | 56 ++------------------------------------ internal/config/project.go | 33 ---------------------- internal/config/target.go | 12 -------- 4 files changed, 3 insertions(+), 131 deletions(-) delete mode 100644 internal/config/basis.go delete mode 100644 internal/config/project.go delete mode 100644 internal/config/target.go diff --git a/internal/config/basis.go b/internal/config/basis.go deleted file mode 100644 index 13f0950b8..000000000 --- a/internal/config/basis.go +++ /dev/null @@ -1,33 +0,0 @@ -package config - -import ( - "github.com/hashicorp/hcl/v2" - - "github.com/hashicorp/vagrant/internal/server/proto/vagrant_server" -) - -type Basis struct { - // These are new configurations - Location string `hcl:"location,attr"` - Runner *Runner `hcl:"runner,block" default:"{}"` - Labels map[string]string `hcl:"labels,optional"` - - // These should _roughly_ map to existing Vagrantfile configurations - Vagrant *Vagrant `hcl:"vagrant,block"` - Targets []*Target `hcl:"target,block"` - - Body hcl.Body `hcl:",body"` - Remain hcl.Body `hcl:",remain"` - - ref *vagrant_server.Basis - path string - config *Config -} - -func (b *Basis) Ref() *vagrant_server.Basis { - return b.ref -} - -func (b *Basis) Validate() (err error) { - return -} diff --git a/internal/config/config.go b/internal/config/config.go index f2c243ecc..a8a312397 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -11,17 +11,13 @@ import ( "github.com/hashicorp/vagrant/internal/pkg/defaults" ) -// Config is the core configuration -// TODO(spox): We need to do the whole merging thing -// with the config and access things directly -// via the Config, not the Basis or Project +// Config is the core configuration for connecting to the +// Vagrant server/runners. +// This does not include Vagrantfile type config type Config struct { Runner *Runner `hcl:"runner,block" default:"{}"` Labels map[string]string `hcl:"labels,optional"` - Basis *Basis - Project *Project - pathData map[string]string ctx *hcl.EvalContext } @@ -85,49 +81,3 @@ func Load(path string, pwd string) (*Config, error) { return &cfg, nil } - -// Load a project from a configuration file (Vagrantfile) -// func (c *Config) LoadProject(vagrantfile *vagrant_server.Vagrantfile, projectRef *vagrant_server.Ref_Project) (*Project, error) { -// // We require an absolute path for the path so we can set the path vars -// // if !filepath.IsAbs(path) { -// // var err error -// // path, err = filepath.Abs(path) -// // if err != nil { -// // return nil, err -// // } -// // } - -// // // If we have no pwd, then use pwd from basis config -// // if pwd == "" { -// // pwd = c.pathData["pwd"] -// // } -// // // Setup our initial variable set -// // pathData := map[string]string{ -// // "pwd": pwd, -// // "project": filepath.Dir(path), -// // "vagrantfile": path, -// // } - -// // Decode -// // var cfg Project -// // cfg.Location = filepath.Dir(path) - -// machines := []*Machine{} -// for _, el := range vagrantfile.MachineConfigs { -// machines = append(machines, &Machine{Name: el.Name, Box: el.Box}) -// } -// communicators := []*Communicator{} -// for _, el := range vagrantfile.Communicators { -// communicators = append(communicators, &Communicator{Name: el.Name}) -// } - -// return &Project{ -// Location: filepath.Dir(vagrantfile.Path), -// Vagrant: &Vagrant{}, -// Machines: machines, -// Communicators: communicators, -// path: filepath.Dir(vagrantfile.Path), -// config: c, -// ref: projectRef, -// }, nil -// } diff --git a/internal/config/project.go b/internal/config/project.go deleted file mode 100644 index d19d9c1f3..000000000 --- a/internal/config/project.go +++ /dev/null @@ -1,33 +0,0 @@ -package config - -import ( - "github.com/hashicorp/hcl/v2" - - "github.com/hashicorp/vagrant-plugin-sdk/proto/vagrant_plugin_sdk" -) - -type Project struct { - // These are new configurations - Location string `hcl:"location,attr"` - Runner *Runner `hcl:"runner,block" default:"{}"` - Labels map[string]string `hcl:"labels,optional"` - - // These should _roughly_ map to existing Vagrantfile configurations - Vagrant *Vagrant `hcl:"vagrant,block"` - Targets []*Target `hcl:"machine,block"` - - Body hcl.Body `hcl:",body"` - Remain hcl.Body `hcl:",remain"` - - path string - ref *vagrant_plugin_sdk.Ref_Project - config *Config -} - -func (p *Project) Ref() *vagrant_plugin_sdk.Ref_Project { - return p.ref -} - -func (p *Project) Validate() (err error) { - return -} diff --git a/internal/config/target.go b/internal/config/target.go deleted file mode 100644 index 551b75cce..000000000 --- a/internal/config/target.go +++ /dev/null @@ -1,12 +0,0 @@ -package config - -import ( - "github.com/hashicorp/hcl/v2" -) - -type Target struct { - Name string `hcl:"name,label"` - - Body hcl.Body `hcl:",body"` - Remain hcl.Body `hcl:",remain"` -}