Revision 7fa310f6 lib/rapi/rlib2.py

b/lib/rapi/rlib2.py
869 869
    return baserlib.SubmitJob([op])
870 870

  
871 871

  
872
def _ParseShutdownInstanceRequest(name, data, dry_run):
873
  """Parses a request for an instance shutdown.
874

  
875
  @rtype: L{opcodes.OpInstanceShutdown}
876
  @return: Instance shutdown opcode
877

  
878
  """
879
  return baserlib.FillOpcode(opcodes.OpInstanceShutdown, data, {
880
    "instance_name": name,
881
    "dry_run": dry_run,
882
    })
883

  
884

  
872 885
class R_2_instances_name_shutdown(baserlib.R_Generic):
873 886
  """/2/instances/[instance_name]/shutdown resource.
874 887

  
......
878 891
  def PUT(self):
879 892
    """Shutdown an instance.
880 893

  
894
    @return: a job id
895

  
881 896
    """
882
    instance_name = self.items[0]
883
    op = opcodes.OpInstanceShutdown(instance_name=instance_name,
884
                                    dry_run=bool(self.dryRun()))
897
    baserlib.CheckType(self.request_body, dict, "Body contents")
898

  
899
    op = _ParseShutdownInstanceRequest(self.items[0], self.request_body,
900
                                       bool(self.dryRun()))
885 901

  
886 902
    return baserlib.SubmitJob([op])
887 903

  

Also available in: Unified diff