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

[BUG] Unable to plan on Windows #764

Open
MartinPJones opened this issue Jun 4, 2024 · 1 comment
Open

[BUG] Unable to plan on Windows #764

MartinPJones opened this issue Jun 4, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@MartinPJones
Copy link

Describe the bug
On Windows 10, after a fresh install in a virtual environment, the ecs-compose-x plan command fails with the error FileNotFoundError: [WinError 2] The system cannot find the file specified: '\\compose-spec.json'

To Reproduce
Steps to reproduce the behavior:

  1. How you installed ECS ComposeX: Through pip in a virtual environment:
venv\Scripts\activate
pip install ecs_composex
  1. How you are executing it ? : As a CLI tool in venv, over powershell.
    (venv) PS {mydir}> ecs-compose-x plan -f .\compose.yaml -n {project name} --region us-west-1
  2. See error:
    jsonschema.exceptions.RefResolutionError: <urlopen error [WinError 2] The system cannot find the file specified: '\\compose-spec.json'>

Expected behavior
Compose-X should plan out the deploy process to ECS.

Logs

(venv) PS F:\Projects\clocker-2.0> ecs-compose-x plan -f .\compose.yaml -n clocker --region us-west-1
2024-06-04 11:25:12 [    INFO] Validating against input schema F:\Projects\clocker-2.0\venv\lib\site-packages\ecs_composex\specs\compose-spec.json
Traceback (most recent call last):
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 909, in resolve_from_url
    document = self.store[url]
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\_utils.py", line 28, in __getitem__
    return self.store[self.normalize(uri)]
KeyError: 'file://F:\\Projects\\clocker-2.0\\venv\\lib\\site-packages\\ecs_composex\\specs/compose-spec.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python38\lib\urllib\request.py", line 1507, in open_local_file
    stats = os.stat(localfile)
FileNotFoundError: [WinError 2] The system cannot find the file specified: '\\compose-spec.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 912, in resolve_from_url
    document = self.resolve_remote(url)
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 1018, in resolve_remote
    with urlopen(uri) as url:
  File "C:\Python38\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python38\lib\urllib\request.py", line 525, in open
    response = self._open(req, data)
  File "C:\Python38\lib\urllib\request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Python38\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "C:\Python38\lib\urllib\request.py", line 1485, in file_open
    return self.open_local_file(req)
  File "C:\Python38\lib\urllib\request.py", line 1524, in open_local_file
    raise URLError(exp)
urllib.error.URLError: <urlopen error [WinError 2] The system cannot find the file specified: '\\compose-spec.json'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "F:\Projects\clocker-2.0\venv\Scripts\ecs-compose-x.exe\__main__.py", line 7, in <module>
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\ecs_composex\cli.py", line 194, in main
    settings = ComposeXSettings(**vars(args))
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\ecs_composex\common\settings.py", line 179, in __init__
    self.set_content(kwargs, content)
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\ecs_composex\common\settings.py", line 537, in set_content
    jsonschema.validate(
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 1119, in validate
    error = exceptions.best_match(validator.iter_errors(instance))
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\exceptions.py", line 384, in best_match
    best = next(errors, None)
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 288, in iter_errors
    for error in errors:
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\_validators.py", line 332, in properties
    yield from validator.descend(
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 305, in descend
    for error in self.evolve(schema=schema).iter_errors(instance):
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 288, in iter_errors
    for error in errors:
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\_validators.py", line 25, in patternProperties
    yield from validator.descend(
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 305, in descend
    for error in self.evolve(schema=schema).iter_errors(instance):
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 288, in iter_errors
    for error in errors:
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\_validators.py", line 294, in ref
    scope, resolved = validator.resolver.resolve(ref)
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 898, in resolve
    return url, self._remote_cache(url)
  File "F:\Projects\clocker-2.0\venv\lib\site-packages\jsonschema\validators.py", line 914, in resolve_from_url
    raise exceptions.RefResolutionError(exc)
jsonschema.exceptions.RefResolutionError: <urlopen error [WinError 2] The system cannot find the file specified: '\\compose-spec.json'>

Desktop (please complete the following information):

  • OS: Windows 10
  • Python version: 3.8.3
  • If you were doing things from a branch, which one?
    All of this is done from the result of install from pip.

I manually did verify that compose-spec.json is in the location it should be, I'm not sure where the pathing is going wrong as the log says it's validating against F:\Projects\clocker-2.0\venv\lib\site-packages\ecs_composex\specs\compose-spec.json which is a correct path.

@MartinPJones MartinPJones added the bug Something isn't working label Jun 4, 2024
@JohnPreston
Copy link
Member

Hello @MartinPJones and thank you for reporting this bug.
Well that's going to be an interesting one try and fix considering I do not have access to a windows machine.
I will do my best to figure out what ChatGPT and otherwise answers might help with this.

Sorry about the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants