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

OrasClient.push fails on Windows as empty Manifest Config uses /dev/null which is Linux specific #90

Closed
sunnycarter opened this issue Jul 4, 2023 · 2 comments

Comments

@sunnycarter
Copy link
Contributor

sunnycarter commented Jul 4, 2023

My code runs fine on Linux. On Windows it fails with an error.

Here's my code:

        client = OrasClient(hostname=acr_url)
        
        client.login(
            username=self._manifest_credentials["username"],
            password=self._manifest_credentials["acr_token"],
        )
        target = (
                f"{client.remote.hostname.replace('https://', '')}/testartifact:1.0.0"
            )
        client.push(`
                files=["testartifact.json"],
                target=target
            )
 File "<>\oras\client.py", line 131, in push
    return self.remote.push(*args, **kwargs)
  File "<>\oras\provider.py", line 718, in push
    response = self.upload_blob(config_file, container, conf)
  File "<>\oras\provider.py", line 217, in upload_blob
    response = self.put_upload(blob, container, layer)
  File "<>\oras\provider.py", line 474, in put_upload
    with open(blob, "rb") as fd:
OSError: [Errno 22] Invalid argument: 'C:\\dev\\null'

I have made a fix for this and will submit a PR. The fix is in oci.py ManifestConfig:

        if platform.system() == "Windows":
            path = "nul"
        else:
            path = "/dev/null"
@sunnycarter
Copy link
Contributor Author

#91 submitted to fix this

@sunnycarter
Copy link
Contributor Author

Fixed in 0.1.18

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