@@ -284,22 +284,32 @@ def ips_share(self, linode, *ips):
284
284
285
285
def ip_addresses_share (self , ips , linode ):
286
286
"""
287
- Configure shared IPs. P sharing allows IP address reassignment
287
+ Configure shared IPs. IP sharing allows IP address reassignment
288
288
(also referred to as IP failover) from one Linode to another if the
289
289
primary Linode becomes unresponsive. This means that requests to the primary Linode’s
290
290
IP address can be automatically rerouted to secondary Linodes at the configured shared IP addresses.
291
291
292
+ API Documentation: https://www.linode.com/docs/api/networking/#ip-addresses-share
293
+
292
294
:param linode: The id of the Instance or the Instance to share the IPAddresses with.
293
295
This Instance will be able to bring up the given addresses.
294
296
:type: linode: int or Instance
295
- :param ips: Any number of IPAddresses to share to the Instance.
297
+ :param ips: Any number of IPAddresses to share to the Instance. Enter an empty array to
298
+ remove all shared IP addresses.
296
299
:type ips: str or IPAddress
297
300
"""
298
301
302
+ shared_ips = []
303
+ for ip in ips :
304
+ if isinstance (ip , str ):
305
+ shared_ips .append (ip )
306
+ elif isinstance (ip , IPAddress ):
307
+ shared_ips .append (ip .address )
308
+ else :
309
+ shared_ips .append (str (ip )) # and hope that works
310
+
299
311
params = {
300
- "ips" : ips
301
- if not isinstance (ips [0 ], IPAddress )
302
- else [ip .address for ip in ips ],
312
+ "ips" : shared_ips ,
303
313
"linode_id" : linode
304
314
if not isinstance (linode , Instance )
305
315
else linode .id ,
0 commit comments