MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / ListVariables

Method ListVariables

datasource/etcd_machine.go:186–203  ·  view source on GitHub ↗

ListFlags returns the list of all the flgas of a machine from Etcd etcd and machine prefix will be added to the path

()

Source from the content-addressed store, hash-verified

184// ListFlags returns the list of all the flgas of a machine from Etcd
185// etcd and machine prefix will be added to the path
186func (m *etcdMachineInterface) ListVariables() (map[string]string, error) {
187 ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
188 defer cancel()
189
190 response, err := m.keysAPI.Get(ctx, path.Join(m.etcdDS.ClusterName(),
191 "machines", m.Hostname()), nil)
192 if err != nil {
193 return nil, err
194 }
195
196 flags := make(map[string]string)
197 for i := range response.Node.Nodes {
198 _, k := path.Split(response.Node.Nodes[i].Key)
199 flags[k] = response.Node.Nodes[i].Value
200 }
201
202 return flags, nil
203}
204
205// GetVariable Gets a machine's variable, or the global if it was not
206// set for the machine

Callers

nothing calls this directly

Calls 2

HostnameMethod · 0.95
ClusterNameMethod · 0.65

Tested by

no test coverage detected