@Tom-Elliott I was playing with creating a scheduled task via the api.
When I do a get on http://fog-server/fog/scheduledtask/current I get a json output but there are 2 taskType definitions. I’m pretty sure the first one should be taskTypeID
{
"count": 1,
"scheduledtasks": [{
"id": "66",
"name": "Deploy Task",
"description": "",
"type": "S",
"taskType": "1",
"minute": "",
"hour": "",
"dayOfMonth": "",
"month": "",
"dayOfWeek": "",
"isGroupTask": "",
"hostID": "1657",
"shutdown": "",
"other1": "",
"other2": "-1",
"other3": "fog",
"other4": "1",
"other5": "",
"scheduleTime": "1605895200",
"isActive": "1",
"imageID": "0",
"host": {
"id": "1657",
"name": "ACT-WKS-4263",
"description": "Created by FOG Reg on October 19, 2018, 8:49 am",
"ip": "",
"imageID": "27",
"building": "0",
"createdTime": "2018-10-19 08:49:32",
"deployed": "2018-10-19 08:53:31",
"createdBy": "fog",
"useAD": "",
"ADDomain": "",
"ADOU": "",
"ADUser": "",
"ADPass": "",
"ADPassLegacy": "",
"productKey": "",
"printerLevel": "",
"kernelArgs": "",
"kernel": "",
"kernelDevice": "",
"init": "",
"pending": "0",
"pub_key": "",
"sec_tok": "",
"sec_time": "",
"pingstatus": "<i class=\"icon-ping-windows fa fa-windows green\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Windows\"><\/i>",
"biosexit": "",
"efiexit": "",
"enforce": "1",
"primac": "c8:d9:d2:7e:bc:73",
"imagename": "Base-Stable-1909",
"hostscreen": {
"id": null,
"hostID": null,
"width": null,
"height": null,
"refresh": null,
"orientation": null,
"other1": null,
"other2": null
},
"hostalo": {
"id": null,
"hostID": null,
"time": null
},
"inventory": {
"id": "275",
"hostID": "1657",
"primaryUser": "",
"other1": "4263",
"other2": "",
"createdTime": "2018-10-19 08:49:33",
"deleteDate": "0000-00-00 00:00:00",
"sysman": "HP",
"sysproduct": "HP ProDesk 600 G4 DM",
"sysversion": "",
"sysserial": "8CC8291JLH",
"sysuuid": "e46956df-5297-6b46-2b4b-db05b32effe7",
"systype": "Type: Mini Tower",
"biosversion": "Q22 Ver. 02.02.04",
"biosvendor": "HP",
"biosdate": "08\/06\/2018",
"mbman": "HP",
"mbproductname": "83EF",
"mbversion": "KBC Version 07.B4.00",
"mbserial": "PGVLV0B8JB360M",
"mbasset": "",
"cpuman": "Intel(R) Corporation",
"cpuversion": "Intel(R) Core(TM) i5-8500T CPU @ 2.10GHz",
"cpucurrent": "Current Speed: 2000 MHz",
"cpumax": "Max Speed: 2100 MHz",
"mem": "MemTotal: 7927840 kB",
"hdmodel": "",
"hdserial": "",
"hdfirmware": "",
"caseman": "HP",
"casever": "",
"caseserial": "8C328.000000:103809024.000000:16777216.000000:20520607744.000000:",
"osID": "9",
"deployed": "2019-11-11 17:24:19",
"format": "5",
"magnet": "",
"protected": "1",
"compress": "19",
"isEnabled": "1",
"toReplicate": "1",
"srvsize": "10142164451",
"os": {},
"imagepartitiontype": {},
"imagetype": {}
},
"pingstatuscode": 0,
"pingstatustext": "Success",
"macs": ["c8:d9:d2:7e:bc:73", "14:4f:8a:d5:d2:ed", "14:4f:8a:d5:d2:ee", "16:4f:8a:d5:d2:ed", "14:4f:8a:d5:d2:f1"]
},
"tasktype": {
"id": "1",
"name": "Deploy",
"description": "Deploy action will send an image saved on the FOG server to the client computer with all included snapins.",
"icon": "download",
"kernel": "",
"kernelArgs": "type=down",
"type": "fog",
"isAdvanced": "0",
"access": "both",
"initrd": ""
},
"runtime": "2020-11-20 11:00"
}]
}
I was running this to get an idea of what I need to create a scheduledtask object.
I tried doing a POST call to http://fog-server/fog/scheduledtask/create as well as http://fog-server/fog/host/1657/task
(using my module it was New-FogObject -type object -coreObject scheduledtask -jsonData $jsonData and New-FogObject -type objecttasktype -IDofObject 1657 -jsonData $jsonData -coreTaskObject host)
with the json data being
{
"name": "Deploy Task",
"description": "",
"type": "S",
"taskTypeID": "1",
"minute": "",
"hour": "",
"dayOfMonth": "",
"month": "",
"dayOfWeek": "",
"isGroupTask": "",
"hostID": "1657",
"shutdown": "",
"other1": "",
"other2": "-1",
"other3": "fog",
"other4": "1",
"other5": "",
"scheduleTime": "1605895200",
"isActive": "1",
"imageID": "27",
"runtime": "2020-11-20 11:00"
}
Trying to do the first scheduledtask object call I just get a 500 error. The task object task makes a active task, it says that the start time is at the runtime I give, but it doesn’t show up in scheduled tasks it shows up in normal tasks.
I think the problem may be in https://github.com/FOGProject/fogproject/blob/d9e7a329a6ec6384593c75df3026ca0b46efa00f/packages/web/lib/fog/scheduledtask.class.php around line 40, but I’m not really sure.