SOLVED New server not updating inventory

  • So I built a server a few days ago in our test lab. When registering a machine it works great. So today I built a server in production. When I went to do a full registration, I noticed the host name did not stick. When I clicked the host I saw that the inventory said there was no data, but the host exists. I decided to try a new machine but this time using quick reg. Same result. It gets more strange, in the host list it has a green marker next to it. I then tried to capture an image. It started the image capture and in the FOG GUI it then had a red marker saying “no device or address”. the second machine did the same thing. Yet I could deploy an image to it.
    I am not sure where to begin. What kind of information do you all need? I did just update to the latest SVN as of tonight which was 6951?? I think.

    Thanks a bunch

  • Just wanted to say I updated to SVN 6955 and inventory is running great. Thanks Sebastian and Tom for the hard work.

  • @adukes40 This should now be fixed.

    I added all the suggestions in this thread.

  • Ok, thanks Sebastian. I appreciate the quick responses.

  • Senior Developer

    @adukes40 No, please stay tuned. You found a bug and we are discussing how we are going to fix this “the best way”. Will let you know when you can pull the latest update.

  • Did you need me to provide anything? I’m new to Linux, but learning. I can try to pull things if you need, but might need a little step by step if so… Thanks again

  • Senior Developer

    Sorry, forgot about the other values…

    diff --git a/src/buildroot/package/fog/scripts/bin/ b/src/buildroot/package/fog/scripts/bin/
    index 6c3a013..6afdadb 100755
    --- a/src/buildroot/package/fog/scripts/bin/
    +++ b/src/buildroot/package/fog/scripts/bin/
    @@ -249,7 +249,7 @@ while [[ -z $askme ]]; do
    -            blDoAD=1
    +            blDoAD=$(echo -n "1" | base64)
    @@ -293,7 +293,7 @@ while [[ -z $askme ]]; do
                             echo " * This host will reboot and imaging will start!"
    -                        realdoimage=1
    +                        realdoimage=$(echo -n "1" | base64)
    @@ -313,7 +313,7 @@ done
     dots "Attempting to register host"
     while [[ -z $res ]]; do
    -    res=$(wget --post-data="mac=$mac&advanced=1&host=$host&imageid=$imageid&primaryuser=$primaryuser&other1=$other1&other2=$other2&doimage=$realdoimage&doad=$blDoAD&location=$locationid&username=$user64&groupid=$group64&snapinid=$snapin64&productKey=$productKey" -qO - http://${web}service/auto.register.php 2>/dev/null)
    +    res=$(wget --post-data="mac=$mac&advanced=$(echo -n "1" | base64)&host=$host&imageid=$imageid&primaryuser=$primaryuser&other1=$other1&other2=$other2&doimage=$realdoimage&doad=$blDoAD&location=$locationid&username=$user64&groupid=$group64&snapinid=$snapin64&productKey=$productKey" -qO - http://${web}service/auto.register.php 2>/dev/null)
         echo "$res"
         usleep 2000000
  • Senior Developer

    Seams like a recent change is causing this. en/decoding of values being the problem. Here is a tested patch proposal:

    diff --git a/packages/web/lib/fog/fogbase.class.php b/packages/web/lib/fog/fogbase.class.php
    index ad5d778..b9c99b4 100644
    --- a/packages/web/lib/fog/fogbase.class.php
    +++ b/packages/web/lib/fog/fogbase.class.php
    @@ -552,9 +552,8 @@ abstract class FOGBase {
         public static function stripAndDecode(&$item) {
             $item = (array)$item;
             foreach($item AS $key => &$val) {
    -            $val = urlencode($val);
                 $tmp = trim(base64_decode(preg_replace('#[[:space:]]#','+',$val)));
    -            if ($tmp && mb_detect_encoding($tmp,'utf-8',true)) $val = $tmp;
    +            if (isset($tmp) && mb_detect_encoding($tmp,'utf-8',true)) $val = $tmp;
                 $val = trim(htmlentities(urldecode($val),ENT_QUOTES,'utf-8'));
    diff --git a/packages/web/service/inventory.php b/packages/web/service/inventory.php
    index 2c92d5e..1846655 100644
    --- a/packages/web/service/inventory.php
    +++ b/packages/web/service/inventory.php
    @@ -2,7 +2,7 @@
     try {
    -    $Host = $FOGCore->getHostItem(false,true);
    +    $Host = $FOGCore->getHostItem(false,false);
         $Inventory = $Host->get('inventory')
         foreach ($_REQUEST AS $var => &$val) {

    @Tom-Elliott And I am wondering if we need all the ‘preg_replace’, ‘urldecode’, ‘htmlentities’ stuff at all?!?