Skip to content

Try to create ssh configuration directory #302

@sajith

Description

@sajith

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).

Metadata

Metadata

Assignees

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