mirror of https://github.com/pulumi/pulumi.git
5d7204e1c1
When an empty struct is returned from an invoke, the Python SDK was returning None, which causes the following error to be raised from generated provider Python SDKs when calling the invoke: ``` AssertionError: get can only be used with classes decorated with @input_type or @output_type ``` This is because the Python SDK is returning None if the return value isn't truthy, roughly: ``` ret_obj = getattr(resp, "return") if ret_obj: return ret_obj return None ``` However, an empty struct isn't truthy, so we're returning None in that case, and generated provider Python SDKs can't handle that. Other SDKs like the Node.js and Go SDKs don't have this problem. This commit fixes the issue by removing the `if ret_obj` check, as it's not necessary. In practice, `ret_obj` is always going to be an instance of `struct_pb2.Struct` because all monitors (CLI and mock) return an instance, though the instance may be empty, which is ok. Fixes #13985 |
||
---|---|---|
.. | ||
automation | ||
data/lazy_import_test | ||
langhost | ||
provider | ||
runtime | ||
__init__.py | ||
conftest.py | ||
helpers.py | ||
test_broken_dynamic_provider.py | ||
test_config.py | ||
test_invoke.py | ||
test_monitor_termination.py | ||
test_next_serialize.py | ||
test_output.py | ||
test_resource.py | ||
test_runtime_to_json.py | ||
test_stack_reference.py | ||
test_stack_registers_outputs.py | ||
test_translate_output_properties.py | ||
test_types_input_type.py | ||
test_types_input_type_types.py | ||
test_types_output_type.py | ||
test_types_resource_types.py | ||
test_urn.py | ||
test_utils.py |