Beispiel #1
0
func (m *SystemdManager) getJobStateFromUnit(u *SystemdUnit) *job.JobState {
	loadState, activeState, subState, sockets, err := (*u).State()
	if err != nil {
		log.V(1).Infof("Failed to get state for unit %s", (*u).Name())
		return nil
	} else {
		return job.NewJobState(loadState, activeState, subState, sockets, m.Machine)
	}
}
Beispiel #2
0
func (t *Target) GetJobState(name string) *job.JobState {
	info, err := t.Systemd.GetUnitInfo(unitPath(name + ".service"))

	if err != nil {
		return nil
	}

	stateString := info["ActiveState"].Value().(string)
	return job.NewJobState(stateString, t.Machine)
}