MCPcopy Create free account
hub / github.com/flant/shell-operator / SetInitialState

Method SetInitialState

test/hook/context/state.go:37–55  ·  view source on GitHub ↗
(initialState string)

Source from the content-addressed store, hash-verified

35}
36
37func (c *StateController) SetInitialState(initialState string) error {
38 manifests, err := manifest.ListFromYamlDocs(initialState)
39 if err != nil {
40 return fmt.Errorf("create initial state: %v", err)
41 }
42
43 newState := make(map[string]manifest.Manifest)
44
45 for _, m := range manifests {
46 err = c.fakeCluster.Create(m.Namespace(defaultNamespace), m)
47 if err != nil {
48 return fmt.Errorf("create initial state: %v", err)
49 }
50 newState[m.Id()] = m
51 }
52
53 c.CurrentState = newState
54 return nil
55}
56
57// ChangeState apply changes to current objects state
58func (c *StateController) ChangeState(newRawState string) error {

Callers 1

RunMethod · 0.80

Calls 1

CreateMethod · 0.80

Tested by

no test coverage detected