lang: Initial implementation of the mgmt language
This is an initial implementation of the mgmt language. It is a declarative (immutable) functional, reactive, domain specific programming language. It is intended to be a language that is: * safe * powerful * easy to reason about With these properties, we hope this language, and the mgmt engine will allow you to model the real-time systems that you'd like to automate. This also includes a number of other associated changes. Sorry for the large size of this patch.
This commit is contained in:
14
hcl/parse.go
14
hcl/parse.go
@@ -19,7 +19,6 @@ package hcl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
@@ -27,7 +26,7 @@ import (
|
||||
"github.com/hashicorp/hcl/hcl/ast"
|
||||
"github.com/hashicorp/hil"
|
||||
"github.com/purpleidea/mgmt/gapi"
|
||||
hv "github.com/purpleidea/mgmt/hil"
|
||||
hv "github.com/purpleidea/mgmt/hcl/hil"
|
||||
"github.com/purpleidea/mgmt/pgraph"
|
||||
"github.com/purpleidea/mgmt/resources"
|
||||
)
|
||||
@@ -236,14 +235,9 @@ func graphFromConfig(c *Config, data gapi.Data) (*pgraph.Graph, error) {
|
||||
return graph, nil
|
||||
}
|
||||
|
||||
func loadHcl(f *string) (*Config, error) {
|
||||
if f == nil {
|
||||
return nil, fmt.Errorf("empty file given")
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(*f)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to read file: %v", err)
|
||||
func loadHcl(data []byte) (*Config, error) {
|
||||
if len(data) == 0 {
|
||||
return nil, fmt.Errorf("empty data given")
|
||||
}
|
||||
|
||||
file, err := hcl.ParseBytes(data)
|
||||
|
||||
Reference in New Issue
Block a user