• 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.8k
    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.
    • R
      Raff
      last edited by

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

      1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        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
        • Tom ElliottT
          Tom Elliott
          last edited by

          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

            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

              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

                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
                • Tom ElliottT
                  Tom Elliott
                  last edited by

                  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

                    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

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • R
                        Ritchy_Purple
                        last edited by

                        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

                          Thanks Ricthy that worked. Much appreciated.

                          1 Reply Last reply Reply Quote 0
                          • N
                            Neil
                            last edited by

                            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

                            213

                            Online

                            12.1k

                            Users

                            17.3k

                            Topics

                            155.4k

                            Posts
                            Copyright © 2012-2024 FOG Project