• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. cjenness
    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 9
    • Best 1
    • Controversial 0
    • Groups 0

    cjenness

    @cjenness

    1
    Reputation
    248
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    cjenness Unfollow Follow

    Best posts made by cjenness

    • RE: Creating Task with TaskTypeManagement

      Nevermind, I figured it out. You have to title your new task the name (trusty-install) in this portion.

      $TaskType = self::getClass(‘TaskType’)
      ->set(‘name’, ‘trusty-install’)
      ->load(‘name’);
      if (!$TaskType->isValid()) {
      return;

      posted in General Problems
      C
      cjenness

    Latest posts made by cjenness

    • RE: Creating Task with TaskTypeManagement

      Nevermind, I figured it out. You have to title your new task the name (trusty-install) in this portion.

      $TaskType = self::getClass(‘TaskType’)
      ->set(‘name’, ‘trusty-install’)
      ->load(‘name’);
      if (!$TaskType->isValid()) {
      return;

      posted in General Problems
      C
      cjenness
    • RE: Creating Task with TaskTypeManagement

      Thank you guys for your help. So my question now is how do I tell the task type editor to use the hook that I just created?

      posted in General Problems
      C
      cjenness
    • RE: Creating Task with TaskTypeManagement

      Here is the entire file. So I have marked the flag as true and I no longer get the http 500 error, but I am not sure how to create a task with this hook.

      <?php
      /**
       * Alters the boot task to make a custom entry.
       *
       * PHP version 5
       *
       * @category BootTask
       * @package  FOGProject
       * @author   Tom Elliott <tommygunsster@gmail.com>
       * @license  http://opensource.org/licenses/gpl-3.0 GPLv3
       * @link     https://fogproject.org
       */
      /**
       * Alters the boot task to make a custom entry.
       *
       * @category BootTask
       * @package  FOGProject
       * @author   Tom Elliott <tommygunsster@gmail.com>
       * @license  http://opensource.org/licenses/gpl-3.0 GPLv3
       * @link     https://fogproject.org
       */
      class BootTask extends Hook
      {
          /**
           * The name of this hook.
           *
           * @var string
           */
          public $name = 'BootTask';
          /**
           * The description of this hook.
           *
           * @var string
           */
          public $description = 'Alter the boot task to make a custom task hook';
          /**
           * Is this hook active or not.
           *
           * @var bool
           */
          public $active = true;
          /**
           * Initializes object.
           *
           * @return void
           */
          public function __construct()
          {
              parent::__construct();
              self::$HookManager
                  ->register(
                      'IPXE_EDIT',
                      array(
                          $this,
                          'changeTask'
                      )
                  );
          }
          /**
           * Change the task.
           *
           * @param mixed $arguments The items to alter.
           *
           * @return void
           */
          public function changeTask($arguments)
          {
              if (!isset($arguments['ipxe']['task'])) {
                  return;
              }
              $TaskType = self::getClass('TaskType')
                  ->set('name', 'trusty-install')
                  ->load('name');
              if (!$TaskType->isValid()) {
                  return;
              }
              $keys = array_keys($arguments['ipxe']['task']);
              if (!in_array($TaskType->get('id'), $keys)) {
                  return;
              }
              $arguments['ipxe']['task'][$TaskType->get('id')] = array(
                  'cpuid --ext 29 && set arch amd64 ||',
                  'kernel http://${fog-ip}/win2012/${arch}/wimboot',
                  'initrd http://${fog-ip}/win2012/${arch}/media/Boot/BCD',
                  'initrd http://${fog-ip}/win2012/${arch}/media/Boot/boot.sdi',
                  'initrd http://${fog-ip}/win2012/${arch}/media/sources/boot.wim',
                  'boot ||',
              );
              $arguments['Host']
                  ->get('task')
                  ->set(
                      'stateID',
                      self::getCompleteState()
                  )->save();
          }
      }
      
      posted in General Problems
      C
      cjenness
    • RE: Creating Task with TaskTypeManagement

      So for the hook, I have just been editing the file /var/www/fog/lib/hooks/boottask.hook.php. The only part I have edited so far are the arguments that I posted above.

      posted in General Problems
      C
      cjenness
    • RE: Creating Task with TaskTypeManagement

      I’ve actually fixed the 500 error. I was missing a comma after boot.wim in the hook in OP. But I am not sure how to get the task type manager to call the hook.

      posted in General Problems
      C
      cjenness
    • RE: Creating Task with TaskTypeManagement

      Thank you for taking the time to check on this for me.

      posted in General Problems
      C
      cjenness
    • RE: Creating Task with TaskTypeManagement

      I have an iPXE menu configured:

      “cpuid --ext 29 && set arch amd64 ||
      kernel http://${fog-ip}/win2012/${arch}/wimboot
      initrd http://${fog-ip}/win2012/${arch}/media/Boot/BCD BCD
      initrd http://${fog-ip}/win2012/${arch}/media/Boot/boot.sdi boot.sdi
      initrd http://${fog-ip}/win2012/${arch}/media/sources/boot.wim boot.wim
      boot ||”

      Which I can default boot, but I would like to be able to make that a task, so i can boot specific server groups.

      posted in General Problems
      C
      cjenness
    • RE: Creating Task with TaskTypeManagement

      Thanks for getting back to me. I have the task type management plugin installed, and I am trying to create a task so that I can boot the wimboot installer that I set up to install windows 2012 on a specific groups that I set up as needed.

      posted in General Problems
      C
      cjenness
    • Creating Task with TaskTypeManagement

      I’m a noob, trying to create a Task so that I can do installs on specific server groups. I created a bootable Windows 2012 ISO with wimboot. This is closest post that I have found to my issue (https://forums.fogproject.org/topic/7448/adding-custom-task-to-fog-server?page=1). It is from last year, but the resolve doesn’t appear to have been posted, or I am not reading it correctly.

      My working FOG menu configuration is:
      “cpuid --ext 29 && set arch amd64 ||
      kernel http://${fog-ip}/win2012/${arch}/wimboot
      initrd http://${fog-ip}/win2012/${arch}/media/Boot/BCD BCD
      initrd http://${fog-ip}/win2012/${arch}/media/Boot/boot.sdi boot.sdi
      initrd http://${fog-ip}/win2012/${arch}/media/sources/boot.wim boot.wim
      boot ||”

      I read in the post mentioned above that I need to create a hook. Using /var/www/fog/lib/hooks/boottask.hook.php I’ve edited the $arguments but when I turn the hook on, I get a HTTP 500 Error. Once I have the hook configured how to I get the new task that I’ve created to call on it? Here is the part of the Hook that I edited.

      $arguments[‘ipxe’][‘task’][$TaskType->get(‘id’)] = array(
      ‘cpuid --ext 29 && set arch amd64 ||’,
      ‘kernel http://${fog-ip}/win2012/${arch}/wimboot’,
      ‘initrd http://${fog-ip}/win2012/${arch}/media/Boot/BCD’,
      ‘initrd http://${fog-ip}/win2012/${arch}/media/Boot/boot.sdi’,
      ‘initrd http://${fog-ip}/win2012/${arch}/media/sources/boot.wim’
      ‘boot ||’,
      );
      $arguments[‘Host’]
      ->get(‘task’)
      ->set(
      ‘stateID’,
      self::getCompleteState()
      )->save();

      I am trying to learn PHP while I do this, but don’t really know what I am doing.

      Thanks!

      posted in General Problems
      C
      cjenness