Пример #1
0
func (s Salt) UpdateMonitoringConfiguration(nodes []string, config []monitoring.Plugin) (failed_nodes []string, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	var pyobj *python.PyObject
	if pyobj, err = pyFuncs["UpdateMonitoringConfiguration"].Call(nodes, monitoring.ToSaltPillarCompat(config)); err == nil {
		err = gopy.Convert(pyobj, &failed_nodes)
	}
	return
}
Пример #2
0
func (s Salt) IgnoreNode(node string) (status bool, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["IgnoreNode"].Call(node); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		err = loc_err
	}
	return
}
Пример #3
0
func (s Salt) GetNodeMemory(node string) (memory backend.Memory, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodeMemory"].Call(node); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &memory)
	} else {
		err = loc_err
	}
	return
}
Пример #4
0
func (s Salt) GetNodeNetwork(node string) (n backend.Network, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodeNetwork"].Call(node); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &n)
	} else {
		err = loc_err
	}
	return
}
Пример #5
0
func (s Salt) GetNodeOs(node string) (os backend.OperationSystem, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodeOs"].Call(node); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &os)
	} else {
		err = loc_err
	}
	return
}
Пример #6
0
func (s Salt) GetNodeCpu(node string) (cpu []backend.Cpu, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodeCpu"].Call(node); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &cpu)
	} else {
		err = loc_err
	}
	return
}
Пример #7
0
func (s Salt) GetNodes() (nodes backend.NodeList, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodes"].Call(); loc_err == nil {
		err = gopy.Convert(pyobj, &nodes)
	} else {
		err = loc_err
	}
	return
}
Пример #8
0
func (s Salt) AcceptNode(node string, fingerprint string, ignored bool) (status bool, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["AcceptNode"].Call(node, fingerprint, ignored); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		status = false
		err = loc_err
	}
	return
}
Пример #9
0
func (s Salt) EnableService(node string, service string, start bool) (status bool, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["EnableService"].Call(node, service, start); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		status = false
		err = loc_err
	}
	return
}
Пример #10
0
func (s Salt) EnableMonitoringPlugin(nodes []string, pluginName string) (failed_nodes map[string]string, err error) {
	failed_nodes = make(map[string]string)
	mutex.Lock()
	defer mutex.Unlock()
	pyobj, loc_err := pyFuncs["EnableMonitoringPlugin"].Call(nodes, pluginName)
	if loc_err == nil {
		err = gopy.Convert(pyobj, &failed_nodes)
	} else {
		err = loc_err
	}
	return
}
Пример #11
0
func (s Salt) AddMonitoringPlugin(pluginNames []string, nodes []string, master string, pluginMap map[string]map[string]string) (failed_nodes map[string]interface{}, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	failed_nodes = make(map[string]interface{})
	pyobj, loc_err := pyFuncs["AddMonitoringPlugin"].Call(pluginNames, nodes, master, pluginMap)
	if loc_err == nil {
		err = gopy.Convert(pyobj, &failed_nodes)
	} else {
		err = loc_err
	}
	return
}
Пример #12
0
func (s Salt) GetNodeID(node string) (id uuid.UUID, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	pyobj, loc_err := pyFuncs["GetNodeID"].Call(node)
	if loc_err == nil {
		var s string
		loc_err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &s)
		if loc_err == nil {
			if i, loc_err := uuid.Parse(s); loc_err == nil {
				return *i, nil
			}
		}
	}
	return uuid.UUID{}, loc_err
}