Пример #1
0
func (s Salt) GetNodeNetwork(node string, ctxt string) (n models.Network, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodeNetwork"].Call(node, ctxt); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &n)
	} else {
		err = loc_err
	}
	return
}
Пример #2
0
func (s Salt) GetNodeMemory(node string, ctxt string) (memory models.Memory, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodeMemory"].Call(node, ctxt); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &memory)
	} else {
		err = loc_err
	}
	return
}
Пример #3
0
func (c Salt) GetJournalDeviceDetails(node string, journalPath string, ctxt string) (devDet backend.DeviceDetail, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetJournalDeviceDetails"].Call(node, journalPath, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &devDet)
	} else {
		err = loc_err
	}
	return
}
Пример #4
0
func (s Salt) NodeUptime(node string, ctxt string) (uptime string, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["NodeUptime"].Call(node, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &uptime)
	} else {
		err = loc_err
	}
	return
}
Пример #5
0
func (s Salt) GetFingerPrint(node string, ctxt string) (fingerprint string, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetFingerPrint"].Call(node, ctxt); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &fingerprint)
	} else {
		err = loc_err
	}
	return
}
Пример #6
0
func (s Salt) SetupSkynetService(node string, ctxt string) (status bool, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["SetupSkynetService"].Call(node, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		err = loc_err
	}
	return
}
Пример #7
0
func (s Salt) GetNodes(ctxt string) (nodes backend.NodeList, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodes"].Call(ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &nodes)
	} else {
		err = loc_err
	}
	return
}
Пример #8
0
func (s Salt) GetNodeOs(node string, ctxt string) (os models.OperatingSystem, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetNodeOs"].Call(node, ctxt); loc_err == nil {
		err = gopy.Convert(python.PyDict_GetItemString(pyobj, node), &os)
	} else {
		err = loc_err
	}
	return
}
Пример #9
0
func (c Salt) GetServiceCount(Hostname string, ctxt string) (service_details map[string]int, err error) {
	service_details = make(map[string]int)
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetServiceCount"].Call(Hostname, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &service_details)
	} else {
		err = loc_err
	}
	return
}
Пример #10
0
func (s Salt) UpdateMonitoringConfiguration(nodes []string, config []monitoring.Plugin, ctxt string) (failed_nodes map[string]string, err error) {
	failed_nodes = make(map[string]string)
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["UpdateMonitoringConfiguration"].Call(nodes, monitoring.ToSaltPillarCompat(config), ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &failed_nodes)
	} else {
		err = loc_err
	}
	return
}
Пример #11
0
func (s Salt) ListPoolNames(mon string, clusterName string, ctxt string) (names []string, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["ListPool"].Call(mon, clusterName, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &names)
	} else {
		err = loc_err
	}

	return
}
Пример #12
0
func (s Salt) SyncModules(node string, ctxt string) (status bool, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["SyncModules"].Call(node, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		status = false
		err = loc_err
	}
	return
}
Пример #13
0
func (s Salt) AcceptNode(node string, fingerprint string, ignored bool, ctxt string) (status bool, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["AcceptNode"].Call(node, fingerprint, ignored, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		status = false
		err = loc_err
	}
	return
}
Пример #14
0
func (s Salt) GetCpuMetricFromCollectd(nodes []string, ctxt string) (result map[string]models.CollectdCpuMetric, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	result = make(map[string]models.CollectdCpuMetric)
	if pyobj, loc_err := pyFuncs["GetSingleValuedMetricFromCollectd"].Call(nodes, monitoring.CPU, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &result)
	} else {
		err = loc_err
	}
	return
}
Пример #15
0
func (s Salt) EnableService(node string, service string, start bool, ctxt string) (status bool, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["EnableService"].Call(node, service, start, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		status = false
		err = loc_err
	}
	return
}
Пример #16
0
func (s Salt) GetSingleValuedMetricFromCollectd(nodes []string, metricName string, ctxt string) (result map[string]models.CollectdSingleValuedMetric, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	result = make(map[string]models.CollectdSingleValuedMetric)
	if pyobj, loc_err := pyFuncs["GetSingleValuedMetricFromCollectd"].CallWithTimeOut(5*time.Minute, nodes, metricName, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &result)
	} else {
		err = loc_err
	}
	return
}
Пример #17
0
func (s Salt) GetClusterStatus(mon string, clusterId uuid.UUID, clusterName string, ctxt string) (status string, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	if pyobj, loc_err := pyFuncs["GetClusterStatus"].Call(mon, clusterName, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &status)
	} else {
		err = loc_err
	}

	return
}
Пример #18
0
func (s Salt) RemoveMonitoringPlugin(nodes []string, pluginName string, ctxt string) (failed_nodes map[string]string, err error) {
	failed_nodes = make(map[string]string)
	mutex.Lock()
	defer mutex.Unlock()
	pyobj, loc_err := pyFuncs["RemoveMonitoringPlugin"].Call(nodes, pluginName, ctxt)
	if loc_err == nil {
		err = gopy.Convert(pyobj, &failed_nodes)
	} else {
		err = loc_err
	}
	return
}
Пример #19
0
func (s Salt) AddMonitoringPlugin(pluginNames []string, nodes []string, master string, pluginMap map[string]map[string]string, ctxt 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, ctxt)
	if loc_err == nil {
		err = gopy.Convert(pyobj, &failed_nodes)
	} else {
		err = loc_err
	}
	return
}
Пример #20
0
func (s Salt) AddOSD(clusterName string, osd backend.OSD, ctxt string) (osds map[string][]string, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	osdMap := make(map[string][]string)
	if pyobj, loc_err := pyFuncs["AddOSD"].Call(clusterName, osd, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &osdMap)
		osds = osdMap
	} else {
		err = loc_err
	}

	return
}
Пример #21
0
func (s Salt) GetOSDDetails(mon string, clusterName string, ctxt string) (osds []backend.OSDDetails, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	defer func() {
		if r := recover(); r != nil {
			err = fmt.Errorf("Recovered from %v in GetOSDDetails", r)
		}
	}()
	if pyobj, loc_err := pyFuncs["GetOSDDetails"].Call(mon, clusterName, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &osds)
	} else {
		err = loc_err
	}
	return
}
Пример #22
0
func (s Salt) GetNodeID(node string, ctxt string) (id uuid.UUID, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	pyobj, loc_err := pyFuncs["GetNodeID"].Call(node, ctxt)
	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
}
Пример #23
0
func (s Salt) GetClusterStats(mon string, clusterName string, ctxt string) (stats backend.ClusterUtilization, err error) {
	stats = backend.ClusterUtilization{}
	mutex.Lock()
	defer mutex.Unlock()
	defer func() {
		if r := recover(); r != nil {
			err = fmt.Errorf("Recovered from %v in GetClusterStats", r)
		}
	}()
	if pyobj, loc_err := pyFuncs["GetClusterStats"].Call(mon, clusterName, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &stats)
	} else {
		err = loc_err
	}

	return
}
Пример #24
0
func (s Salt) GetObjectCount(mon string, clusterName string, ctxt string) (obj map[string]int64, err error) {
	mutex.Lock()
	defer mutex.Unlock()
	defer func() {
		if r := recover(); r != nil {
			err = fmt.Errorf("Recovered from %v in GetObjectCount", r)
		}
	}()
	obj = make(map[string]int64)
	if pyobj, loc_err := pyFuncs["GetObjectCount"].Call(mon, clusterName, ctxt); loc_err == nil {
		err = gopy.Convert(pyobj, &obj)
	} else {
		err = loc_err
	}

	return
}