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

Add a Python Azure Webserver example #236

Merged
merged 9 commits into from
Mar 21, 2019

Conversation

swgillespie
Copy link
Contributor

Adds an example using Python to deploy a web server on Azure.

Currently does not work and can't be merged, for two reasons:

  1. The most recently released version of pulumi doesn't have a fix for Resource IDs are always the empty string during previews pulumi#2450, this can be worked around with pip install --pre pulumi
  2. Python values coming from the engine are always strings pulumi#2459 means that the trick of using a data source to retrieve a virtual machine's IP does not work

@swgillespie
Copy link
Contributor Author

Update on this PR:

It's still not working, there's still some sort of type confusion happening:

    error: Program failed with an unhandled exception:
    error: Traceback (most recent call last):
      File "/usr/local/pulumi/bin/pulumi-language-python-exec", line 85, in <module>
        loop.run_until_complete(coro)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
        return future.result()
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 38, in run_in_stack
        await RPC_MANAGER.unhandled_exeception()
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
        result = await rpc_function(*args, **kwargs)
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi/runtime/resource.py", line 226, in do_register_resource_outputs
        serialized_props = await rpc.serialize_properties(outputs, {})
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi/runtime/rpc.py", line 57, in serialize_properties
        result = await serialize_property(v, deps, input_transformer)
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi/runtime/rpc.py", line 145, in serialize_property
        value = await serialize_property(value.future(), deps, input_transformer)
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi/runtime/rpc.py", line 135, in serialize_property
        future_return = await asyncio.ensure_future(value)
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi/output.py", line 141, in run
        return await cast(Awaitable[U], transformed)
      File "./__main__.py", line 73, in get_public_ip
        ip_result = await network.get_public_ip(name=public_ip_name, resource_group_name=resource_group_name)
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi_azure/network/get_public_ip.py", line 100, in get_public_ip
        id=__ret__.get('id'))
      File "/Users/swgillespie/go/src/github.com/pulumi/examples/azure-py-webserver/venv/lib/python3.6/site-packages/pulumi_azure/network/get_public_ip.py", line 34, in __init__
        raise TypeError('Expected argument idle_timeout_in_minutes to be a int')
    TypeError: Expected argument idle_timeout_in_minutes to be a int

Clearly something is coming back to Python as a string when it should have been an int.

@swgillespie swgillespie marked this pull request as ready for review March 20, 2019 18:28
@swgillespie
Copy link
Contributor Author

ping - this is now working and ready to review.

Copy link
Member

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible - could we add test coverage as well so that we run this for regression prevention nightly?

azure-py-webserver/__main__.py Outdated Show resolved Hide resolved
azure-py-webserver/README.md Show resolved Hide resolved
@swgillespie
Copy link
Contributor Author

The test failure is unrelated, the new test passes.

@swgillespie swgillespie merged commit a0813b9 into master Mar 21, 2019
@swgillespie
Copy link
Contributor Author

#260

@pulumi-bot pulumi-bot deleted the swgillespie/azure-py-webserver branch March 21, 2019 18:38
ramene pushed a commit to ramene/pulumi-kubeflow-ml that referenced this pull request Sep 7, 2019
* Add a Python Azure Webserver example

* Add README.md

* fix numbering

* Fix indentation in readme

* Update README now that this works

* Fix custom data + use simpler pattern for data source

* Format code

* Add test

* Fix syntax error
ramene pushed a commit to ramene/pulumi-kubeflow-ml that referenced this pull request Sep 13, 2019
* Add a Python Azure Webserver example

* Add README.md

* fix numbering

* Fix indentation in readme

* Update README now that this works

* Fix custom data + use simpler pattern for data source

* Format code

* Add test

* Fix syntax error
dixler pushed a commit that referenced this pull request Jan 21, 2022
* Add a Python Azure Webserver example

* Add README.md

* fix numbering

* Fix indentation in readme

* Update README now that this works

* Fix custom data + use simpler pattern for data source

* Format code

* Add test

* Fix syntax error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants