Skip to content

Custom SSL cert creation fails if ~/.ssh directory doesn't exist #6

@jnebeker

Description

@jnebeker

Came across this when setting up @jkim628's local dev environment. She had not generated a ssh keypair yet so she had no ~/.ssh directory which caused the creation of the custom SSL cert to fail:

@combined_cert = Pathname("~/.ssh/pumadev.pem").expand_path

File.open(combined_cert, "w") do |cert_file|
cert_file.write base_cert.read
cert_file.write "\n"
cert_file.write cert.read
end

here was the error we were getting:

Configuring SSL...
Creating custom CA SSL cert for puma-dev...
Traceback (most recent call last):
    2: from bin/puma-dev-conf:100:in `<main>'
    1: from bin/puma-dev-conf:100:in `open'
bin/puma-dev-conf:100:in `initialize': No such file or directory @ rb_sysopen - /Users/julianakim/.ssh/pumadev.pem (Errno::ENOENT)

Once we ran ssh-keygen and the ~/.ssh directory was created everything was fine, but it would be nice to catch this edge case and spit out a helpful error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions