@@ -1900,9 +1900,16 @@ def upgrade_interfaces(
19001900 dry_run : bool = False ,
19011901 ) -> UpgradeInterfacesResult :
19021902 """
1903- Automatically upgrades all legacy config interfaces of a single configuration profile to Linode interfaces.
1903+ Automatically upgrades all legacy config interfaces of a
1904+ single configuration profile to Linode interfaces.
1905+
1906+ NOTE: If dry_run is True, interfaces in the result will be
1907+ of type MappedObject rather than LinodeInterface.
19041908
19051909 API Documentation: Not yet available.
1910+
1911+ :returns: Information about the newly upgraded interfaces.
1912+ :rtype: UpgradeInterfacesResult
19061913 """
19071914 params = {"config_id" : config , dry_run : dry_run }
19081915
@@ -1912,7 +1919,18 @@ def upgrade_interfaces(
19121919 data = _flatten_request_body_recursive (drop_null_keys (params )),
19131920 )
19141921
1915- # TODO: Inject LinodeInterface objects here
1922+ # We don't convert interface dicts to LinodeInterface objects on dry runs
1923+ # actual API entities aren't created
1924+ if dry_run :
1925+ result ["interfaces" ] = [
1926+ MappedObject (** iface ) for iface in result ["interfaces" ]
1927+ ]
1928+ else :
1929+ result ["interfaces" ] = [
1930+ LinodeInterface (self ._client , self .id , iface ["id" ], iface )
1931+ for iface in result ["interfaces" ]
1932+ ]
1933+
19161934 return UpgradeInterfacesResult .from_json (result )
19171935
19181936
0 commit comments