Browse Source

jpictl: only load Machine.PublicAddresses for `jpictl dump`

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/5/head
Alejandro Mery 1 year ago
parent
commit
6e46d23b45
  1. 6
      cmd/jpictl/config.go
  2. 2
      cmd/jpictl/dump.go
  3. 2
      cmd/jpictl/env.go
  4. 2
      cmd/jpictl/write.go

6
cmd/jpictl/config.go

@ -14,6 +14,8 @@ var cfg = &Config{
}
// LoadZones loads all zones and machines in the config directory
func (cfg *Config) LoadZones() (*zones.Zones, error) {
return zones.New(cfg.Base, cfg.Domain)
func (cfg *Config) LoadZones(resolve bool) (*zones.Zones, error) {
return zones.New(cfg.Base, cfg.Domain,
zones.ResolvePublicAddresses(resolve),
)
}

2
cmd/jpictl/dump.go

@ -58,7 +58,7 @@ var dumpCmd = &cobra.Command{
var buf bytes.Buffer
var enc Encoder
m, err := cfg.LoadZones()
m, err := cfg.LoadZones(true)
if err != nil {
return err
}

2
cmd/jpictl/env.go

@ -11,7 +11,7 @@ var envCmd = &cobra.Command{
Use: "env",
Short: "generates environment variables for shell scripts",
RunE: func(_ *cobra.Command, _ []string) error {
m, err := cfg.LoadZones()
m, err := cfg.LoadZones(false)
if err != nil {
return err
}

2
cmd/jpictl/write.go

@ -9,7 +9,7 @@ var writeCmd = &cobra.Command{
Use: "write",
Short: "rewrites all config files",
RunE: func(_ *cobra.Command, _ []string) error {
m, err := cfg.LoadZones()
m, err := cfg.LoadZones(false)
if err != nil {
return err
}

Loading…
Cancel
Save