Repository: softlayer/softlayer-python

Issue:
'slcli metadata tags' command fails
The 'slcli metadata tags' command fails, the following exception is raised when debug is set:

slcli -vvv metadata tags
=== REQUEST ===
https://api.service.softlayer.com/rest/v3.1/SoftLayer_Resource_Metadata/Tags/None.json
{'Content-Type': 'application/json', 'Accept-Encoding': 'gzip, deflate, compress', 'Accept': '*/*', 'User-Agent': 'softlayer-python/v4.0.0'}
Starting new HTTPS connection (1): api.service.softlayer.com
Setting read timeout to 5
"GET /rest/v3.1/SoftLayer_Resource_Metadata/Tags/None.json HTTP/1.1" 404 70
=== RESPONSE ===
CaseInsensitiveDict({'x-client-ip': '192.168.67.116', 'content-length': '70', 'vary': 'Accept-Encoding', 'server': 'Apache', 'x-backside-transport': 'FAIL FAIL', 'connection': 'close', 'date': 'Tue, 14 Apr 2015 21:15:33 GMT', 'content-type': 'application/json'})
{"error":"Service does not exist","code":"SoftLayer_Exception_Public"}

The following commands failed as well
 slcli metadata backend_ip
  slcli metadata backend_mac
  slcli metadata datacenter
  slcli metadata datacenter_id
  slcli metadata fqdn
  slcli metadata frontend_mac
  slcli metadata id
  slcli metadata ip
  slcli metadata network
  slcli metadata provision_state
  slcli metadata tags
  slcli metadata user_data

The problem is reproduced using API SoftLayer python client version 4, using version 3 of the client to run the 'sl metadata tags' command works with no problems

Discussion:

Patch:
diff --git a/SoftLayer/managers/metadata.py b/SoftLayer/managers/metadata.py
index 405f88da..d6477cc1 100644
--- a/SoftLayer/managers/metadata.py
+++ b/SoftLayer/managers/metadata.py
@@ -82,10 +82,13 @@ def get(self, name, param=None):
                 raise exceptions.SoftLayerError(
                     'Parameter required to get this attribute.')
 
+        params = tuple()
+        if param is not None:
+            params = (param,)
         try:
             return self.client.call('Resource_Metadata',
                                     self.attribs[name]['call'],
-                                    param)
+                                    *params)
         except exceptions.SoftLayerAPIError as ex:
             if ex.faultCode == 404:
                 return None


Test patch:
diff --git a/SoftLayer/tests/managers/metadata_tests.py b/SoftLayer/tests/managers/metadata_tests.py
index 9d471265..1ee2b3bd 100644
--- a/SoftLayer/tests/managers/metadata_tests.py
+++ b/SoftLayer/tests/managers/metadata_tests.py
@@ -28,7 +28,8 @@ def test_no_param(self):
 
         self.assertEqual('dal01', resp)
         self.assert_called_with('SoftLayer_Resource_Metadata', 'Datacenter',
-                                identifier=None)
+                                identifier=None,
+                                args=tuple())
 
     def test_w_param(self):
         resp = self.metadata.get('vlans', '1:2:3:4:5')