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

Python generating incorrect if statement #11171

Closed
jaxxstorm opened this issue Oct 27, 2022 · 4 comments
Closed

Python generating incorrect if statement #11171

jaxxstorm opened this issue Oct 27, 2022 · 4 comments
Labels
area/codegen SDK-gen, program-gen, convert kind/bug Some behavior is incorrect or out of spec language/python resolution/duplicate This issue is a duplicate of another issue

Comments

@jaxxstorm
Copy link
Contributor

What happened?

I have generated a python SDK for a bridged provider. Unfortunately, the generated python code isn't valid

Steps to reproduce

See this line

https://github.com/lbrlabs/pulumi-grafana/blob/main/sdk/python/lbrlabs_pulumi_grafana/provider.py#L455

Expected Behavior

I can create a provider

Actual Behavior

Diagnostics:
  pulumi:pulumi:Stack (pulumi_grafana_service_account_python-dev):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/lbriggs/src/github/lbrlabs/pulumi-grafana/examples/python/service_account/./__main__.py", line 4, in <module>
        import lbrlabs_pulumi_grafana as grafana
      File "/Users/lbriggs/src/github/lbrlabs/pulumi-grafana/sdk/python/bin/lbrlabs_pulumi_grafana/__init__.py", line 57, in <module>
        from .provider import *
      File "/Users/lbriggs/src/github/lbrlabs/pulumi-grafana/sdk/python/bin/lbrlabs_pulumi_grafana/provider.py", line 455
        __props__.__dict__["http_headers"] = None if pulumi.Output.from_input(http_headers).apply(pulumi.runtime.to_json) if http_headers is not None else None is None else pulumi.Output.secret(pulumi.Output.from_input(http_headers).apply(pulumi.runtime.to_json) if http_headers is not None else None)
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: expected 'else' after 'if' expression

Output of pulumi about

No response

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@jaxxstorm jaxxstorm added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 27, 2022
@jaxxstorm
Copy link
Contributor Author

Okay, this might actually be a python bug

https://bugs.python.org/issue44838

@jaxxstorm
Copy link
Contributor Author

We still need to fix this unfortunately as it effects python 3.10

@jaxxstorm
Copy link
Contributor Author

I fixed this by omitting the values from the schema for now

@iwahbe iwahbe added language/python area/codegen SDK-gen, program-gen, convert and removed needs-triage Needs attention from the triage team labels Oct 31, 2022
@justinvp justinvp added the resolution/duplicate This issue is a duplicate of another issue label Jul 27, 2023
@justinvp
Copy link
Member

This is a duplicate of #11278 which was fixed by #11494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen SDK-gen, program-gen, convert kind/bug Some behavior is incorrect or out of spec language/python resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants