Most of my development work so far has been against a 2200 which I personally own. It has a perpetual license, but it's sometimes a little unpredictable. The API service sometimes crashes. It has a lot of unique state from all the changes I've made on it while building stuff. This makes it okay for human testing, but really not great for automated testing (it's hard to write a unit test if the API target can move).

Clearly the 15-day plug-n-play eval is well-suited for this. Just spin up a new VM with a known config, and run the automated tests against that, right? Well, it turns out the 15-day eval starts counting down when you first boot GAiA. If you do stuff like installing patches or adding your SSH keys, you're out of luck. The image is only good for 15 days. And the installation is kind of hard to automate. You have to type stuff like the password you want for admin, and the initial IP address.

Blink is the solution to this, right? Well ... not really. It lets you automate some of the installation, but you still end up with a different web UI certificate and SSH host keys every time you reimage the system. Automated tests against a new certificate every time? Pretty gross. Key change prompt every time you connect via SSH? Even worse.



I ended up playing a little trick on GAiA. I ran the R80.40 installer, then at the end when it asks to reboot, I instead powered off the VM. Next, I booted it with a Linux LiveCD (I happened to use Devuan. Anything which understands LVM and XFS should be fine.) and mounted the LVM volumes. This let me make changes to the filesystem before the first boot. Specifically, I made these changes:

  1. Copied /web/conf/server.key and /web/conf/server.crt from a working VM to this new one
  2. Copied /etc/ssh/ssh_host* from a working VM to this new one
  3. Made /home/admin/.ssh/authorized_keys and added my workstation's public key to it


Note that /home/admin/.ssh must be mode 700, and /home/admin/.ssh/authorized_keys must be mode 600.

With the files in place, I shut down the VM, removed the LiveCD from its optical drive, and took another snapshot. Booted the VM, and checked the eval expiration date via 'show installer status'. Using the hypervisor's CLI tool, I powered the VM off, restored it to the snapshot, and powered it on again. Checked the eval expiration date again, and it was different! Success!

Note that when you restore to the snapshot, it is a completely unconfigured GAiA system. If you give it your SSH key via the LiveCD as I described above, you can easily copy over a config_system file and use that to run the initial wizard. From there, you can easily also copy over the latest CPUSE, jumbo, and so on, and install them. I am further using some mgmt_cli commands to insert some initial data for development purposes.



Kind of a headache, but it's the best way I've found so far to get disposable SmartCenters or MDSs without a huge amount of manual interaction.