(CanonicalPath string)
| 520 | } |
| 521 | |
| 522 | func (l Line) Key(CanonicalPath string) string { |
| 523 | var CommandToRun, RunAs, CronExpression string |
| 524 | if l.IsAutoDiscoverCommand() { |
| 525 | // Go out of our way to prevent making a duplicate monitor for an auto-discovery command. |
| 526 | CommandToRun = "auto discover " + CanonicalPath |
| 527 | RunAs = "" |
| 528 | CronExpression = "" |
| 529 | } else { |
| 530 | CommandToRun = l.CommandToRun |
| 531 | RunAs = l.RunAs |
| 532 | CronExpression = l.CronExpression |
| 533 | } |
| 534 | |
| 535 | // Always use os.Hostname when creating a key so the key does not change when a user modifies their hostname using param/var |
| 536 | hostname, _ := os.Hostname() |
| 537 | data := []byte(fmt.Sprintf("%s-%s-%s-%s", hostname, CommandToRun, CronExpression, RunAs)) |
| 538 | return fmt.Sprintf("%x", sha1.Sum(data)) |
| 539 | } |
| 540 | |
| 541 | func (l Line) GetCode() string { |
| 542 | // Existing integrations will have a code already in the Line struct |
no test coverage detected