MCPcopy
hub / github.com/XiaoMi/naftis / apply

Method apply

src/api/executor/istiocrd.go:200–223  ·  view source on GitHub ↗
(task Task, t taskDbHandler)

Source from the content-addressed store, hash-verified

198}
199
200func (i *istiocrdExecutor) apply(task Task, t taskDbHandler) (errs error) {
201 task.Status = model.TaskStatusSucc
202 defer func() {
203 if errs != nil {
204 task.Status = model.TaskStatusFail
205 }
206 t(&task)
207 }()
208
209 // ignore k8s configuration. TODO support k8s configuration
210 varr, _, err := crd.ParseInputs(task.Content)
211 if err != nil {
212 return err
213 }
214 if len(varr) == 0 {
215 return errors.New("nothing to execute")
216 }
217
218 if err := i.create(varr, &task); err != nil {
219 return i.replace(varr, &task)
220 }
221
222 return
223}
224
225func (i *istiocrdExecutor) yamlOutput(configList []istiomodel.Config) string {
226 buf := bytes.NewBuffer([]byte{})

Callers 15

ExecuteMethod · 0.95
cola.min.jsFile · 0.80
bFunction · 0.80
eFunction · 0.80
DFunction · 0.80
znFunction · 0.80
uFunction · 0.80
aFunction · 0.80
QnFunction · 0.80
FiFunction · 0.80
WoFunction · 0.80
KoFunction · 0.80

Calls 3

createMethod · 0.95
replaceMethod · 0.95
tFunction · 0.50

Tested by

no test coverage detected