https://pulumi.com logo
#general
Title
# general
k

kind-needle-67381

05/13/2022, 8:31 AM
in
create_relay
I do pulumi.log / print but I can't see their output ? How can I select the log level with automation ? how can I see my prints ?
b

bored-oyster-3147

05/13/2022, 5:22 PM
There should be an overload you can provide that allows you to hook into standard out and standard error.
I see you are doing on_output. What is the print function you are providing doing?
k

kind-needle-67381

05/13/2022, 6:54 PM
into standard out and standard error.
isn't it just stdout ? I used the "print" function from python
b

bored-oyster-3147

05/13/2022, 6:57 PM
Are you running in a context where you can see standard output from outside the pulumi function? Try testing it, build a string with everything that comes into the on_output function and print it after. I don't write in python so I can say by looking at it.
First I would verify that I am actually getting output from on_output.
k

kind-needle-67381

05/16/2022, 8:53 AM
I dot get output ("Resources unchanged ... duration: 1s") but none of what I set. I've actually tried to add a sys.exit(1) in my "create_relay" function to no avail so either pulumi does something very strange or that function is not even called (or just when creating the stack ?) it's very weird
arf I think I found why, there is this "inline" vs "local" programs. The distinction is not clear to me at all but if I add "project_name" to the create_or_select_stack call, it converts my program into an inline one and my function is called and I can see my "prints"
the doc needs to make the disctinction clearer, and the program should log something about it, it's confusing
b

bored-oyster-3147

05/16/2022, 7:11 PM
Ok yea the python api doesn't make it clear that you are creating a local program instead of an inline program. In the C# API it is very clear because you are providing an argument object called InlineProgramArgs: https://github.com/pulumi/automation-api-examples/blob/80afd678f6adc51eb9f0279ca62408b7f1e4623c/dotnet/InlineProgram/Program.cs#L98 You could raise an issue about that.
2 Views