Patch title: Release 85 bulk changes
Abstract:
File: /pliant/fullpliant/logical.page
Key:
    Removed line
    Added line
   
module "/pliant/language/unsafe.pli"
module "/pliant/language/context.pli"
module "/pliant/language/stream.pli"
module "this_computer.pli"
module "/pliant/protocol/dns/name.pli"
module "/pliant/protocol/http/site.pli"
module "/pliant/fullpliant/user.pli"
module "/pliant/admin/file.pli"
module "/pliant/linux/kernel/device.pli"
module "/pliant/util/crypto/rsa.pli"
module "/pliant/util/remote/common.pli"
module "/pliant/appli/database/light.pli"
module "logical.pli"


table columns 5
  cell header [Name]
  cell header [Memory]
  cell header [Status]
  cell header [Action]
  cell void
  var Intn total_used := 0 ; var Intn total_assigned := 0
  each logical this_computer:env:"logical"
    var Str name := keyof logical
    var CBool running := lc_is_running keyof:logical
    cell
      text name
    cell
      var Intn used := lc_memory name
      if used<>undefined
        text (string used\2^20)
        total_used += used
      text " / "
      if (this_computer:env:"logical":name:"memory" parse (v
        assigned *= 2^20
      else
        assigned := undefined
module "/pliant/language/unsafe.pli"
module "/pliant/language/context.pli"
module "/pliant/language/stream.pli"
module "this_computer.pli"
module "/pliant/protocol/dns/name.pli"
module "/pliant/protocol/http/site.pli"
module "/pliant/fullpliant/user.pli"
module "/pliant/admin/file.pli"
module "/pliant/linux/kernel/device.pli"
module "/pliant/util/crypto/rsa.pli"
module "/pliant/util/remote/common.pli"
module "/pliant/appli/database/light.pli"
module "logical.pli"


table columns 5
  cell header [Name]
  cell header [Memory]
  cell header [Status]
  cell header [Action]
  cell void
  var Intn total_used := 0 ; var Intn total_assigned := 0
  each logical this_computer:env:"logical"
    var Str name := keyof logical
    var CBool running := lc_is_running keyof:logical
    cell
      text name
    cell
      var Intn used := lc_memory name
      if used<>undefined
        text (string used\2^20)
        total_used += used
      text " / "
      if (this_computer:env:"logical":name:"memory" parse (v
        assigned *= 2^20
      else
        assigned := undefined
      if (this_computer:env:"logical":name:"memory_overflow" parse (var Intn overflow))
        overflow *= 2^20
      else
        overflow := undefined
      if assigned<>undefined
        text (string assigned\2^20)
        total_assigned += assigned
      if assigned<>undefined
        text (string assigned\2^20)
        total_assigned += assigned
      if overflow<>undefined
        text " < "+(string overflow\2^20)
    cell
      text (shunt running "running" "stopped")
    cell
      if not running and logical:"automatic"<>"true"
        page button "Start"
          lc_start keyof:logical
          sleep 1
          reload_page
      if running
        button "Stop"
          lc_stop keyof:logical
          sleep 1
          reload_page
    cell
      page button "edit"
        title "'"+name+"' logical computer"
        each va this_computer:env:"logical":name
          if va=""
            this_computer:env:"logical":name delete keyof:va
        text "Raw settings for '"+name+"':"
        table columns 2
          cell header [Variable]
          cell header [Value]
          each va this_computer:env:"logical":name
            cell (text keyof:va)
            cell text:va
        name_database:data:host create name
          
        header "Configuration"
    cell
      text (shunt running "running" "stopped")
    cell
      if not running and logical:"automatic"<>"true"
        page button "Start"
          lc_start keyof:logical
          sleep 1
          reload_page
      if running
        button "Stop"
          lc_stop keyof:logical
          sleep 1
          reload_page
    cell
      page button "edit"
        title "'"+name+"' logical computer"
        each va this_computer:env:"logical":name
          if va=""
            this_computer:env:"logical":name delete keyof:va
        text "Raw settings for '"+name+"':"
        table columns 2
          cell header [Variable]
          cell header [Value]
          each va this_computer:env:"logical":name
            cell (text keyof:va)
            cell text:va
        name_database:data:host create name
          
        header "Configuration"
          table columns 3
            cell void ; cell header [Current setting] ; cell
          table columns 2
            var Str auto := this_computer:env:"logical":name
            cell [Start automatically]
            var Str auto := this_computer:env:"logical":name
            cell [Start automatically]
            cell text:auto
            cell
              select "" auto
                option "" ""
                option "yes" "true"
                option "no" "false"
            cell
              select "" auto
                option "" ""
                option "yes" "true"
                option "no" "false"
            var Str root := lc_root name
            cell [Root path]
            cell [Root path]
            cell (text lc_root:name)
            cell (input "" (var Str root))
            var Str cooped := this_computer:env:"logical":na
            cell (text "Cooped up in "+lc_root:name)
            cell (input "" (var Str root))
            var Str cooped := this_computer:env:"logical":na
            cell (text "Cooped up in "+lc_root:name)
            cell text:cooped
            cell
              select "" cooped
                option "" ""
                option "yes" "true"
                option "no" "false"
            cell
              select "" cooped
                option "" ""
                option "yes" "true"
                option "no" "false"
            var Str user := string lc_user:name
            cell [User ID]
            cell [User ID]
            cell text:(string lc_user:name)
            cell (input "" (var Str user) length 6)
            cell (input "" (var Str user) length 6)
            var Str group := string lc_group:name
            cell [Group ID]
            cell [Group ID]
            cell text:(string lc_group:name)
            cell (input "" (var Str group) length 6)
            var Str mem := this_computer:env:"logical":name:
            cell [Assigned memory]
            cell (input "" (var Str group) length 6)
            var Str mem := this_computer:env:"logical":name:
            cell [Assigned memory]
            cell (text mem+" MB")
            cell
              input "" mem length 5 noeol ; [ MB]
            cell
              input "" mem length 5 noeol ; [ MB]
            var Str mem2 := this_computer:env:"logical":name:"memory_overflow"
            cell [Maximum memory]
            cell
              input "" mem2 length 5 noeol ; [ MB]
            cell [HTTP TCP port]
            cell [HTTP TCP port]
            cell text:(string lc_http_port:name)
            cell (input "" name_database:data:host:name:http
            var Str remote := this_computer:env:"logical":na
            cell [Run remote execution service]
            cell (input "" name_database:data:host:name:http
            var Str remote := this_computer:env:"logical":na
            cell [Run remote execution service]
            cell text:remote
            cell
              select "" remote
                option "" ""
                option "yes" "true"
                option "no" "false"
            cell [Remote execution TCP port]
            cell
              select "" remote
                option "" ""
                option "yes" "true"
                option "no" "false"
            cell [Remote execution TCP port]
            cell text:(string lc_remote_port:name)
            cell (input "" name_database:data:host:name:remo
            var Str cluster := this_computer:env:"logical":n
            cell [Run clustering service]
            cell (input "" name_database:data:host:name:remo
            var Str cluster := this_computer:env:"logical":n
            cell [Run clustering service]
            cell text:cluster
            cell
              select "" cluster
                option "" ""
                option "yes" "true"
                option "no" "false"
          button "update"
            this_computer "logical" name "automatic" := auto
            this_computer "logical" name "root" := root
            this_computer "logical" name "cooped" := cooped
            this_computer "logical" name "user" := user
            this_computer "logical" name "group" := group
            this_computer "logical" name "memory" := mem
            cell
              select "" cluster
                option "" ""
                option "yes" "true"
                option "no" "false"
          button "update"
            this_computer "logical" name "automatic" := auto
            this_computer "logical" name "root" := root
            this_computer "logical" name "cooped" := cooped
            this_computer "logical" name "user" := user
            this_computer "logical" name "group" := group
            this_computer "logical" name "memory" := mem
            this_computer "logical" name "memory_overflow" := mem2
            this_computer "logical" name "remote" := remote
            this_computer "logical" name "cluster" := cluste
            reload_page    


        header "Files"
          if (file_query lc_root:name standard)=undefined
            [The files tree does not exist yet.] ; eol
          table columns 2 border 0
            for (var Int lap) 0 3
              cell
                page button (shunt lap=0 "Install files tree
                  var Str path := lc_root name
                  part create_directories
                    file_tree_create path+"pliant_security/"
                    file_tree_create path+"pliant_data/"
                    file_tree_create path+"tmp/"
                  if lap=0 or lap=2
                    part copy_pliant
                      file_tree_copy "/pliant/" path+"pliant
                      file_copy "/index.page" path+"pliant/i
                      var Array:FileInfo files := file_list 
                      for (var Int i) 0 files:size-1
                        if files:i:extension<>".dump"
                          file_copy "/binary/"+files:i:name 
                  if lap=0 or lap=1
                    part copy_bin
                      file_tree_create path+"bin/"
                      file_link "file:/pliant/binary/pliant-
                      file_link "file:/pliant/binary/pliant-
                      file_copy "file:/bin/tar" path+"bin/ta
                      # tar extra executables
                      file_copy "file:/bin/gzip" path+"bin/g
            this_computer "logical" name "remote" := remote
            this_computer "logical" name "cluster" := cluste
            reload_page    


        header "Files"
          if (file_query lc_root:name standard)=undefined
            [The files tree does not exist yet.] ; eol
          table columns 2 border 0
            for (var Int lap) 0 3
              cell
                page button (shunt lap=0 "Install files tree
                  var Str path := lc_root name
                  part create_directories
                    file_tree_create path+"pliant_security/"
                    file_tree_create path+"pliant_data/"
                    file_tree_create path+"tmp/"
                  if lap=0 or lap=2
                    part copy_pliant
                      file_tree_copy "/pliant/" path+"pliant
                      file_copy "/index.page" path+"pliant/i
                      var Array:FileInfo files := file_list 
                      for (var Int i) 0 files:size-1
                        if files:i:extension<>".dump"
                          file_copy "/binary/"+files:i:name 
                  if lap=0 or lap=1
                    part copy_bin
                      file_tree_create path+"bin/"
                      file_link "file:/pliant/binary/pliant-
                      file_link "file:/pliant/binary/pliant-
                      file_copy "file:/bin/tar" path+"bin/ta
                      # tar extra executables
                      file_copy "file:/bin/gzip" path+"bin/g
                      if lc_user:name=0
                        file_copy "file:/bin/insmod" path+"bin/insmod"
                        file_copy "file:/bin/rmmod" path+"bin/rmmod"
                    part copy_lib
                      file_tree_create path+"lib/"
                      file_copy "file:/lib/libc.so.6" path+"
                      file_copy "file:/lib/libdl.so.2" path+
                      file_copy "file:/lib/ld-linux.so.2" pa
                      file_copy "file:/lib/libm.so.6" path+"
                      file_copy "file:/usr/lib/libz.so.1" pa
                      file_copy "file:/lib/libz.so.1" path+"
                      file_copy "file:/usr/lib/libjpeg.so" p
                      file_copy "file:/lib/libjpeg.so" path+
                      # tar extra DLLs
                      file_copy "file:/lib/libpthread.so.0" 
                      file_copy "file:/lib/librt.so.1" path+
                    part create_dev
                      file_tree_create path+"dev/"
                      kernel_make_device path+"dev/null"
                      kernel_make_device path+"dev/random"
                  if lap=0 or lap=3
                    part this_computer_database
                      if not (name parse any:(var Str v_name
                        v_name := name ; v_domain := ""
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                    part copy_lib
                      file_tree_create path+"lib/"
                      file_copy "file:/lib/libc.so.6" path+"
                      file_copy "file:/lib/libdl.so.2" path+
                      file_copy "file:/lib/ld-linux.so.2" pa
                      file_copy "file:/lib/libm.so.6" path+"
                      file_copy "file:/usr/lib/libz.so.1" pa
                      file_copy "file:/lib/libz.so.1" path+"
                      file_copy "file:/usr/lib/libjpeg.so" p
                      file_copy "file:/lib/libjpeg.so" path+
                      # tar extra DLLs
                      file_copy "file:/lib/libpthread.so.0" 
                      file_copy "file:/lib/librt.so.1" path+
                    part create_dev
                      file_tree_create path+"dev/"
                      kernel_make_device path+"dev/null"
                      kernel_make_device path+"dev/random"
                  if lap=0 or lap=3
                    part this_computer_database
                      if not (name parse any:(var Str v_name
                        v_name := name ; v_domain := ""
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_
                      data_write path+"pliant_security/this_computer.pdb" "/env/pliant/memory/overflow" this_computer:env:"logical":name:"memory_overflow"
                  if lap=0
                    part users_database
                      var (Link Database:UserDatabase) logic
                      logical_users load path+"pliant_securi
                      each u user_database:data:user
                        var CBool admin := false
                        each r u:right
                          if r:right="administrator"
                            admin := true
                        if admin or keyof:u="anonymous"
                          logical_users:data:user create key
                          data_copy u (logical_users:data:us
                      logical_users store
                    part site_database
                  if lap=0
                    part users_database
                      var (Link Database:UserDatabase) logic
                      logical_users load path+"pliant_securi
                      each u user_database:data:user
                        var CBool admin := false
                        each r u:right
                          if r:right="administrator"
                            admin := true
                        if admin or keyof:u="anonymous"
                          logical_users:data:user create key
                          data_copy u (logical_users:data:us
                      logical_users store
                    part site_database
                      name_database store
                      file_copy "security:/name.pdb" path+"p
                      var (Link Database:NameSecretDatabase)
                      nsdb load path+"pliant_security/name_s
                      nsdb:data:host create name
                      data_copy name_secret_database:data:ho
                      nsdb store
                      var (Link Database:SiteDatabase) sdb :
                      sdb load path+"pliant_security/site.pd
                      var (Link Database:SiteSecretDatabase)
                      ssdb load path+"pliant_security/site_s
                      each a_site site
                        if a_site:computer=name
                          sdb:data:site create keyof:a_site
                          data_copy site_database:data:site:
                          ssdb:data:site create keyof:a_site
                          data_copy site_secret_database:dat
                      sdb store
                      ssdb store
                  if lap=0
                    part set_rights
                      file_tree_rights path lc_user:name lc_
                      file_rights "file:/tmp/" undefined und
                  reload_page
              cell
                if lap=0
                  [Copy all files from the physical to the l
                eif lap=1
                  [Copy only /bin /lib and others OS related
                eif lap=2
                  [Copy only Pliant tree.]
                eif lap=3
                  [Overwrite only this_computer.pdb]
            cell
              button "Adjust files owner" noeol
                file_tree_rights lc_root:name lc_user:name l
                reload_page
            cell
              [Logical computers usually run as normal user,
            cell
              button "Delete .dump files" noeol
                var Str path := lc_root name
                var Array:FileInfo files := file_list path+"
                for (var Int i) 0 files:size-1
                  if files:i:extension=".dump"
                    file_delete files:i:name
                reload_page
            cell
              [Drop .dump file so that Pliant will recompile
            cell
              button "Delete all files"
                var Str path := lc_root name
                [You are going to remove all files in ]
                fixed
                  text path
                eol
                [Are you sure that you really want to do tha
                button "yes" noeol
                  file_tree_delete path
                  file_delete "file:/logical/"
                  goto_backward
                button "no"
                  goto_backward
            cell
              [Delete absoluely all logical computer files.]
  cell (italic text:computer_fullname)
  cell
    text (string memory_current_consumed\2^20)+" / "+(string
    total_used += memory_current_consumed
    total_assigned += memory_assigned
  cell void
  cell void
  cell void
  cell italic:[total]
  cell
    text (string total_used\2^20)+" / "+(string total_assign
  cell void
  cell void
  cell void
input "Logical computer name: " (var Str lid) noeol
page button "Create" noeol
  var Int p := 90
  part check_port
    each h name_database:data:host
      if h:physical=computer_fullname and h:http_port=p
        p += 10
        restart check_port
  name_database:data:host create lid
  name_database:data:host:lid physical := computer_fullname
  name_database:data:host:lid http_port := p
  name_database:data:host:lid remote_port := remote_tcp_port
  this_computer "logical" lid "automatic" := "false"
  this_computer "logical" lid "cooped" := "true"
  this_computer "logical" lid "remote" := "true"
  this_computer "logical" lid "memory" := string memory_assi
  reload_page
button "Delete"
  this_computer:env:"logical" delete lid
  name_database:data:host delete lid
  reload_page
                      file_copy "security:/name.pdb" path+"p
                      var (Link Database:NameSecretDatabase)
                      nsdb load path+"pliant_security/name_s
                      nsdb:data:host create name
                      data_copy name_secret_database:data:ho
                      nsdb store
                      var (Link Database:SiteDatabase) sdb :
                      sdb load path+"pliant_security/site.pd
                      var (Link Database:SiteSecretDatabase)
                      ssdb load path+"pliant_security/site_s
                      each a_site site
                        if a_site:computer=name
                          sdb:data:site create keyof:a_site
                          data_copy site_database:data:site:
                          ssdb:data:site create keyof:a_site
                          data_copy site_secret_database:dat
                      sdb store
                      ssdb store
                  if lap=0
                    part set_rights
                      file_tree_rights path lc_user:name lc_
                      file_rights "file:/tmp/" undefined und
                  reload_page
              cell
                if lap=0
                  [Copy all files from the physical to the l
                eif lap=1
                  [Copy only /bin /lib and others OS related
                eif lap=2
                  [Copy only Pliant tree.]
                eif lap=3
                  [Overwrite only this_computer.pdb]
            cell
              button "Adjust files owner" noeol
                file_tree_rights lc_root:name lc_user:name l
                reload_page
            cell
              [Logical computers usually run as normal user,
            cell
              button "Delete .dump files" noeol
                var Str path := lc_root name
                var Array:FileInfo files := file_list path+"
                for (var Int i) 0 files:size-1
                  if files:i:extension=".dump"
                    file_delete files:i:name
                reload_page
            cell
              [Drop .dump file so that Pliant will recompile
            cell
              button "Delete all files"
                var Str path := lc_root name
                [You are going to remove all files in ]
                fixed
                  text path
                eol
                [Are you sure that you really want to do tha
                button "yes" noeol
                  file_tree_delete path
                  file_delete "file:/logical/"
                  goto_backward
                button "no"
                  goto_backward
            cell
              [Delete absoluely all logical computer files.]
  cell (italic text:computer_fullname)
  cell
    text (string memory_current_consumed\2^20)+" / "+(string
    total_used += memory_current_consumed
    total_assigned += memory_assigned
  cell void
  cell void
  cell void
  cell italic:[total]
  cell
    text (string total_used\2^20)+" / "+(string total_assign
  cell void
  cell void
  cell void
input "Logical computer name: " (var Str lid) noeol
page button "Create" noeol
  var Int p := 90
  part check_port
    each h name_database:data:host
      if h:physical=computer_fullname and h:http_port=p
        p += 10
        restart check_port
  name_database:data:host create lid
  name_database:data:host:lid physical := computer_fullname
  name_database:data:host:lid http_port := p
  name_database:data:host:lid remote_port := remote_tcp_port
  this_computer "logical" lid "automatic" := "false"
  this_computer "logical" lid "cooped" := "true"
  this_computer "logical" lid "remote" := "true"
  this_computer "logical" lid "memory" := string memory_assi
  reload_page
button "Delete"
  this_computer:env:"logical" delete lid
  name_database:data:host delete lid
  reload_page