https://pulumi.com logo
c

cuddly-eye-68174

01/15/2019, 8:32 PM
Hi Guys, Is there a way to decide / query which stage is running in pulumi up. There is some checking, information gathering stage and there is an update stage. Can I ask/query this with some Pulumi function? Because I would like to make some custom Pulumi resource and it would be great to avoid double runs. Can you please helm me out? Thanks
w

white-balloon-205

01/15/2019, 8:37 PM
You mean preview vs. update? There is a
pulumi.runtime.isDryRun()
(https://pulumi.io/reference/pkg/nodejs/@pulumi/pulumi/runtime/#isDryRun) function which will answer that. This can be useful for simple things, but for more complex things you generally end up wanting to use a dynamic provider to be able to participate fully in the resource lifecycle.
c

cuddly-eye-68174

01/15/2019, 8:37 PM
Yes preview vs update thanks...I am still learning terminology
Luke, in python I got True in both case
This is my code
🙂 it is pretty simple
this is the CLI output
What I miss? 🙂
w

white-balloon-205

01/15/2019, 8:52 PM
Hmm - that’s doesn’t look right. Do you need the bool conversion there? I would have expected you to need that. We use this ourselves in the implementation, so it should work correctly: https://github.com/pulumi/pulumi/search?utf8=✓&q=is_dry_run&type= Cc also @incalculable-sundown-82514
c

cuddly-eye-68174

01/15/2019, 8:53 PM
same without bool casting, I just like to do that 🙂 but i can remove it
Here is the code again
I am checking your link
I have changed the code for this
but same result
python modules
Thanks 😉
i

incalculable-sundown-82514

01/15/2019, 9:50 PM
i’m just catching up on this thread, are you still seeing the problem?
c

cuddly-eye-68174

01/15/2019, 9:50 PM
Yes Sean
i

incalculable-sundown-82514

01/16/2019, 12:57 AM
Can you print out the value of
runtime.is_dry_run
when doing a preview?
c

cuddly-eye-68174

01/16/2019, 2:00 AM
@incalculable-sundown-82514
i

incalculable-sundown-82514

01/16/2019, 4:32 AM
And it’s false when doing an update?
c

cuddly-eye-68174

01/16/2019, 8:22 AM
@incalculable-sundown-82514 It's never false at me. I think there are 2 stages on the picture above, but please correct me if not. There is a preview stage with return value "True" and there is an update stage with return value True too and I think this last one is the problem. So in both case I got True. Maybe I miss something, I dont know, this is why I came to ask.
If I skip the preview I get also True
i

incalculable-sundown-82514

01/16/2019, 6:24 PM
hmm, that’s super strange - i’ll take a look today.
opened https://github.com/pulumi/pulumi/issues/2360 at high priority - thanks for the report, and sorry for the delay in following-up here!
c

cuddly-eye-68174

01/16/2019, 6:39 PM
Thanks Sean
i

incalculable-sundown-82514

01/16/2019, 6:56 PM
I have a fix for the issue here: https://github.com/pulumi/pulumi/pull/2361. It’ll be in the next release of Pulumi, but if you’re blocked on this issue you can make this change https://github.com/pulumi/pulumi/pull/2361/files#diff-c136b8e513dc228c53777067bc4a87fd to this file, located in your installation adjacent to the
pulumi
binary