def delete_nfs_share(request):

  return_dict = {}
  try:
    if request.method == "GET":
      #Return the conf page
      path = request.GET["path"]
      return_dict["path"] = path
      return django.shortcuts.render_to_response("delete_nfs_share_conf.html", return_dict, context_instance = django.template.context.RequestContext(request))
    else:
      path = request.POST["path"]
      #logger.debug("Delete share request for name %s"%name)
      try :
        result, err = nfs.delete_share(path)
        if not result:
          if not err:
            raise Exception('Unknown error!')
          else:
            raise Exception(err)
      except Exception, e:
        return_dict["error"] = "Error deleting NFS share - %s"%str(e)
        return django.shortcuts.render_to_response('logged_in_error.html', return_dict, context_instance=django.template.context.RequestContext(request))
 
      audit_str = "Deleted NFS share %s"%path
      audit.audit("delete_nfs_share", audit_str, request.META["REMOTE_ADDR"])
      return django.http.HttpResponseRedirect('/view_nfs_shares?action=deleted')
  except Exception, e:
    s = str(e)
    return_dict["error"] = "An error occurred when processing your request : %s"%s
    return django.shortcuts.render_to_response("logged_in_error.html", return_dict, context_instance=django.template.context.RequestContext(request))
def delete_nfs_share(request):

  return_dict = {}
  try:
    if request.method == "GET":
      #Return the conf page
      path = request.GET["path"]
      return_dict["path"] = path
      return django.shortcuts.render_to_response("delete_nfs_share_conf.html", return_dict, context_instance = django.template.context.RequestContext(request))
    else:
      path = request.POST["path"]
      #logger.debug("Delete share request for name %s"%name)
      result, err = nfs.delete_share(path)
      if err:
        raise Exception(err)
 
      audit_str = "Deleted NFS share %s"%path
      audit.audit("delete_nfs_share", audit_str, request.META["REMOTE_ADDR"])
      return django.http.HttpResponseRedirect('/view_nfs_shares?action=deleted')
  except Exception, e:
    return_dict['base_template'] = "networking_base.html"
    return_dict["page_title"] = 'Remove NFS share '
    return_dict['tab'] = 'view_nfs_shares_tab'
    return_dict["error"] = 'Error removing NFS share'
    return_dict["error_details"] = str(e)
    return django.shortcuts.render_to_response("logged_in_error.html", return_dict, context_instance=django.template.context.RequestContext(request))
Beispiel #3
0
def delete_nfs_share(request):

    return_dict = {}
    try:
        if request.method == "GET":
            #Return the conf page
            path = request.GET["path"]
            return_dict["path"] = path
            return django.shortcuts.render_to_response(
                "delete_nfs_share_conf.html",
                return_dict,
                context_instance=django.template.context.RequestContext(
                    request))
        else:
            path = request.POST["path"]
            #logger.debug("Delete share request for name %s"%name)
            result, err = nfs.delete_share(path)
            if err:
                raise Exception(err)

            audit_str = "Deleted NFS share %s" % path
            audit.audit("delete_nfs_share", audit_str, request.META)
            return django.http.HttpResponseRedirect(
                '/view_nfs_shares?ack=deleted')
    except Exception, e:
        return_dict['base_template'] = "networking_base.html"
        return_dict["page_title"] = 'Remove NFS share '
        return_dict['tab'] = 'view_nfs_shares_tab'
        return_dict["error"] = 'Error removing NFS share'
        return_dict["error_details"] = str(e)
        return django.shortcuts.render_to_response(
            "logged_in_error.html",
            return_dict,
            context_instance=django.template.context.RequestContext(request))