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

    When uploading hosts with a CSV file on 0.32 the Image ID is ignored.

    Scheduled Pinned Locked Moved Solved
    Bug Reports
    3
    5
    2.6k
    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.
    • A
      afmrick
      last edited by

      When I upload a hosts CSV file such as this one:
      [CODE]“DE:AD:BE:EF:CA:FE”,“myHostName”,“10.0.0.1”,“Test Host - Does not exist”,“5”,“6”[/CODE]
      Based on the template:
      [CODE]“MAC Address (ie: 00:11:22:33:44:55)","Hostname”,“IP Address”,“Description”,“Operating System ID”,“Image ID”[/CODE]
      The [B]Image ID[/B], “6”, is ignored. Everything else loads up correctly but the [B]Host Image[/B] is blank.

      It looks like this is a bug in [COLOR=#0000ff][B][FONT=Consolas]${webdirdest}/fog/management/includes/management/includes/hosts.upload.include.php[/FONT][/B][COLOR=#000000] which could be fixed by inserting the following line [U]below line 50[/U]:[/COLOR][/COLOR]
      [CODE]$host->setImage( $img );[/CODE]

      [B]Fixed Version[/B]
      Here is lines 48-51 (Line numbers shown and with 51 being the new line) of [B][FONT=Consolas][COLOR=#0000ff]${webdirdest}/fog/management/includes/management/includes/hosts.upload.include.php [/COLOR][/FONT][/B]that would fix this problem:[CODE]48 $img = $core->getImageManager()->getImageById( $data[5] );
      49 $mac = new MACAddress($data[0]);
      50 $host = new Host(-1, $data[1], $data[3] . " “._(“Uploaded by batch import on”).” " . date(“F j, Y, g:i a”), $data[2], null, $mac, $data[4]);
      51 $host->setImage( $img );[/CODE]

      1 Reply Last reply Reply Quote 0
      • C
        chad-bisd Moderator
        last edited by

        I think this is fixed in 0.33 code (revision 877) by looking at [url]http://freeghost.svn.sourceforge.net/viewvc/freeghost/trunk/packages/web/management/includes/hosts.upload.include.php?revision=877&view=markup[/url]

        I’m not sure what the process is for patching current and former versions of Fog for bug fixes. At some point we need to roll up a bunch of patches to each version and release a new revision or “service pack”, like Fog 0.32 SP1, but I have no experience in those kinds of things.

        Maybe some of us familiar enough to do bug fixes can get write access to the svn repository and work on patches while Fog developers work on the next version.


        If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

        1 Reply Last reply Reply Quote 0
        • C
          chad-bisd Moderator
          last edited by

          Just looked through the 0.32 code and I can’t figure out why the imageid is not accepted as an arg to the __construct (see [url]http://freeghost.svn.sourceforge.net/viewvc/freeghost/tags/0.32/packages/web/management/lib/Host.class.php?revision=877&view=markup[/url])

          It may be a dependency to check if the imageid is valid before setting the value for the host.


          If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

          1 Reply Last reply Reply Quote 0
          • A
            afmrick
            last edited by

            [QUOTE]I think this is fixed in 0.33 code (revision 877) by looking at [URL=‘http://freeghost.svn.sourceforge.net/viewvc/freeghost/trunk/packages/web/management/includes/hosts.upload.include.php?revision=877&view=markup’][COLOR=#555555]http://freeghost.svn.sourceforge.ne…s.upload.include.php?revision=877&view=markup[/COLOR][/URL][/QUOTE]
            Awesome! Thank you very much!

            I’m not sure exactly what you mean on your second post but, line 48 in the 0.32 [URL=‘http://freeghost.svn.sourceforge.net/viewvc/freeghost/tags/0.32/packages/web/management/includes/hosts.upload.include.php?revision=877&view=markup’]hosts.upload.include.php[/URL] checks*, I think, that the ImageID is valid with this**:
            [CODE]$img = $core->getImageManager()->getImageById( $data[5] );[/CODE] …but, it then does nothing with the [SIZE=4][FONT=sans-serif][COLOR=#19177c]$img[/COLOR][/FONT][/SIZE] variable e.g. it never assigns it to the host with out the line I added …or the far prettier method in 0.33.

            • Also see [URL=‘http://freeghost.svn.sourceforge.net/viewvc/freeghost/tags/0.32/packages/web/lib/fog/ImageManager.class.php?revision=796&view=markup’]ImageManager.class.php[/URL]
              ** [SIZE=4][FONT=sans-serif][COLOR=#000000][COLOR=#19177c]$data[/COLOR][/COLOR][/FONT][/SIZE][SIZE=4][FONT=sans-serif][COLOR=#000000][[/COLOR][/FONT][/SIZE][SIZE=4][FONT=sans-serif][COLOR=#000000][COLOR=#666666]5[/COLOR][/COLOR][/FONT][/SIZE][SIZE=4][FONT=sans-serif][COLOR=#000000]][/COLOR][/FONT][/SIZE] is the Image ID in the CSV
            1 Reply Last reply Reply Quote 0
            • Tom ElliottT
              Tom Elliott
              last edited by

              I’m guessing this is still fixed. Just wanted to add, however, the img ID may not be accurate in an import of this method as it’s basing the ID is matching exactly that on the new server, which may not always be the case.

              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
              • 1 / 1
              • First post
                Last post

              206

              Online

              12.0k

              Users

              17.3k

              Topics

              155.2k

              Posts
              Copyright © 2012-2024 FOG Project