create_command_string check len(pos_parms) and filter(None, pos_parms)

- Make sure pos_parms has entries before trying to reference last entry.
- Filter blank/None pos_parms entries out when forming command_string.

Change-Id: I4e2315f0ce33a18c00ea1c06c7531e1e04cc004f
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_cmd.py b/lib/gen_cmd.py
index 32f515d..9483bb6 100644
--- a/lib/gen_cmd.py
+++ b/lib/gen_cmd.py
@@ -742,7 +742,7 @@
 
     command_string = command
 
-    if gp.is_dict(pos_parms[-1]):
+    if len(pos_parms) > 0 and gp.is_dict(pos_parms[-1]):
         # Convert pos_parms from tuple to list.
         pos_parms = list(pos_parms)
         # Re-assign options to be the last pos_parm value (which is a
@@ -779,7 +779,8 @@
                 command_string += str(value)
             else:
                 command_string += gm.quote_bash_parm(str(value))
-    # Finally, append the pos_parms to the end of the command_string.
-    command_string = command_string + ' ' + ' '.join(pos_parms)
+    # Finally, append the pos_parms to the end of the command_string.  Use
+    # filter to eliminate blank pos parms.
+    command_string = ' '.join([command_string] + list(filter(None, pos_parms)))
 
     return command_string