(rows []policyTableRow, p *policy.Policy, def *policy.Definition)
| 415 | } |
| 416 | |
| 417 | func appendActionsPolicyRows(rows []policyTableRow, p *policy.Policy, def *policy.Definition) []policyTableRow { |
| 418 | var anyActions bool |
| 419 | |
| 420 | if h := p.Actions.BeforeSnapshotRoot; h != nil { |
| 421 | rows = append(rows, |
| 422 | policyTableRow{"Run command before snapshot root:", "", definitionPointToString(p.Target(), def.Actions.BeforeSnapshotRoot)}) |
| 423 | rows = appendActionCommandRows(rows, h) |
| 424 | |
| 425 | anyActions = true |
| 426 | } |
| 427 | |
| 428 | if h := p.Actions.AfterSnapshotRoot; h != nil { |
| 429 | rows = append(rows, policyTableRow{"Run command after snapshot root:", "", definitionPointToString(p.Target(), def.Actions.AfterSnapshotRoot)}) |
| 430 | rows = appendActionCommandRows(rows, h) |
| 431 | |
| 432 | anyActions = true |
| 433 | } |
| 434 | |
| 435 | if h := p.Actions.BeforeFolder; h != nil { |
| 436 | rows = append(rows, policyTableRow{"Run command before this folder:", "", "(non-inheritable)"}) |
| 437 | rows = appendActionCommandRows(rows, h) |
| 438 | |
| 439 | anyActions = true |
| 440 | } |
| 441 | |
| 442 | if h := p.Actions.AfterFolder; h != nil { |
| 443 | rows = append(rows, policyTableRow{"Run command after this folder:", "", "(non-inheritable)"}) |
| 444 | rows = appendActionCommandRows(rows, h) |
| 445 | |
| 446 | anyActions = true |
| 447 | } |
| 448 | |
| 449 | if !anyActions { |
| 450 | rows = append(rows, policyTableRow{"No actions defined.", "", ""}) |
| 451 | } |
| 452 | |
| 453 | return rows |
| 454 | } |
| 455 | |
| 456 | func appendActionCommandRows(rows []policyTableRow, h *policy.ActionCommand) []policyTableRow { |
| 457 | if h.Script != "" { |
no test coverage detected