The `private_segments` are generated in the "setup" part of the test, but the `public_segments` won't exist if the call to `generate_ssh_key` does not succeed.

We are referencing a resource in the `finally` part that does not exist outside the `try` scope.