hetzner: Fix handling network ifaces with no IP.

If no interface address is set in rescue system, we got an exception
because we tried to split off the prefix from an address that actually
doesn't exist. This should now be fixed and we don't even fix the
hardware address of those interfaces, so it gets registered with a name
like "enp0s25" (the new-style udev interface names).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
hetzner: Ucfirst comments in _gen_network_spec().

This is only in order to have more consistency in the comments, no
feature changes.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
hetzner: Add TEST_MODE to disable API access.

Basically this constant is always set to False by default and will be
replaced using sed in the VM tests. This is temporarily until we have a
full sandbox environment of the Hetzner Robot infrastructure which
probably won't happen anytime soon (or even at all), as it involves even
one more machine, which acts as a pxeboot/dhcp server which also servers
the Robot API and some mockups of the user interface.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Directly add some debs to rescue.

So far, there was only openssh, that has been added to the rescue system
itself by adding a specific package-lists hook. It doesn't suffice to
add it just to the dependency list of live-build itself, because it
might not end up being installed in the resulting system. And we now
have even more packages that we need in the resulting system.

That's why we now have a new attribute called additionalRescuePackages,
which is solely for this purpose, so everything that's put in there will
end up being in the live ISO.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Eject virtual CD drive in targets.

On reboot, we just eject the virtual ISO, so the system is going to
reboot into the real system, much like as in the real Hetzner
infrastructure, where the rescue system is only activated once for the
_next_ boot.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Add and integrate target exprs.

This adds the Nix expressions needed to deploy the two target machines.
Both have different partition schemes, so we can test later on if the
partitioning was applied correctly.

Of course, this adds everything that is needed to use the network
expressions on the target machines. The only thing that's missing now is
the coordinator itself.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Finish expr for the coordinator.

This finally enables the TEST_MODE we mentioned in an earlier commit. In
addition, we need to make sure we have all dependencies that might need
networking access to the coordinator machine for the build processes to
finish flawlessly.

One thing I don't like here is the amount of memory we need for the
coordinator, but it already is so low that no OOM conditions arise
anymore, at least on my machine.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Do a final deploy of all targets.

This is to ensure both targets are up to date in the final "nixops info"
overview.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Add instrumentation to targets.

This is to ensure that the final VM test commands succeed and we can
actually issue other commands on the machines directly if needed.

To avoid duplication of code, this is now a function called
withCommonOptions, which is applied to every target attribute.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Disable DHCP for targets.

The second interface (eth1) is already statically configured and the
first one is unconfigured, which we want to leave like that, so don't
try to fetch an IP address for it.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
tests/hetzner: Check filesystems of the targets.

This is only a small check to ensure the right set of root filesystems
were created on the target machines.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>