noop as resource meta param
first part of #21 tested with example/noop1.yaml on CentOS 6
This commit is contained in:
committed by
James Shubin
parent
1584f20220
commit
6bbce039aa
24
examples/noop1.yaml
Normal file
24
examples/noop1.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
graph: mygraph
|
||||||
|
comment: noop example
|
||||||
|
resources:
|
||||||
|
noop:
|
||||||
|
- name: noop1
|
||||||
|
meta:
|
||||||
|
noop: true
|
||||||
|
file:
|
||||||
|
- name: file1
|
||||||
|
path: "/tmp/mgmt-hello-noop"
|
||||||
|
content: |
|
||||||
|
hello world from @purpleidea
|
||||||
|
state: exists
|
||||||
|
meta:
|
||||||
|
noop: true
|
||||||
|
edges:
|
||||||
|
- name: e1
|
||||||
|
from:
|
||||||
|
kind: noop
|
||||||
|
name: noop1
|
||||||
|
to:
|
||||||
|
kind: file
|
||||||
|
name: file1
|
||||||
@@ -729,7 +729,7 @@ func (g *Graph) Process(v *Vertex) {
|
|||||||
|
|
||||||
obj.SetState(resStateCheckApply)
|
obj.SetState(resStateCheckApply)
|
||||||
// if this fails, don't UpdateTimestamp()
|
// if this fails, don't UpdateTimestamp()
|
||||||
checkok, err := obj.CheckApply(true)
|
checkok, err := obj.CheckApply(!obj.GetMeta().Noop)
|
||||||
if checkok && err != nil { // should never return this way
|
if checkok && err != nil { // should never return this way
|
||||||
log.Fatalf("%v[%v]: CheckApply(): %t, %+v", obj.Kind(), obj.GetName(), checkok, err)
|
log.Fatalf("%v[%v]: CheckApply(): %t, %+v", obj.Kind(), obj.GetName(), checkok, err)
|
||||||
}
|
}
|
||||||
@@ -745,6 +745,11 @@ func (g *Graph) Process(v *Vertex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// when noop is true we always want to update timestamp
|
||||||
|
if obj.GetMeta().Noop && err == nil {
|
||||||
|
ok = true
|
||||||
|
}
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
// update this timestamp *before* we poke or the poked
|
// update this timestamp *before* we poke or the poked
|
||||||
// nodes might fail due to having a too old timestamp!
|
// nodes might fail due to having a too old timestamp!
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ type AutoEdge interface {
|
|||||||
type MetaParams struct {
|
type MetaParams struct {
|
||||||
AutoEdge bool `yaml:"autoedge"` // metaparam, should we generate auto edges? // XXX should default to true
|
AutoEdge bool `yaml:"autoedge"` // metaparam, should we generate auto edges? // XXX should default to true
|
||||||
AutoGroup bool `yaml:"autogroup"` // metaparam, should we auto group? // XXX should default to true
|
AutoGroup bool `yaml:"autogroup"` // metaparam, should we auto group? // XXX should default to true
|
||||||
|
Noop bool `yaml:"noop"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// this interface is everything that is common to all resources
|
// this interface is everything that is common to all resources
|
||||||
|
|||||||
Reference in New Issue
Block a user