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

    FOG 1.5.2.11 GUI bug in Host and Group Membership Edit

    Scheduled Pinned Locked Moved Solved
    Bug Reports
    4
    21
    3.3k
    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.
    • TrialAndErrorT
      TrialAndError
      last edited by

      If I tick a group/host (to remove a host from a group) and click “Remove” not the ticked but another (random) goup/host will be removed.

      TrialAndErrorT 2 Replies Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        Can you please repull? Is there any new data pulled in? I ask because I rewrote this method to implicitely get the proper id->name pairs which was not the case for a little bit. This ultimately means, with the most current working branch, this is essentially impossible. The membership tabs are common between all objects, (Groups, Hosts, Images, Snapins, Printers) with the only minor exception being hosts, who’s membership tab displays groups where everything else displays hosts.

        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

          This is the exact PHP code used for this too: I’ll try to break it down a little later on.

              /**
               * Returns only the ids and names of the class passed in.
               *
               * @param string $class      The class to get list of.
               * @param string $whereItems If we want to filter items.
               *
               * @return void
               */
              public function names($class, $whereItems = [])
              {
                  $data = [];
                  $names = self::getSubObjectIDs(
                      $class,
                      [],
                      'name'
                  );
                  $ids = self::getSubObjectIDs(
                      $class,
                      [],
                      'id'
                  );
                  $classname = strtolower($class);
                  $classVars = self::getClass(
                      $class,
                      '',
                      true
                  );
          
                  $sql = 'SELECT `'
                      . $classVars['databaseFields']['id']
                      . '`,`'
                      . $classVars['databaseFields']['name']
                      . '` FROM `'
                      . $classVars['databaseTable']
                      . '`';
          
                  if (count($whereItems) > 0) {
                      $where = '';
                      foreach ($whereItems as $key => &$field) {
                          if (!$where) {
                              $where = ' WHERE `'
                                  . $classVars['databaseFields'][$key]
                                  . '`';
                          } else {
                              $where .= ' AND `'
                                  . $classVars['databaseFields'][$key]
                                  . '`';
                          }
                          if (is_array($field)) {
                              $where .= " IN ('"
                                  . implode("','", $field)
                                  . "')";
                          } else {
                              $where .= " = '"
                                  . $field
                                  . "'";
                          }
                      }
                      $sql .= $where;
                  }
                  $vals = self::$DB->query($sql)->fetch('', 'fetch_all')->get();
                  foreach ($vals as &$val) {
                      $data[] = [
                          'id' => $val[$classVars['databaseFields']['id']],
                          'name' => $val[$classVars['databaseFields']['name']]
                      ];
                      unset($val);
                  }
          
                  self::$data = $data;
              }
          

          Basically, the code gathering is sending the object id’s we want to gather at the time it’s gathering… hostsnotinme, hosts, groupsnotinme, groups. (the $whereItems variable is sent: ['id'=> [1,2,3]] (in the case of membership).

          The names and ids lines with the (getSubObjectIDs are just the old method of handling this, I will remove them as they don’t do anything but take up memory now).

          $data = []; Just initializes our storage point as an array.
          $classname = strtolower($class); Sets the class we’re working with (host, group, image, etc…) in lower case form.

          Below just gets the classes variables (database fields, table, etc…)

          $classVars = self::getClass(
              $class,
              '',
              true
          );
          

          Sets up the sql query to call based on the relevant fields. This is not complete quite yet.

          $sql = 'SELECT `'
              . $classVars['databaseFields']['id']
              . '`,`'
              . $classVars['databaseFields']['name']
              . '` FROM `'
              . $classVars['databaseTable']
              . '`';
          

          The below stanza is just to help setup our where clause, if needed. (If you pass the api /fog/host/names it will return a list of all hosts ids and names, this api was generated with the intent of correcting the issues of non-matching id->name pairs.).
          To clarify a bit, whereItems is an associative array, and the values of the left can be string or array. If they’re an array, we setup the where clause to do an IN search (WHERE {field} IN ('val1','val2','val3'). If the right is not an array (e.g. [‘id’ => 1]), it would do an equal search (WHERE {field} = 'val1').

          if (count($whereItems) > 0) {
              $where = '';
              foreach ($whereItems as $key => &$field) {
                  if (!$where) {
                      $where = ' WHERE `'
                          . $classVars['databaseFields'][$key]
                          . '`';
                  } else {
                      $where .= ' AND `'
                          . $classVars['databaseFields'][$key]
                          . '`';
                  }
                  if (is_array($field)) {
                      $where .= " IN ('"
                          . implode("','", $field)
                          . "')";
                  } else {
                      $where .= " = '"
                          . $field
                          . "'";
                  }
              }
              $sql .= $where;
          }
          

          $vals = self::$DB->query($sql)->fetch('', 'fetch_all')->get(); This actually pulls the information from the db.

          The below element sets the value that will be returned in json format. (e.g. [{‘id’: 1,‘name’: ‘name1’},{‘id’: 2,‘name’:‘name2’}]).

          foreach ($vals as &$val) {
              $data[] = [
                  'id' => $val[$classVars['databaseFields']['id']],
                  'name' => $val[$classVars['databaseFields']['name']]
              ];
              unset($val);
          }
          
          self::$data = $data;
          

          That’s all there is to it. I know it seems like a lot, but it’s really not that much code behind it. most of the lines seen are just to help maintain readability and keep line lengths down to < 85 characters.

          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
          • TrialAndErrorT
            TrialAndError
            last edited by TrialAndError

            Sorry, cannot check that.

            1.5.2.11 had a critical bug while imaging (kernel panic, something with init not present). I pulled 1.5.2.11 only to check whether the problem was still there. I immediately returned to 1.5.2.2

            1 Reply Last reply Reply Quote 0
            • TrialAndErrorT
              TrialAndError @TrialAndError
              last edited by TrialAndError

              FOG 1.5.2.20

              Not fixed yet.

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

                @trialanderror what’s not fixed yet. Can you show exactly what needs to be done to replicate the problem on the version you’re claiming doesn’t work?

                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
                • TrialAndErrorT
                  TrialAndError @TrialAndError
                  last edited by

                  @trialanderror said in FOG 1.5.2.11 GUI bug in Host and Group Membership Edit:

                  If I tick a group/host (to remove a host from a group) and click “Remove” not the ticked but another (random) goup/host will be removed.

                  Obviously my English is too bad. Another try:

                  For example:

                  1. Navigate to Group Mangement Edit: ‘groupname’
                  2. Tick off (?) a host of your choice.
                  3. Left click on ‘Remove’
                  4. Wonder
                  1 Reply Last reply Reply Quote 0
                  • F
                    FredG
                    last edited by

                    I have the same problem “If I tick a group/host (to remove a host from a group) and click “Remove” not the ticked but another (random) goup/host will be removed.”
                    with : Ubuntu 16.04 and Fog 1.5.0.38, Fog 1.5.2, Fog 1.5.2.20
                    I don’t know from which version I have this problem

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

                      Please update and try again? I’ve rewritten quite a bit in hopes to address this, however I haven’t been able to replicate it which is why I asked for more specific means. It wasn’t saying your instruction was not able to be followed, it was so I could try things so I CAN replicate the problem.

                      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

                      F 1 Reply Last reply Reply Quote 0
                      • F
                        FredG @Tom Elliott
                        last edited by

                        Fog 1.5.2 : The checkbox does not match the host name and when I click remove, the wrong host is removed
                        Fog 1.5.2.23 : The check box corresponds well to the name of the host. But when I click remove, the wrong host is deleted
                        0_1526539929176_membership.png

                        F 1 Reply Last reply Reply Quote 0
                        • F
                          FredG @FredG
                          last edited by

                          Fog 1.5.2.24 : the same as Fog 1.5.2.23

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

                            @fredg what’s the link for that host show? It appears to me to be host id 441, can you show the link as well? At the least the uri portion of that link.

                            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

                              Okay found, I think, where the issue was. Adding always worked properly, but I made a typo on the remove element. Not that it matters to many but I was passing the array for remove rather than the individual item. Once I corrected this, I was able to see the proper item removing. I happened to have luck earlier so I just added a few more hosts so I could see what was happening.

                              I’m fairly confident the latest working version has this corrected for. Just need a few to test and report.

                              Thank you

                              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

                              F 2 Replies Last reply Reply Quote 0
                              • F
                                FredG @Tom Elliott
                                last edited by

                                Fog 1.5.2.26 : OK it works!
                                Thank you

                                1 Reply Last reply Reply Quote 0
                                • F
                                  FredG @Tom Elliott
                                  last edited by

                                  @tom-elliott : can we have the default list of members in alphabetical order?

                                  Tom ElliottT 2 Replies Last reply Reply Quote 0
                                  • P
                                    pedro
                                    last edited by pedro

                                    Hi, I am experiencing the same issue. When I try to select hosts in the group memebership tabs and remove them from group or get to the hostpreferences a different host is edited. On mouse-over the hyperlink of the host has a different id in it. It looks like the id variable is incremented by one or maybe it is an issue caused by a loop in the source which runs one more time than it should.
                                    My further investigation showed:
                                    If I create a new group an edit memberships (delete, select host for editing preferences) everything works as it should(the host-id in the hyperlink is correct) as long as the server is not rebooted.
                                    By the way when in the hoststab itself the hostids are correct, the incrementation happens only if i switch to the grouptab.
                                    I am runnning ubuntu 16.04 with fog 1.5.2 and php7. The only changes i did to the clean fog-setup, were:

                                    Editing the fog vhost configuration(Moving </Directory> Tag) and setiing a different php-fpm max_children count higher to get rid of the Updating database error 503 after multicast-deploy. I don’t think there is some connection between my changes and the webguibug.

                                    Please excuse my bad English, I hope this information helps to target the problem.

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

                                      @fredg I can add the sorting yes.

                                      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 @pedro
                                        last edited by

                                        @pedro please try installing the working branch as has been discussed that should fix the issue you’re talking about. It shouldn’t be too long before I can push 1.5.3 proper but I’m waiting for feed back in a few other bugs as well.

                                        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 @FredG
                                          last edited by

                                          @fredg Added element to always sort by name field, unless the name field is not available in which case it defaults to order by the id field.

                                          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

                                          F 2 Replies Last reply Reply Quote 0
                                          • F
                                            FredG @Tom Elliott
                                            last edited by

                                            @tom-elliott : Items are sorted by name field except for membership.
                                            0_1527065043417_Membership_Orderby_hostid.png

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

                                            154

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project