Revision a5728081 lib/cli.py

b/lib/cli.py
50 50
           "ListTags", "AddTags", "RemoveTags", "TAG_SRC_OPT",
51 51
           "FormatError", "SplitNodeOption", "SubmitOrSend",
52 52
           "JobSubmittedException", "FormatTimestamp", "ParseTimespec",
53
           "ValidateBeParams", "ToStderr", "ToStdout", "UsesRPC",
53
           "ToStderr", "ToStdout", "UsesRPC",
54 54
           "GetOnlineNodes", "JobExecutor", "SYNC_OPT",
55 55
           ]
56 56

  
......
409 409
    return (value, None)
410 410

  
411 411

  
412
def ValidateBeParams(bep):
413
  """Parse and check the given beparams.
414

  
415
  The function will update in-place the given dictionary.
416

  
417
  @type bep: dict
418
  @param bep: input beparams
419
  @raise errors.ParameterError: if the input values are not OK
420
  @raise errors.UnitParseError: if the input values are not OK
421

  
422
  """
423
  if constants.BE_MEMORY in bep:
424
    bep[constants.BE_MEMORY] = utils.ParseUnit(bep[constants.BE_MEMORY])
425

  
426
  if constants.BE_VCPUS in bep:
427
    try:
428
      bep[constants.BE_VCPUS] = int(bep[constants.BE_VCPUS])
429
    except ValueError:
430
      raise errors.ParameterError("Invalid number of VCPUs")
431

  
432

  
433 412
def UsesRPC(fn):
434 413
  def wrapper(*args, **kwargs):
435 414
    rpc.Init()
......
695 674
  elif isinstance(err, errors.JobQueueFull):
696 675
    obuf.write("Failure: the job queue is full and doesn't accept new"
697 676
               " job submissions until old jobs are archived\n")
677
  elif isinstance(err, errors.TypeEnforcementError):
678
    obuf.write("Parameter Error: %s" % msg)
698 679
  elif isinstance(err, errors.GenericError):
699 680
    obuf.write("Unhandled Ganeti error: %s" % msg)
700 681
  elif isinstance(err, luxi.NoMasterError):

Also available in: Unified diff