GetVariable Gets a machine's variable, or the global if it was not set for the machine
(key string)
| 205 | // GetVariable Gets a machine's variable, or the global if it was not |
| 206 | // set for the machine |
| 207 | func (m *etcdMachineInterface) GetVariable(key string) (string, error) { |
| 208 | value, err := m.selfGet(key) |
| 209 | |
| 210 | if err != nil { |
| 211 | if !etcd.IsKeyNotFound(err) { |
| 212 | return "", fmt.Errorf( |
| 213 | "error while getting variable key=%s for machine=%s: %s", |
| 214 | key, m.mac, err) |
| 215 | } |
| 216 | |
| 217 | // Key was not found for the machine |
| 218 | value, err := m.etcdDS.GetClusterVariable(key) |
| 219 | if err != nil { |
| 220 | if !etcd.IsKeyNotFound(err) { |
| 221 | return "", fmt.Errorf( |
| 222 | "error while getting variable key=%s for machine=%s (global check): %s", |
| 223 | key, m.mac, err) |
| 224 | |
| 225 | } |
| 226 | return "", nil // Not set, not for machine, nor globally |
| 227 | } |
| 228 | return value, nil |
| 229 | } |
| 230 | |
| 231 | return value, nil |
| 232 | } |
| 233 | |
| 234 | // SetVariable sets the value of the specified key |
| 235 | func (m *etcdMachineInterface) SetVariable(key, value string) error { |
nothing calls this directly
no test coverage detected