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

Support pathlib.Path in FileAsset #2896

Closed
astronouth7303 opened this issue Jul 2, 2019 · 3 comments · Fixed by #3368

Comments

@astronouth7303
Copy link

@astronouth7303 astronouth7303 commented Jul 2, 2019

pulumi.FileAsset currently only supports strings, not pathlib.Path or anything else bearing __fspath__().

@ellismg

This comment has been minimized.

Copy link
Contributor

@ellismg ellismg commented Jul 3, 2019

Thanks for opening this! If you're interested, we'd be happy to accept a PR.

@campbellr

This comment has been minimized.

Copy link
Contributor

@campbellr campbellr commented Oct 16, 2019

@ellismg any issue with me picking this up?

@lukehoban

This comment has been minimized.

Copy link
Member

@lukehoban lukehoban commented Oct 17, 2019

@campbellr Absolutely!

In case you hadn't already found it - the relevant source code is at

"""
A FileAsset is a kind of asset produced from a given path to a file on
the local filesysetm.
"""
def __init__(self, path: str) -> None:
if not isinstance(path, str):
raise TypeError("FileAsset path must be a string")
self.path = path

And there are some tests at

MyResource("file", FileAsset("./testfile.txt"))
MyResource("string", StringAsset("its a string"))
MyResource("remote", RemoteAsset("https://pulumi.com"))

campbellr added a commit to campbellr/pulumi that referenced this issue Oct 18, 2019
campbellr added a commit to campbellr/pulumi that referenced this issue Oct 18, 2019
campbellr added a commit to campbellr/pulumi that referenced this issue Oct 18, 2019
pgavlin added a commit that referenced this issue Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.