Remove from parser

This commit is contained in:
Alex Dadgar 2015-12-15 17:20:07 -08:00
parent 197d9f977c
commit fbce019107
5 changed files with 0 additions and 74 deletions

View File

@ -119,7 +119,6 @@ type Job struct {
Constraints []*Constraint
TaskGroups []*TaskGroup
Update *UpdateStrategy
GC bool
Meta map[string]string
Status string
StatusDescription string

View File

@ -91,7 +91,6 @@ func parseJob(result *structs.Job, list *ast.ObjectList) error {
delete(m, "meta")
delete(m, "update")
delete(m, "periodic")
delete(m, "gc")
// Set the ID and name to the object key
result.ID = obj.Keys[0].Token.Value().(string)
@ -136,13 +135,6 @@ func parseJob(result *structs.Job, list *ast.ObjectList) error {
}
}
// If we have a gc config, then parse that
if o := listVal.Filter("gc"); len(o.Items) > 0 {
if err := parseGC(&result.GC, o); err != nil {
return err
}
}
// Parse out meta fields. These are in HCL as a list so we need
// to iterate over them and merge them.
if metaO := listVal.Filter("meta"); len(metaO.Items) > 0 {
@ -722,33 +714,3 @@ func parsePeriodic(result **structs.PeriodicConfig, list *ast.ObjectList) error
*result = &p
return nil
}
func parseGC(result *bool, list *ast.ObjectList) error {
list = list.Elem()
if len(list.Items) > 1 {
return fmt.Errorf("only one 'gc' block allowed per job")
}
// Get our resource object
o := list.Items[0]
var m map[string]interface{}
if err := hcl.DecodeObject(&m, o.Val); err != nil {
return err
}
// Enabled by default if the gc block exists.
enabled := false
if value, ok := m["enabled"]; !ok {
enabled = true
} else {
var err error
enabled, err = parseBool(value)
if err != nil {
return fmt.Errorf("gc.enabled should be set to true or false; %v", err)
}
}
*result = enabled
return nil
}

View File

@ -246,19 +246,6 @@ func TestParse(t *testing.T) {
false,
},
{
"gc.hcl",
&structs.Job{
ID: "foo",
Name: "foo",
Priority: 50,
Region: "global",
Type: "service",
GC: true,
},
false,
},
{
"specify-job.hcl",
&structs.Job{

View File

@ -1,5 +0,0 @@
job "foo" {
gc {
enabled = true
}
}

View File

@ -156,23 +156,6 @@ The `job` object supports the following keys:
and "h" suffix can be used, such as "30s". Both values default to zero,
which disables rolling updates.
* `gc` - Toggles the job's eligibility for garbage collection. This allows jobs
to be garbage collected when all their evaluations and allocations are
terminal. The `gc` block has the following format:
```
"gc" {
// Enabled is set to true by default if the "gc" block is included.
enabled = true
}
// Equivalent configuration.
"gc" {}
```
* `enabled`: Toggles the eligibility of a job for garbage collection.
### Task Group
The `group` object supports the following keys: