Repository: softlayer/softlayer-python

Issue:
got an unexpected keyword argument 'tags'
Hi there

I came across an error when creating VS and providing tags either in the form of -g or --tag

C:\Python34\Scripts>slcli vs create --test --hostname OS --domain vm.local --cpu 1 --memory 1024 --os WIN_LATEST_64 --datacenter lon02 --tag 1234
An unexpected error has occured:
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\SoftLayer\CLI\core.py", line 181, in main
    cli.main()
  File "C:\Python34\lib\site-packages\click\core.py", line 644, in main
    rv = self.invoke(ctx)
  File "C:\Python34\lib\site-packages\click\core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Python34\lib\site-packages\click\core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Python34\lib\site-packages\click\core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python34\lib\site-packages\click\core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "C:\Python34\lib\site-packages\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "C:\Python34\lib\site-packages\click\core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "C:\Python34\lib\site-packages\SoftLayer\CLI\virt\create.py", line 92, in cli
    result = vsi.verify_create_instance(**data)
  File "C:\Python34\lib\site-packages\SoftLayer\managers\vs.py", line 426, in verify_create_instance
    create_options = self._generate_create_dict(**kwargs)
TypeError: _generate_create_dict() got an unexpected keyword argument 'tags'

Discussion:

Patch:
diff --git a/SoftLayer/CLI/server/detail.py b/SoftLayer/CLI/server/detail.py
index 1b9d588e..9fc76c5d 100644
--- a/SoftLayer/CLI/server/detail.py
+++ b/SoftLayer/CLI/server/detail.py
@@ -62,14 +62,11 @@ def cli(env, identifier, passwords, price):
     table.add_row(
         ['created', result['provisionDate'] or formatting.blank()])
 
-    if utils.lookup(result, 'billingItem') != []:
-        table.add_row(['owner', formatting.FormattedItem(
-            utils.lookup(result, 'billingItem', 'orderItem',
-                         'order', 'userRecord',
-                         'username') or formatting.blank(),
-        )])
-    else:
-        table.add_row(['owner', formatting.blank()])
+    table.add_row(['owner', formatting.FormattedItem(
+        utils.lookup(result, 'billingItem', 'orderItem',
+                     'order', 'userRecord',
+                     'username') or formatting.blank()
+    )])
 
     vlan_table = formatting.Table(['type', 'number', 'id'])
 
diff --git a/SoftLayer/CLI/virt/detail.py b/SoftLayer/CLI/virt/detail.py
index b003e413..4fc115ce 100644
--- a/SoftLayer/CLI/virt/detail.py
+++ b/SoftLayer/CLI/virt/detail.py
@@ -67,14 +67,11 @@ def cli(self, identifier, passwords=False, price=False):
     table.add_row(['private_cpu', result['dedicatedAccountHostOnlyFlag']])
     table.add_row(['created', result['createDate']])
     table.add_row(['modified', result['modifyDate']])
-    if utils.lookup(result, 'billingItem') != []:
-        table.add_row(['owner', formatting.FormattedItem(
-            utils.lookup(result, 'billingItem', 'orderItem',
-                         'order', 'userRecord',
-                         'username') or formatting.blank(),
-        )])
-    else:
-        table.add_row(['owner', formatting.blank()])
+    table.add_row(['owner', formatting.FormattedItem(
+        utils.lookup(result, 'billingItem', 'orderItem',
+                     'order', 'userRecord',
+                     'username') or formatting.blank(),
+    )])
 
     vlan_table = formatting.Table(['type', 'number', 'id'])
     for vlan in result['networkVlans']:
diff --git a/SoftLayer/managers/vs.py b/SoftLayer/managers/vs.py
index 30de90b3..40ea9925 100644
--- a/SoftLayer/managers/vs.py
+++ b/SoftLayer/managers/vs.py
@@ -423,6 +423,7 @@ def verify_create_instance(self, **kwargs):
         Without actually placing an order.
         See :func:`create_instance` for a list of available options.
         """
+        kwargs.pop('tags', None)
         create_options = self._generate_create_dict(**kwargs)
         return self.guest.generateOrderTemplate(create_options)
 


Test patch:
diff --git a/SoftLayer/tests/managers/vs_tests.py b/SoftLayer/tests/managers/vs_tests.py
index 3a179b46..9bdb3459 100644
--- a/SoftLayer/tests/managers/vs_tests.py
+++ b/SoftLayer/tests/managers/vs_tests.py
@@ -141,7 +141,7 @@ def test_reload_instance(self):
     def test_create_verify(self, create_dict):
         create_dict.return_value = {'test': 1, 'verify': 1}
 
-        self.vs.verify_create_instance(test=1, verify=1)
+        self.vs.verify_create_instance(test=1, verify=1, tags=['test', 'tags'])
 
         create_dict.assert_called_once_with(test=1, verify=1)
         self.assert_called_with('SoftLayer_Virtual_Guest',