Generating a local hosts file from your running LA machines

I have created an application that updates the public IP addresses  of your Linux Academy cloud  hosts in a copy of your local hosts file.

You can find out more here  
https://github.com/RobertKielty/la-hostfile-gnr8r

There are a couple of assumptions baked into the code related to my local setup and how I logon to LA. I'm using a Linux laptop and I logon to LA using a linked Google a/c. If this is not quite your set up, the  code could be easily altered to work for windows or other logon options.

So feedback, bug report and PRs welcome if you are interested in working on this code.

Rob


  • post-author-pic
    Brandon B
    10-17-2018

    Thanks for sharing this Rob! 

  • post-author-pic
    Sean G
    10-17-2018

    Fair warning, we're releasing a new version of the cloud servers called the 'Playground' soon and this code will not work with that version!


    Great work with this though, very cool.

  • post-author-pic
    rkielty-5c4f1e5f
    10-18-2018

    Thanks Brandon.


    Thanks for the fair warning Sean.  That's fair enough.

    I added some new features since I posted this; no sed dependancy now, all LA hosts are added to the generated file, not just the ones present in the existing /etc/hosts and the code waits for the machine status 5 element to be rendered before file generation.

    The final feature I would like to do would be to use the Server Tag as an alias for the machine in the gernerated hostfile. Had a quick look at this when I started, it was tricky on the Selenide/Selnium side so I pressed on with the main event. Should be doable though.


    If still relevent  in the new setup it would be great if the new UI had this built in as a feature so that as a user I could hit a copy button to copy  a set of local hostfile entries for the LA hosts just provisioned to the copy/paste buffer (or even just render the entries as they should appear in a hosts file with correct aliases based on the tags)



Looking For Team Training?

Learn More