Arubacloud / pyArubaCloud

Python Interface for ArubaCloud IaaS Service
Apache License 2.0
33 stars 26 forks source link

remove_ip broken #59

Open richyjay opened 5 years ago

richyjay commented 5 years ago

Error when calling CloudInterface.remove_ip(ip_id=resourceid)

Traceback (most recent call last):
  File "./getIps.py", line 45, in <module>
    ci.remove_ip(ip_id=467227)
  File "build/bdist.linux-x86_64/egg/ArubaCloud/PyArubaAPI.py", line 304, in remove_ip
  File "build/bdist.linux-x86_64/egg/ArubaCloud/base/__init__.py", line 29, in gen_def_json_scheme
ValueError: dictionary update sequence element #0 has length 1; 2 is required

Fix: Change line 303 of ArubaCloud/PyArubaAPI.py from: ip_id = ' "IpAddressResourceId": %s' % ip_id To: ip_id = {'IpAddressResourceId': ip_id}

Full method:

def remove_ip(self, ip_id):
        """
        Delete an Ip from the boughs ip list
        @param (str) ip_id: a string representing the resource id of the IP
        @return: True if json method had success else False
        """
        #ip_id = '    "IpAddressResourceId": %s' % ip_id
        ip_id = {'IpAddressResourceId': ip_id}
        json_scheme = self.gen_def_json_scheme('SetRemoveIpAddress', ip_id)
        json_obj = self.call_method_post(method='SetRemoveIpAddress', json_scheme=json_scheme)
        pprint(json_obj)