Revision f0d22861 lib/client/gnt_instance.py

b/lib/client/gnt_instance.py
1306 1306

  
1307 1307
      add = params.pop(constants.DDM_ADD, _MISSING)
1308 1308
      remove = params.pop(constants.DDM_REMOVE, _MISSING)
1309
      modify = params.pop(constants.DDM_MODIFY, _MISSING)
1310

  
1311
      if modify is _MISSING:
1312
        if not (add is _MISSING or remove is _MISSING):
1313
          raise errors.OpPrereqError("Cannot add and remove at the same time",
1314
                                     errors.ECODE_INVAL)
1315
        elif add is not _MISSING:
1316
          action = constants.DDM_ADD
1317
        elif remove is not _MISSING:
1318
          action = constants.DDM_REMOVE
1319
        else:
1320
          action = constants.DDM_MODIFY
1309 1321

  
1310
      if not (add is _MISSING or remove is _MISSING):
1311
        raise errors.OpPrereqError("Cannot add and remove at the same time",
1312
                                   errors.ECODE_INVAL)
1313
      elif add is not _MISSING:
1314
        action = constants.DDM_ADD
1315
      elif remove is not _MISSING:
1316
        action = constants.DDM_REMOVE
1317 1322
      else:
1318
        action = constants.DDM_MODIFY
1323
        if add is _MISSING and remove is _MISSING:
1324
          action = constants.DDM_MODIFY
1325
        else:
1326
          raise errors.OpPrereqError("Cannot modify and add/remove at the"
1327
                                     " same time", errors.ECODE_INVAL)
1319 1328

  
1320 1329
      assert not (constants.DDMS_VALUES_WITH_MODIFY & set(params.keys()))
1321 1330

  

Also available in: Unified diff