-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Isolate taskmaster package to localmachine collector, to enable other…
… OS builds again
- Loading branch information
1 parent
f2cd313
commit 195fb65
Showing
4 changed files
with
624 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package collect | ||
|
||
import ( | ||
"github.com/amidaware/taskmaster" | ||
"github.com/lkarlslund/adalanche/modules/integrations/localmachine" | ||
) | ||
|
||
func ConvertRegisteredTask(rt taskmaster.RegisteredTask) localmachine.RegisteredTask { | ||
return localmachine.RegisteredTask{ | ||
Name: rt.Name, | ||
Path: rt.Path, | ||
Definition: localmachine.TaskDefinition{ | ||
Actions: func() []string { | ||
a := make([]string, len(rt.Definition.Actions)) | ||
for i, v := range rt.Definition.Actions { | ||
a[i] = v.GetType().String() | ||
} | ||
return a | ||
}(), | ||
Context: rt.Definition.Context, | ||
Data: rt.Definition.Data, | ||
Principal: localmachine.Principal{ | ||
Name: rt.Definition.Principal.Name, | ||
GroupID: rt.Definition.Principal.GroupID, | ||
ID: rt.Definition.Principal.ID, | ||
LogonType: int(rt.Definition.Principal.LogonType), | ||
RunLevel: int(rt.Definition.Principal.RunLevel), | ||
UserID: rt.Definition.Principal.UserID, | ||
}, | ||
RegistrationInfo: localmachine.RegistrationInfo{ | ||
Author: rt.Definition.RegistrationInfo.Author, | ||
Date: rt.Definition.RegistrationInfo.Date, | ||
Description: rt.Definition.RegistrationInfo.Description, | ||
Documentation: rt.Definition.RegistrationInfo.Documentation, | ||
SecurityDescriptor: rt.Definition.RegistrationInfo.SecurityDescriptor, | ||
Source: rt.Definition.RegistrationInfo.Source, | ||
URI: rt.Definition.RegistrationInfo.URI, | ||
Version: rt.Definition.RegistrationInfo.Version, | ||
}, | ||
// .Definition.RegistrationInfo, | ||
Settings: localmachine.TaskSettings{ | ||
AllowDemandStart: rt.Definition.Settings.AllowDemandStart, | ||
AllowHardTerminate: rt.Definition.Settings.AllowHardTerminate, | ||
DeleteExpiredTaskAfter: rt.Definition.Settings.DeleteExpiredTaskAfter, | ||
DontStartOnBatteries: rt.Definition.Settings.DontStartOnBatteries, | ||
Enabled: rt.Definition.Settings.Enabled, | ||
TimeLimit: rt.Definition.Settings.TimeLimit, | ||
Hidden: rt.Definition.Settings.Hidden, | ||
Priority: rt.Definition.Settings.Priority, | ||
RestartCount: rt.Definition.Settings.RestartCount, | ||
RestartInterval: rt.Definition.Settings.RestartInterval, | ||
RunOnlyIfIdle: rt.Definition.Settings.RunOnlyIfIdle, | ||
RunOnlyIfNetworkAvailable: rt.Definition.Settings.RunOnlyIfNetworkAvailable, | ||
StartWhenAvailable: rt.Definition.Settings.StartWhenAvailable, | ||
StopIfGoingOnBatteries: rt.Definition.Settings.StopIfGoingOnBatteries, | ||
WakeToRun: rt.Definition.Settings.WakeToRun, | ||
}, | ||
Triggers: func() []string { | ||
a := make([]string, len(rt.Definition.Triggers)) | ||
for i, v := range rt.Definition.Triggers { | ||
a[i] = v.GetType().String() | ||
} | ||
return a | ||
}(), | ||
XMLText: rt.Definition.XMLText, | ||
}, | ||
Enabled: rt.Enabled, | ||
State: rt.State.String(), | ||
MissedRuns: rt.MissedRuns, | ||
NextRunTime: rt.NextRunTime, | ||
LastRunTime: rt.LastRunTime, | ||
LastTaskResult: uint32(rt.LastTaskResult), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.