Revision b21d488b lib/client/gnt_instance.py

b/lib/client/gnt_instance.py
1216 1216
  """
1217 1217
  result = []
1218 1218

  
1219
  for (idx, params) in mods:
1220
    if idx == constants.DDM_ADD:
1219
  for (identifier, params) in mods:
1220
    if identifier == constants.DDM_ADD:
1221 1221
      # Add item as last item (legacy interface)
1222 1222
      action = constants.DDM_ADD
1223
      idxno = -1
1224
    elif idx == constants.DDM_REMOVE:
1223
      identifier = -1
1224
    elif identifier == constants.DDM_REMOVE:
1225 1225
      # Remove last item (legacy interface)
1226 1226
      action = constants.DDM_REMOVE
1227
      idxno = -1
1227
      identifier = -1
1228 1228
    else:
1229 1229
      # Modifications and adding/removing at arbitrary indices
1230
      try:
1231
        idxno = int(idx)
1232
      except (TypeError, ValueError):
1233
        raise errors.OpPrereqError("Non-numeric index '%s'" % idx,
1234
                                   errors.ECODE_INVAL)
1235

  
1236 1230
      add = params.pop(constants.DDM_ADD, _MISSING)
1237 1231
      remove = params.pop(constants.DDM_REMOVE, _MISSING)
1238 1232
      modify = params.pop(constants.DDM_MODIFY, _MISSING)
......
1260 1254
      raise errors.OpPrereqError("Not accepting parameters on removal",
1261 1255
                                 errors.ECODE_INVAL)
1262 1256

  
1263
    result.append((action, idxno, params))
1257
    result.append((action, identifier, params))
1264 1258

  
1265 1259
  return result
1266 1260

  

Also available in: Unified diff