#'Cannot convert value to AST' on with_mounted_directory

1 messages · Page 1 of 1 (latest)

vocal oriole
#

Hello! I'm getting TypeError: Cannot convert value to AST: <Directory instance>. when I'm trying to mount a directory with a file:

.with_mounted_directory(
    mnt,
    client.directory().with_file(
        file_name,
        client.host().directory(
            f"{script_dir}/shell/terraform"
        ).file("docs.sh").id(),
    ),
)

Example variables:

mnt = /mnt
script_dir = /Users/user/workspace/dagger-utilities-library/dul
file_name = 5s9qvjcf_script.sh

Am I doing anything wrong?

misty valve
#

Are you using the public v0.1.1 or from main?

#

If on v0.1.1, you need to await that .id(). But as the error suggests it's expecting a Directory instance, it makes me think you may be running off of git's main branch.

#

Also, on a glance, I think when you request file("docs.sh"), you should prefix the full path.

vocal oriole
#

Hello @misty valve , I'm using 0.1.1 version, thanks, I'll now take a look at the possible locations!

vocal oriole
#

That was indeed the wrong type, I didn't take an id() of the second argument of with_mounted_directory method above. Also I've moved it as id() has to be awaited.