• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Call to undefined method Group::addMember

Scheduled Pinned Locked Moved Solved
Bug Reports
8
17
5.5k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q
    q16marvin
    last edited by Jul 11, 2012, 8:26 AM

    When you put some client in a group and schedule a task (deploy) to this group and then you want to this schedules in tha task view it looks like this:

    [ATTACH]136[/ATTACH]

    and in the appache error logs:

    PHP Fatal error: Call to undefined method Group::addMember() in /var/www/fog/management/lib/FOGCore.class.php on line 210, referer: [url]http://*******/fog/management/index.php?node=tasks&sub=active[/url]

    thanks!

    [url=“/_imported_xf_attachments/0/136_fog_empty.png?:”]fog_empty.png[/url]

    1 Reply Last reply Reply Quote 0
    • B
      Blackout Developer
      last edited by Aug 30, 2012, 1:38 AM

      Known bug. Thank you for reporting.

      1 Reply Last reply Reply Quote 0
      • S
        smshahan
        last edited by Apr 10, 2013, 8:20 PM

        [B][FONT=Ubuntu][COLOR=#333333]Fatal error[/COLOR][/FONT][/B][FONT=Ubuntu][COLOR=#333333]: Call to undefined method Group::addMember() in[/COLOR][/FONT][B][FONT=Ubuntu][COLOR=#333333]/var/www/fog/management/lib/FOGCore.class.php[/COLOR][/FONT][/B][FONT=Ubuntu][COLOR=#333333] on line [/COLOR][/FONT][B][FONT=Ubuntu][COLOR=#333333]210[/COLOR][/FONT][/B]
        [B][FONT=Ubuntu][COLOR=#333333][/COLOR][/FONT][/B]
        Anyone figure out how to fix this bug or at the very least get task scheduler to come up without the error?

        1 Reply Last reply Reply Quote 0
        • R
          Raff
          last edited by Jul 8, 2013, 9:25 AM

          We have this error after upgrading from 0.29 to 0.32. Anyone know the fix?

          1 Reply Last reply Reply Quote 0
          • K
            Kevin
            last edited by Jul 15, 2013, 5:30 PM

            From other post, you can try this to see if it fixes it. I personally have not tried it, but looks like you are having the same problems as the blank task creation page. Make sure you backup your file before you try this!

            sudo gedit [B][FONT=Ubuntu][COLOR=#333333]/var/www/fog/management/lib/FOGCore.class.php[/COLOR][/FONT][/B][FONT=Ubuntu][COLOR=#333333] [/COLOR][/FONT]
            Search Menu > Replace
            Search for: &$tmp
            Replace with: $tmp
            Replace All
            Save
            Close
            Then try again

            "The quieter you become, the more you are able to hear"

            New to FOG? Check the [URL='http://www.fogproject.org/wiki/index.php/FOGUserGuide']Wiki[/…

            1 Reply Last reply Reply Quote 0
            • R
              Raff
              last edited by Jul 18, 2013, 8:01 AM

              Its not &$tmp. It does not exist anywhere in FOGCore.class.php

              1 Reply Last reply Reply Quote 0
              • T
                Tom Elliott
                last edited by Aug 13, 2013, 8:07 PM

                As it states, addMember() is an undefined method, where is addMember defined within the FOGCore.class.php? I can’t find it and does the same issue occur For Storage group?

                Line
                [FONT=monospace][COLOR=#000000][RIGHT]286[/RIGHT][/COLOR][/FONT][FONT=monospace][COLOR=#000000] $storagegroup->addMember( $sn );[/COLOR][/FONT]
                [FONT=monospace][COLOR=#000000][RIGHT]210[/RIGHT][/COLOR][/FONT][FONT=monospace][COLOR=#000000] $group->addMember( $host );[/COLOR][/FONT]

                Both of these lines call for the same method, but the method doesn’t actually exist within FOGCore.class.php. I’ll download the tar and see if I can find the method to help with the troubleshooting of this.
                [FONT=monospace][COLOR=#000000]B[/COLOR][/FONT]

                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • T
                  Tom Elliott
                  last edited by Aug 13, 2013, 8:10 PM

                  Try changing the line 210 to:

                  $this->Group->addMember( $host );

                  Maybe this will help as the Group class appears to contain the addMember method.

                  If that doesn’t work, try:

                  $Group->addMember ($host);

                  I’m not running 0.32 so I can’t be a good tester for this! Sorry.

                  and if the variables really need to be adjusted for try:

                  $group = $this->Group->addMember( $host ); or
                  $group = $Group->addMember( $host );

                  Also, if The storage group is having the same type of issue try:

                  $storagegroup = $this->StorageGroup->addMember( $sn ); or
                  $storagegroup = $StorageGroup->addMember( $sn ); or
                  $this->StorageGroup->addMember( $sn ); or
                  $StorageGroup->addMember( $sn );

                  I know this is a lot, but it’s the best advice I can give.

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                  1 Reply Last reply Reply Quote 0
                  • R
                    Raff
                    last edited by Oct 10, 2013, 3:00 PM

                    Thanks for looking into this Tom.
                    Tried your suggestion but it didn’t work.

                    1 Reply Last reply Reply Quote 0
                    • R
                      Ritchy_Purple
                      last edited by Feb 18, 2014, 5:30 PM

                      Modify FOGCore.class.php

                      line 137

                      else if ( $group != null )
                      {
                      [B]//add copy from below[/B]
                      [B]$task = new ScheduledTask( $host, $group, $timer, $ar[“stTaskType”], $ar[“stID”] );[/B]
                      [B]$task->setShutdownAfterTask( $ar[“stShutDown”] == 1 );[/B]
                      [B]$task->setOther1( $ar[“stOther1”] );[/B]
                      [B]$task->setOther2( $ar[“stOther2”] );[/B]
                      [B]$task->setOther3( $ar[“stOther3”] );[/B]
                      [B]$task->setOther4( $ar[“stOther4”] );[/B]
                      [B]$task->setOther5( $ar[“stOther5”] );[/B]
                      [B]$arTasks[] = $task;[/B]
                      [B]// start Comment[/B]
                      [B]/* if ( $group->getCount() > 0 )[/B]
                      [B]{[/B]
                      [B]$arRm = array();[/B]
                      [B]$hosts = $group->getMembers();[/B]
                      [B]for( $i = 0; $i < count($hosts); $i++ )[/B]
                      [B]{[/B]
                      [B]if ( $hosts[$i] != null )[/B]
                      [B]{[/B]
                      [B]$h = $hosts[$i];[/B]
                      [B]if ( ! ($h->isReadyToImage() && $h->getImage()->getStorageGroup()->getID() == $groupid ) )[/B]
                      [B]{[/B]
                      [B]$arRm[] = $h;[/B]
                      [B]}[/B]
                      [B]}[/B]
                      [B]}[/B]

                      [B]//echo ( "Before: " . $group->getCount() );[/B]
                      [B]for( $i = 0; $i < count($arRm); $i++ )[/B]
                      [B]{[/B]
                      [B]$group->removeMember( $arRm[$i] );[/B]
                      [B]}[/B]
                      [B]//echo ( "After: " . $group->getCount() );[/B]

                      [B]$task = new ScheduledTask( $host, $group, $timer, $ar[“stTaskType”], $ar[“stID”] );[/B]
                      [B]$task->setShutdownAfterTask( $ar[“stShutDown”] == 1 );[/B]
                      [B]$task->setOther1( $ar[“stOther1”] );[/B]
                      [B]$task->setOther2( $ar[“stOther2”] );[/B]
                      [B]$task->setOther3( $ar[“stOther3”] );[/B]
                      [B]$task->setOther4( $ar[“stOther4”] );[/B]
                      [B]$task->setOther5( $ar[“stOther5”] );[/B]
                      [B]$arTasks[] = $task;[/B]
                      [B]} */[/B]
                      [B]//end comment[/B]


                      [B]//and comment also from below (Line 212 for me) BOLD[/B]
                      $group = null;
                      while( $ar = mysql_fetch_array( $res ) )
                      {
                      if ( $group == null )
                      {
                      $group = new Group($ar[“groupID”], $ar[“groupName”], $ar[“groupDesc”] );
                      }
                      [B] /* $hid = $ar[“hostid”];[/B]
                      [B] if ( $hid !== null && is_numeric( $hid ) )[/B]
                      [B] {[/B]
                      [B] $host = $this->getHostById( $hid );[/B]
                      [B] if ( $host != null ) [/B]
                      [B] $group->addMember( $host );[/B]
                      [B] } */[/B]
                      }
                      return $group;

                      Test OK for me

                      1 Reply Last reply Reply Quote 0
                      • R
                        Raff
                        last edited by Feb 19, 2014, 10:12 AM

                        Ritchy thanks for that, but still no luck.

                        [B]Fatal error[/B]: Call to undefined method Group::addMember() in [B]/var/www/fog/management/lib/FOGCore.class.php[/B] on line [B]221[/B]

                        With your changes line 210 is now 221 but still has same error

                        Line 137 to 224 below:-

                        [CODE] else if ( $group != null )
                        {
                        //add copy from below
                        $task = new ScheduledTask( $host, $group, $timer, $ar[“stTaskType”], $ar[“stID”] );
                        $task->setShutdownAfterTask( $ar[“stShutDown”] == 1 );
                        $task->setOther1( $ar[“stOther1”] );
                        $task->setOther2( $ar[“stOther2”] );
                        $task->setOther3( $ar[“stOther3”] );
                        $task->setOther4( $ar[“stOther4”] );
                        $task->setOther5( $ar[“stOther5”] );
                        $arTasks[] = $task;
                        // start Comment
                        /*if ( $group->getCount() > 0 )
                        {
                        $arRm = array();
                        $hosts = $group->getMembers();
                        for( $i = 0; $i < count($hosts); $i++ )
                        {
                        if ( $hosts[$i] != null )
                        {
                        $h = $hosts[$i];
                        if ( ! ($h->isReadyToImage() && $h->getImage()->getStorageGroup()->getID() == $groupid ) )
                        {
                        $arRm[] = $h;
                        }
                        }
                        }

                                                    //echo ( "Before: " . $group->getCount() );
                                                    for( $i = 0; $i < count($arRm); $i++ )
                                                    {
                                                        $group->removeMember( $arRm[$i] );
                                                    }
                                                    //echo ( "After: " . $group->getCount() );
                                                   
                                                    $task = new ScheduledTask( $host, $group, $timer, $ar["stTaskType"], $ar["stID"] );
                                                    $task->setShutdownAfterTask( $ar["stShutDown"] == 1 );
                                                    $task->setOther1( $ar["stOther1"] );
                                                    $task->setOther2( $ar["stOther2"] );
                                                    $task->setOther3( $ar["stOther3"] );
                                                    $task->setOther4( $ar["stOther4"] );
                                                    $task->setOther5( $ar["stOther5"] );
                                                    $arTasks[] = $task;                               
                                                }*/
                                                //end comment
                                            }
                                        }               
                                    }
                                }
                        
                               
                            }
                            return $arTasks;
                        }
                        
                        function getGroupById( $id )
                        {
                            if ( $this->db != null && is_numeric( $id ) && $id >= 0 )
                            {
                                $sql = "SELECT
                                        groupID,
                                        groupName,
                                        groupDesc,
                                        gmHostID as hostid
                                    FROM
                                        groups
                                        inner join groupMembers on ( groups.groupID = groupMembers.gmGroupID )
                                    WHERE
                                        groupID = $id";       
                                $res = mysql_query( $sql, $this->db ) or die( mysql_error() );       
                        
                                $group = null;
                                while( $ar = mysql_fetch_array( $res ) )
                                {
                                    if ( $group == null )
                                    {
                                        $group = new Group($ar["groupID"], $ar["groupName"], $ar["groupDesc"] );
                                    }
                                   
                                    $hid = $ar["hostid"];
                                    if ( $hid !== null && is_numeric( $hid ) )
                                    {
                                        $host = $this->getHostById( $hid );
                                        if ( $host != null )
                                            $group->addMember( $host );
                                    }
                                }       
                                return $group;    [/CODE]
                        
                        1 Reply Last reply Reply Quote 0
                        • T
                          Tom Elliott
                          last edited by Feb 19, 2014, 3:21 PM

                          Replace &$tmp to $tmp in the tasks.confirm.include.php file.

                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                          1 Reply Last reply Reply Quote 0
                          • R
                            Raff
                            last edited by Feb 19, 2014, 4:19 PM

                            Done that Tom, Same issue.

                            After doing Ritchy’s changes, line 221 still has:-
                            $group->addMember( $host );

                            1 Reply Last reply Reply Quote 0
                            • R
                              Ritchy_Purple
                              last edited by Feb 19, 2014, 4:42 PM

                              This post is deleted!
                              1 Reply Last reply Reply Quote 0
                              • R
                                Ritchy_Purple
                                last edited by Feb 19, 2014, 5:29 PM

                                Hello,

                                I modified my post,
                                I forgot to say that we
                                also comment below

                                [ATTACH]551[/ATTACH]

                                Its Work
                                sorry

                                [url=“/_imported_xf_attachments/0/551_Capture du 2014-02-19 23_19_53.png?:”]Capture du 2014-02-19 23_19_53.png[/url]

                                1 Reply Last reply Reply Quote 0
                                • R
                                  Raff
                                  last edited by Feb 20, 2014, 8:26 AM

                                  Thanks Ricthy that worked. Much appreciated.

                                  1 Reply Last reply Reply Quote 0
                                  • N
                                    Neil
                                    last edited by Apr 22, 2014, 12:58 PM

                                    I’ve followed your instructions ritchy_purple however I found that this broke group scheduled tasks. Single host scheduled tasks still ran but group ones would not as the script no longer returns a list of hosts that are members of the group.

                                    I’ve written some more in-depth instructions and a solution (based on this thread) that gets both the Web GUI and group scheduled tasks working

                                    [url]http://fogproject.org/forum/threads/scheduled-tasks-and-fog-0-32.10345/[/url]

                                    Neil

                                    1 Reply Last reply Reply Quote 0
                                    • 1 / 1
                                    • First post
                                      Last post

                                    169

                                    Online

                                    12.0k

                                    Users

                                    17.3k

                                    Topics

                                    155.2k

                                    Posts
                                    Copyright © 2012-2024 FOG Project