Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to create ssh configuration directory #302

Open
sajith opened this issue Apr 9, 2024 · 0 comments
Open

Try to create ssh configuration directory #302

sajith opened this issue Apr 9, 2024 · 0 comments
Assignees

Comments

@sajith
Copy link
Member

sajith commented Apr 9, 2024

Following up the discussion on #301: create_ssh_config() as well as __create_and_save_key() methods would simply fail if our ssh configuration directory (which we typically expect to be ~/work/fabric_config/, but it could be elsewhere as well) does not exist.

dir_path = os.path.dirname(bastion_ssh_config_file)
if not os.path.exists(dir_path):
msg = (
f"Directory {dir_path} does not exist, can not create ssh_config file!"
)
print(msg)
logging.error(msg)
raise Exception(msg)

We could instead attempt to create the directory with os.mkdirs(dir_path) or pathlib.Path(dir_path).mkdir(parents=True).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant