Scheduled Tasks and FOG 0.32

Many of us have been experiencing issues with fog 0.32 where Scheduled Tasks do not show up in the web GUI. I’ve seen various discussions on these forums about the issue but no definitive fix. Hopefully this will provide a solution.

Before I go any further into this I work for a large university in the UK who rely on group scheduled tasks. We re-image a large number of machines each week based on group schedules including our IT Suites and Seminar rooms. Until a few weeks ago we had been using FOG 0.29 but decided to upgrade to 0.32 to find this bug.

For reference we are running FOG with CentOS 6.5, PHP 5.3.3, MySQL 5.1.73

Though you can schedule single host tasks and group tasks the webGUI will not display the scheduled tasks to allow you to delete them.

While working through the instructions from that thread I setup a test group and a scheduled task to run every minute. Once the web GUI was showing the scheduled tasks I checked the Fog Scheduler log to find that group scheduled tasks no longer worked as it could not find the list of hosts associated with the group. (I have edited the output of the fog scheduler to give more details)

So dissecting the FOGScheduler service at /opt/fog/service/FOGTaskScheduler/FOGTaskScheduler, I found that the getScheduledTasksByStorageGroupID function I’ve just commented a load of code out from is being re-used.

So looking back over the code that was commented out you can see that once the getScheduledTasksByStorageGroupID function has information about the task it looks to see if the task is a group or a single task.

For group tasks on line 119 the function passes to another function getGroupById to get the members of the group. The getGroupById function looks at the DB and gets a list of hosts that are members of the group and then builds an array / list (calling another function Group::addMember( $host ) which caused the web GUI error) with each host as an entry.

The instructions from ritchy_purple were to comment out the part of the getGroupById function that built the array / list of hosts. So commenting out that would be the reason why the Fog Scheduler stopped working for groups!

I hope this helps someone as very little information has been posted about this bug and any reports or questions about it are simply responded with: this is a known bug and will be fixed in the next release.

– Edit – Due to a request I have uploaded my working versions of the files edited. I would strongly advice you to follow through my instructions rather than use my files. However if you do use them please make sure you make a backup of both of your original files before replacing them. Instructions for making backups can be found above.

The question now is how to get both the web GUI and group scheduled tasks working? Assuming you have a fresh install of FOG 0.32 and have not made the changes suggested by above: I’ve introduced a new variable to the getScheduledTasksByStorageGroupID and getGroupById functions and a few if statements that allows the script to bypass parts of the code.

Your code might not match the line numbers in mine but should be pretty close.

Before making any changes make sure you make a backup of the file you edit!