(d map[string]interface{})
| 37 | } |
| 38 | |
| 39 | func (t *cmdAdmin) newTopomClient(d map[string]interface{}) models.Client { |
| 40 | var coordinator struct { |
| 41 | name string |
| 42 | addr string |
| 43 | auth string |
| 44 | } |
| 45 | |
| 46 | switch { |
| 47 | case d["--zookeeper"] != nil: |
| 48 | coordinator.name = "zookeeper" |
| 49 | coordinator.addr = utils.ArgumentMust(d, "--zookeeper") |
| 50 | if d["--zookeeper-auth"] != nil { |
| 51 | coordinator.auth = utils.ArgumentMust(d, "--zookeeper-auth") |
| 52 | } |
| 53 | |
| 54 | case d["--etcd"] != nil: |
| 55 | coordinator.name = "etcd" |
| 56 | coordinator.addr = utils.ArgumentMust(d, "--etcd") |
| 57 | if d["--etcd-auth"] != nil { |
| 58 | coordinator.auth = utils.ArgumentMust(d, "--etcd-auth") |
| 59 | } |
| 60 | |
| 61 | case d["--filesystem"] != nil: |
| 62 | coordinator.name = "filesystem" |
| 63 | coordinator.addr = utils.ArgumentMust(d, "--filesystem") |
| 64 | |
| 65 | default: |
| 66 | log.Panicf("invalid coordinator") |
| 67 | } |
| 68 | |
| 69 | c, err := models.NewClient(coordinator.name, coordinator.addr, coordinator.auth, time.Minute) |
| 70 | if err != nil { |
| 71 | log.PanicErrorf(err, "create '%s' client to '%s' failed", coordinator.name, coordinator.addr) |
| 72 | } |
| 73 | return c |
| 74 | } |
| 75 | |
| 76 | func (t *cmdAdmin) newTopomStore(d map[string]interface{}) *models.Store { |
| 77 | if err := models.ValidateProduct(t.product); err != nil { |
no test coverage detected