(d map[string]interface{})
| 633 | } |
| 634 | |
| 635 | func (t *cmdDashboard) handleSentinelCommand(d map[string]interface{}) { |
| 636 | c := t.newTopomClient() |
| 637 | |
| 638 | switch { |
| 639 | |
| 640 | case d["--sentinel-add"].(bool): |
| 641 | |
| 642 | addr := utils.ArgumentMust(d, "--addr") |
| 643 | |
| 644 | log.Debugf("call rpc add-sentinel to dashboard %s", t.addr) |
| 645 | if err := c.AddSentinel(addr); err != nil { |
| 646 | log.PanicErrorf(err, "call rpc add-sentinel to dashboard %s failed", t.addr) |
| 647 | } |
| 648 | log.Debugf("call rpc add-sentinel OK") |
| 649 | |
| 650 | case d["--sentinel-del"].(bool): |
| 651 | |
| 652 | addr := utils.ArgumentMust(d, "--addr") |
| 653 | |
| 654 | force := d["--force"].(bool) |
| 655 | |
| 656 | log.Debugf("call rpc del-sentinel to dashboard %s", t.addr) |
| 657 | if err := c.DelSentinel(addr, force); err != nil { |
| 658 | log.PanicErrorf(err, "call rpc del-sentinel to dashboard %s failed", t.addr) |
| 659 | } |
| 660 | log.Debugf("call rpc del-sentinel OK") |
| 661 | |
| 662 | case d["--sentinel-resync"].(bool): |
| 663 | |
| 664 | log.Debugf("call rpc resync-sentinels to dashboard %s", t.addr) |
| 665 | if err := c.ResyncSentinels(); err != nil { |
| 666 | log.PanicErrorf(err, "call rpc resync-sentinels to dashboard %s failed", t.addr) |
| 667 | } |
| 668 | log.Debugf("call rpc resync-sentinels OK") |
| 669 | |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | func (t *cmdDashboard) handleSyncActionCommand(d map[string]interface{}) { |
| 674 | c := t.newTopomClient() |
no test coverage detected