Skip to content

Can't import when running on a read-only filesystem #217

@timmartin

Description

@timmartin

Describe the bug
If you attempt to import runpod while running on a read-only filesystem (such as in AWS Lambda) then there is an unhandled exception attempting to write to ~/.runpod/ssh. There is no workaround to this (such as configuring the SSH directory to be created on /tmp) since this path is hard-coded and not configurable.

To Reproduce

  • Create a Docker image with the following Dockerfile:
FROM python:3.10

RUN pip install runpod
  • Run this docker image with docker run -it --read-only runpod_test
  • Execute import runpod inside the container

This will give:

Python 3.10.4 (main, May 11 2022, 07:15:55) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import runpod
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/runpod/__init__.py", line 18, in <module>
    from .cli.groups.config.functions import set_credentials, check_credentials, get_credentials
  File "/usr/local/lib/python3.10/site-packages/runpod/cli/__init__.py", line 5, in <module>
    from .groups import config, ssh
  File "/usr/local/lib/python3.10/site-packages/runpod/cli/groups/ssh/__init__.py", line 3, in <module>
    from . import functions
  File "/usr/local/lib/python3.10/site-packages/runpod/cli/groups/ssh/functions.py", line 13, in <module>
    os.makedirs(os.path.join(SSH_FILES), exist_ok=True)
  File "/usr/local/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/local/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/root/.runpod'

Expected behavior
Either to continue without SSH configured, or to allow the SSH directory to be configured so that it can be place on a writable filesystem.

Desktop (please complete the following information):

  • OS: Linux
  • Version: runpod Python 1.3.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions