dry-alligator-64228
07/25/2023, 10:34 PMTypeError: 'list' object is not callable
on unit tests running during a ci pipeline. I didn't make any changes to the tests or resources being tested, but I am working through a pulumi-azure-native migration from v1 to v2. I was seeing this unit test error pre migration as well though so I'm not completely sure what's causing the failure. The line it's failing on was added somewhat recently so I figured I'd call it out here: https://github.com/pulumi/pulumi/commit/5685291373b906c6a91b0986310eaefcab9264ff
Failure:
2023-07-25T22:32:39.8476037Z args = (), kwargs = {}
2023-07-25T22:32:39.8476169Z
2023-07-25T22:32:39.8476268Z @functools.wraps(fn)
2023-07-25T22:32:39.8476501Z def wrapper(*args, **kwargs):
2023-07-25T22:32:39.8477023Z from .. import Output # pylint: disable=import-outside-toplevel
2023-07-25T22:32:39.8477268Z
2023-07-25T22:32:39.8477435Z > _sync_await(
2023-07-25T22:32:39.8477633Z run_pulumi_func(
2023-07-25T22:32:39.8477925Z lambda: _sync_await(Output.from_input(fn(*args, **kwargs)).future())
2023-07-25T22:32:39.8478186Z )
2023-07-25T22:32:39.8478353Z )
2023-07-25T22:32:39.8478459Z
2023-07-25T22:32:39.8478767Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/runtime/mocks.py:45:
2023-07-25T22:32:39.8479094Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-07-25T22:32:39.8479567Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/runtime/sync_await.py:56: in _sync_await
2023-07-25T22:32:39.8479910Z return loop.run_until_complete(fut)
2023-07-25T22:32:39.8480236Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/asyncio/base_events.py:647: in run_until_complete
2023-07-25T22:32:39.8480546Z return future.result()
2023-07-25T22:32:39.8480982Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/runtime/stack.py:49: in run_pulumi_func
2023-07-25T22:32:39.8481276Z func()
2023-07-25T22:32:39.8481919Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/runtime/mocks.py:47: in <lambda>
2023-07-25T22:32:39.8482296Z lambda: _sync_await(Output.from_input(fn(*args, **kwargs)).future())
2023-07-25T22:32:39.8482848Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/runtime/sync_await.py:89: in _sync_await
2023-07-25T22:32:39.8483149Z return fut.result()
2023-07-25T22:32:39.8483776Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:128: in get_value
2023-07-25T22:32:39.8484094Z val = await self._future
2023-07-25T22:32:39.8484490Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:174: in run
2023-07-25T22:32:39.8484789Z value = await self._future
2023-07-25T22:32:39.8485180Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:174: in run
2023-07-25T22:32:39.8485473Z value = await self._future
2023-07-25T22:32:39.8485888Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:467: in gather_futures
2023-07-25T22:32:39.8486233Z return await asyncio.gather(*value_futures_list)
2023-07-25T22:32:39.8486673Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:128: in get_value
2023-07-25T22:32:39.8486963Z val = await self._future
2023-07-25T22:32:39.8487354Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:211: in run
2023-07-25T22:32:39.8487691Z return await transformed.future(with_unknowns=True)
2023-07-25T22:32:39.8488137Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:128: in get_value
2023-07-25T22:32:39.8488427Z val = await self._future
2023-07-25T22:32:39.8488814Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:211: in run
2023-07-25T22:32:39.8489201Z return await transformed.future(with_unknowns=True)
2023-07-25T22:32:39.8489635Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:128: in get_value
2023-07-25T22:32:39.8489939Z val = await self._future
2023-07-25T22:32:39.8490357Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:472: in gather_futures
2023-07-25T22:32:39.8490707Z return await _gather_from_dict(value_futures_dict)
2023-07-25T22:32:39.8491152Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:879: in _gather_from_dict
2023-07-25T22:32:39.8491494Z results = await asyncio.gather(*tasks.values())
2023-07-25T22:32:39.8491923Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:128: in get_value
2023-07-25T22:32:39.8492208Z val = await self._future
2023-07-25T22:32:39.8492614Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:467: in gather_futures
2023-07-25T22:32:39.8492957Z return await asyncio.gather(*value_futures_list)
2023-07-25T22:32:39.8493397Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:128: in get_value
2023-07-25T22:32:39.8493686Z val = await self._future
2023-07-25T22:32:39.8494073Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:199: in run
2023-07-25T22:32:39.8494381Z transformed: Input[U] = func(value)
2023-07-25T22:32:39.8494798Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:318: in liftValues
2023-07-25T22:32:39.8495101Z return Output.all(**d)
2023-07-25T22:32:39.8495725Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:484: in all
2023-07-25T22:32:39.8496060Z {k: from_input(v) for k, v in kwargs.items()}
2023-07-25T22:32:39.8496488Z /opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pulumi/output.py:484: in <dictcomp>
2023-07-25T22:32:39.8496818Z {k: from_input(v) for k, v in kwargs.items()}
2023-07-25T22:32:39.8497072Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-07-25T22:32:39.8497343Z
2023-07-25T22:32:39.8497857Z val = {'certificates': ['get', 'list', 'delete', 'create', 'import', 'update', 'managecontacts', 'getissuers', 'listissuers'..., 'restore', 'recover', 'purge'], 'secrets': ['get', 'list', 'set', 'delete', 'backup', 'restore', 'recover', 'purge']}
2023-07-25T22:32:39.8498219Z
2023-07-25T22:32:39.8498301Z @staticmethod
2023-07-25T22:32:39.8498711Z def from_input(val: Input[T_co]) -> "Output[T_co]":
2023-07-25T22:32:39.8498936Z """
2023-07-25T22:32:39.8499255Z Takes an Input value and produces an Output value from it, deeply unwrapping nested Input values through nested
2023-07-25T22:32:39.8499700Z lists, dicts, and input classes. Nested objects of other types (including Resources) are not deeply unwrapped.
2023-07-25T22:32:39.8499989Z
2023-07-25T22:32:39.8500228Z :param Input[T_co] val: An Input to be converted to an Output.
2023-07-25T22:32:39.8500673Z :return: A deeply-unwrapped Output that is guaranteed to not contain any Input values.
2023-07-25T22:32:39.8500980Z :rtype: Output[T_co]
2023-07-25T22:32:39.8501165Z """
2023-07-25T22:32:39.8501315Z
2023-07-25T22:32:39.8501563Z # Is it an output already? Recurse into the value contained within it.
2023-07-25T22:32:39.8501845Z if isinstance(val, Output):
2023-07-25T22:32:39.8502102Z return val.apply(Output.from_input, True)
2023-07-25T22:32:39.8502326Z
2023-07-25T22:32:39.8502579Z # Is it an input type (i.e. args class)? Recurse into the values within.
2023-07-25T22:32:39.8502835Z typ = type(val)
2023-07-25T22:32:39.8503058Z if _types.is_input_type(typ):
2023-07-25T22:32:39.8503488Z # We know that any input type can safely be decomposed into it's `__dict__`, and then reconstructed
2023-07-25T22:32:39.8503892Z # via `type(**d)` from the (unwrapped) properties (bar empty input types, see next comment).
2023-07-25T22:32:39.8504220Z o_typ = Output.all(**val.__dict__).apply(
2023-07-25T22:32:39.8504542Z # if __dict__ was empty `all` will return an empty list object rather than a dict object,
2023-07-25T22:32:39.8505066Z # there isn't really a good way to express this in mypy so the type checker doesn't pickup on
2023-07-25T22:32:39.8505543Z # this. If we get an empty list we can't splat it as that results in a type error, so check
2023-07-25T22:32:39.8506023Z # that we have some values before splatting. If it's empty just call the `typ` constructor
2023-07-25T22:32:39.8506335Z # directly with no arguments.
2023-07-25T22:32:39.8506562Z lambda d: typ(**d)
2023-07-25T22:32:39.8506749Z if d
2023-07-25T22:32:39.8506940Z else typ()
2023-07-25T22:32:39.8507125Z )
2023-07-25T22:32:39.8507326Z return cast(Output[T_co], o_typ)
2023-07-25T22:32:39.8507524Z
2023-07-25T22:32:39.8507849Z # Is a (non-empty) dict or list? Recurse into the values within them.
2023-07-25T22:32:39.8508133Z if val and isinstance(val, dict):
2023-07-25T22:32:39.8508517Z # The keys themselves might be outputs, so we can't just pass `**val` to all.
2023-07-25T22:32:39.8508766Z
2023-07-25T22:32:39.8509253Z # keys() and values() will be in the same order: <https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects>
2023-07-25T22:32:39.8509610Z > keys = list(val.keys())
2023-07-25T22:32:39.8509918Z E TypeError: 'list' object is not callable