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

Add Host Primary Disk to registration form

Scheduled Pinned Locked Moved
FOG Problems
1
3
367
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.
  • M
    mstabrin
    last edited by Mar 28, 2021, 8:43 PM

    Hello FOG Team,

    Almost every machine we are dealing with has more than one hard drive connected, typically one SSD for the OS, one SSD for fast scratch, and one or several for the data.

    I realized that I can specify the SSD for the OS in the Host Management Edit Host Primary Disk, however, I would like to deploy images directly after registration and, therefore, it would be great to be able to set it during this process already.

    I think I can adjust the registration form similiar to that:
    https://forums.fogproject.org/topic/13500/dynamically-patching-fos-using-a-postinit-script

    However, I am not sure how I to add the specific entry to the hosts FOG server entry.

    I looked at the API system following this guide:
    https://news.fogproject.org/simplified-api-documentation/

    And I succesfully did

    curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN_USER' -X GET http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/host/list
    

    and realized that it is the kernelDevice entry of my device that I want to modify.

    Do you have an advise how to put together the respective β€œPOST” command to change this entry or do you have another suggestion how to approach the problem in the first place? πŸ™‚

    Thank you!

    Best,
    Markus

    1 Reply Last reply Reply Quote 0
    • M
      mstabrin
      last edited by Mar 28, 2021, 8:56 PM

      Ok that was fast, So I answered my own question with the help of
      https://forums.fogproject.org/topic/11058/fog-api/13

      curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN_USER' -X PUT -d '{"kernelDevice": "/dev/sda"}' http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/host/HOST_ID/edit
      

      I checked the API page:
      https://news.fogproject.org/simplified-api-documentation/

      But it seems that the search option is not working the way I think it works:

      curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN_USER' -X GET http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/search/HOSTNAME
      

      However, my idea for a workaround would be now to parse the host list for the hostname to figure out the HOST_ID and afterwards set the respective entry with the provided infos.
      So now the only thing left is to modify the registration form πŸ™‚

      Best,
      Markus

      1 Reply Last reply Reply Quote 0
      • M
        mstabrin
        last edited by mstabrin Mar 29, 2021, 1:24 AM Mar 29, 2021, 7:21 AM

        Ok I also found the answer to my search question:
        https://forums.fogproject.org/topic/10036/api/2
        The search syntax is slightly different to the news article.

        So here would be an example command for completion:

        curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN' -X GET  http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/host | jq '.hosts[] | select(.name == "HOSTNAME") | .name'
        

        Thanks again for letting me do my inner monologue on your platform! πŸ™‚

        Best,
        Markus

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

        140

        Online

        12.1k

        Users

        17.3k

        Topics

        155.3k

        Posts
        Copyright Β© 2012-2024 FOG Project