Change Full Host Registration / QuickImage


  • Developer

    Hi All,

    i have made changes slightly to the full host registration, quickimage. In active task page, i have added “started by” which shows which user/engineer started the task. I’ve also added the “started by/created by” into the imaging log (for auditing purposes) and it also nice to easy check active tasks page and see which engineer’s imaging at the time. so these are the reasons behind these changes.

    1: Quickimage - when you use quickimage, it does not add into the sql database, who created the task even though it requests credentials before you can send the image request. i therefore changed it to pass this information and add it to the task information.

    1. Full Host Registration - instead of asking you to type “fog” to confirm imaging, i’ve changed it to use the same process as quickimage and request username and password (more secure i guess) but main reason is so it can pass the user who sent the task request and add it to the task information.

    When the machine exists - instead of stating that
    [B][I]machine already exists in the fog database![/I][/B]
    it states:
    [I][B]This Machine is already registed as: “HostName”[/B][/I]

    this makes it easier to identify the machine in the host list rather than getting the mac address and searching that way.

    These are simple changes but if everyone would find these useful i’d propose them to the developers to add to FOG. :-)


  • Senior Developer

    Added this to quick inventory screen as it was very simple. Thanks Lee!


  • Moderator

    Thank you!! This works perfectly using FOG 0.32. This is so handy.

    I would love to see this put into 0.33 code, I know the above patch has been (not sure if this part has).

    Thanks again to everyone in thread

    [quote=“Lee Rowlett, post: 9534, member: 28”]change auto.register.php line 77 (dependant on version you’ve got but it’s around there)
    from:
    [B]$sql = “select count() as cnt from hosts where hostMAC = ‘" . $mac . "’";[/B]
    to:
    [B]$sql = "select hostName, count(
    ) as cnt from hosts where hostMAC = '” . $mac . “’”;[/B]
    and then change output on line 264 (again might be diff line - version)
    from:
    [B]echo (“Exists”);[/B]
    to:
    [B]echo “”.
    (“This Machine is already registed as”).": " . $ar[“hostName”] . “”;[/B]

    i haven’t tested this but can’t see why it wouldn’t work :)[/quote]


  • Developer

    change auto.register.php line 77 (dependant on version you’ve got but it’s around there)
    from:
    [B]$sql = “select count() as cnt from hosts where hostMAC = ‘" . $mac . "’";[/B]
    to:
    [B]$sql = "select hostName, count(
    ) as cnt from hosts where hostMAC = '” . $mac . “’”;[/B]
    and then change output on line 264 (again might be diff line - version)
    from:
    [B]echo (“Exists”);[/B]
    to:
    [B]echo “”.
    (“This Machine is already registed as”).": " . $ar[“hostName”] . “”;[/B]

    i haven’t tested this but can’t see why it wouldn’t work :-)


  • Moderator

    Lee (or anyone) are you able to help, I cant seem to find where to edit this?


  • Moderator

    thanks will take a look when back at work


  • Developer

    yes quite easy actually, without looking at the code, you should be able to use the same principle above but for auto.register.php


  • Moderator

    is there anyway to add a similar idea to the ‘Quick Host Reg and inventory’ for when the machine is already registered to show what machine it is? at the moment it just shows host exists



  • Yep, love it. Shared with the rest of the FOG evangelists I know.


  • Moderator

    Cool. Blackout integrated this into the codebase moving forward. I have always thoroughly enjoyed the guessing game and lookup when a host exists but I don’t know which one it is. /sarcasm off



  • Works great man thanks


  • Developer

    [B]“Machine already registered” change:[/B]

    change [I]man.hostexists.php[/I] under [I]/var/www/service[/I] and change it to this (it’s around line 57):
    [CODE]
    $sql = “select hostName, count(*) as cnt from hosts where hostMAC = '” . $mac . “’”;
    $res = mysql_query( $sql, $conn ) or die( mysql_error() );
    while( $ar = mysql_fetch_array( $res ) )
    {
    if ( $ar[“cnt”] == 0 )
    {
    echo “#!ok”;
    }
    else
    echo “”._(“This Machine is already registed as”).": " . $ar[“hostName”] . “”;
    }[/CODE]



  • I like this very much. Especially requiring credentials to image during registration and the “machine already registered as: hostname”


Log in to reply
 

478
Online

39.3k
Users

11.0k
Topics

104.6k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.