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

Fix: Issue 705. Handling white space in path #810

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ritwik-g
Copy link
Contributor

@ritwik-g ritwik-g commented Oct 19, 2024

What

Why

  • When a whitespace was present in the path of script_dir it was not getting escaped properly which was causing errors.

How

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No. But will need to check for all script options.

Database Migrations

  • NA

Env Config

  • NA

Relevant Docs

  • NA

Related Issues or PRs

Dependencies Versions

Notes on Testing

  • Tested running the script without any params
  • tested with params -e and -u

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

run-platform.sh Outdated Show resolved Hide resolved
@hari-kuriakose
Copy link
Contributor

* with params `-e` and `-u` script is failing @hari-kuriakose
Traceback (most recent call last):
  File "/Users/personal/unstract error test/docker/scripts/merge_env.py", line 129, in <module>
    merge_env(sys.argv[1], sys.argv[2])
  File "/Users/personal/unstract error test/docker/scripts/merge_env.py", line 118, in merge_env
    target_env = _extract_from_env_file(target_env_file_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/personal/unstract error test/docker/scripts/merge_env.py", line 40, in _extract_from_env_file
    with open(file_path) as file:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'error'

@ritwik-g Can we try https://github.com/Zipstack/unstract/pull/810/files#r1807281638 ?

Copy link
Contributor

filepath function $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_logs}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup\_skip}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_client\_init}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image\_exists}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config\_without\_mount}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_run\_container}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{9}}$$ $$\textcolor{#23d18b}{\tt{9}}$$

Copy link

@ritwik-g
Copy link
Contributor Author

* with params `-e` and `-u` script is failing @hari-kuriakose
Traceback (most recent call last):
  File "/Users/personal/unstract error test/docker/scripts/merge_env.py", line 129, in <module>
    merge_env(sys.argv[1], sys.argv[2])
  File "/Users/personal/unstract error test/docker/scripts/merge_env.py", line 118, in merge_env
    target_env = _extract_from_env_file(target_env_file_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/personal/unstract error test/docker/scripts/merge_env.py", line 40, in _extract_from_env_file
    with open(file_path) as file:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'error'

@ritwik-g Can we try https://github.com/Zipstack/unstract/pull/810/files#r1807281638 ?

@hari-kuriakose your suggestion worked. I have pushed the change

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

Successfully merging this pull request may close these issues.

3 participants