hcl: Added basic hcl frontend

This commit is contained in:
ChrisMcKenzie
2017-06-09 08:47:51 -07:00
committed by ChrisMcKenzie
parent a8bbb22fe8
commit bc1a1d1818
5 changed files with 530 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import (
"os/signal"
"syscall"
"github.com/purpleidea/mgmt/hcl"
"github.com/purpleidea/mgmt/puppet"
"github.com/purpleidea/mgmt/yamlgraph"
"github.com/purpleidea/mgmt/yamlgraph2"
@@ -89,6 +90,14 @@ func run(c *cli.Context) error {
PuppetConf: c.String("puppet-conf"),
}
}
if h := c.String("hcl"); c.IsSet("hcl") {
if obj.GAPI != nil {
return fmt.Errorf("can't combine hcl GAPI with existing GAPI")
}
obj.GAPI = &hcl.GAPI{
File: &h,
}
}
obj.Remotes = c.StringSlice("remote") // FIXME: GAPI-ify somehow?
obj.NoWatch = c.Bool("no-watch")
@@ -222,6 +231,11 @@ func CLI(program, version string, flags Flags) error {
Value: "",
Usage: "yaml graph definition to run (parser v2)",
},
cli.StringFlag{
Name: "hcl",
Value: "",
Usage: "hcl graph definition to run",
},
cli.StringFlag{
Name: "puppet, p",
Value: "",