Brandon Schneider 621b2d6233 Change iocage API call getjailsettings to align better with iocage syntax.
The new behavior has 4 modes. The user can specify a prop + jail, -r and a prop, all + jail, or just jail.

For prop + jail:

REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "jail" : "test",
   "action" : "getjailsettings",
   "prop" : "vnet"
}

WebSocket Request:
-------------------------------
{
   "name" : "iocage",
   "id" : "fooid",
   "namespace" : "sysadm",
   "args" : {
      "prop" : "vnet",
      "action" : "getjailsettings",
      "jail" : "test"
   }
}

Response:
-------------------------------
{
  "args": {
    "getjailsettings": {
      "test": {
        "vnet": "off"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

-r and a prop:

REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "switches" : "-r",
   "prop" : "vnet",
   "action" : "getjailsettings"
}

WebSocket Request:
-------------------------------
{
   "name" : "iocage",
   "namespace" : "sysadm",
   "args" : {
      "prop" : "vnet",
      "action" : "getjailsettings",
      "switches" : "-r"
   },
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "getjailsettings": {
      "9b8e1033-d065-11e5-8209-d05099728dbf": {
        "TAG": "test",
        "vnet": "off"
      },
      "b67065a9-cfb9-11e5-8209-d05099728dbf": {
        "TAG": "2016-02-09@23:47:04",
        "vnet": "off"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

all + jail (or just jail, they are identical outputs.) :

REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "jail" : "test",
   "action" : "getjailsettings",
   "prop" : "all"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "name" : "iocage",
   "namespace" : "sysadm",
   "args" : {
      "jail" : "test",
      "action" : "getjailsettings",
      "prop" : "all"
   }
}

Response:
-------------------------------
{
  "args": {
    "getjailsettings": {
      "test": {
        "allow_chflags": "0",
        "allow_mount": "0",
        "allow_mount_devfs": "0",
        "allow_mount_nullfs": "0",
        "allow_mount_procfs": "0",
        "allow_mount_tmpfs": "0",
        "allow_mount_zfs": "0",
        "allow_quotas": "0",
        "allow_raw_sockets": "0",
        "allow_set_hostname": "1",
        "allow_socket_af": "0",
        "allow_sysvipc": "0",
        "available": "83.4G",
        "boot": "off",
        "bpf": "off",
        "branch": "-",
        "children_max": "0",
        "compression": "lz4",
        "compressratio": "2.27x",
        "coredumpsize": "off",
        "count": "1",
        "cpuset": "off",
        "cputime": "off",
        "datasize": "off",
        "dedup": "off",
        "defaultrouter": "none",
        "defaultrouter6": "none",
        "devfs_ruleset": "4",
        "dhcp": "off",
        "enforce_statfs": "2",
        "exec_clean": "1",
        "exec_fib": "0",
        "exec_jail_user": "root",
        "exec_poststart": "/usr/bin/true",
        "exec_poststop": "/usr/bin/true",
        "exec_prestart": "/usr/bin/true",
        "exec_prestop": "/usr/bin/true",
        "exec_start": "/bin/sh /etc/rc",
        "exec_stop": "/bin/sh /etc/rc.shutdown",
        "exec_system_jail_user": "0",
        "exec_system_user": "root",
        "exec_timeout": "60",
        "ftpdir": "-",
        "ftpfiles": "-",
        "ftphost": "-",
        "ftplocaldir": "-",
        "gitlocation": "https",
        "hack88": "0",
        "host_domainname": "none",
        "host_hostname": "9b8e1033-d065-11e5-8209-d05099728dbf",
        "host_hostuuid": "9b8e1033-d065-11e5-8209-d05099728dbf",
        "hostid": "a60db2df-3c0e-11e5-8986-d05099728dbf",
        "interfaces": "vnet0",
        "ip4": "new",
        "ip4_addr": "none",
        "ip4_autoend": "none",
        "ip4_autostart": "none",
        "ip4_autosubnet": "none",
        "ip4_saddrsel": "1",
        "ip6": "new",
        "ip6_addr": "none",
        "ip6_saddrsel": "1",
        "istemplate": "no",
        "jail_zfs": "off",
        "jail_zfs_dataset": "iocage/jails/9b7f1420-d065-11e5-8209-d05099728dbf/data",
        "jail_zfs_mountpoint": "none",
        "last_started": "2016-02-10_20",
        "login_flags": "-f root",
        "maxproc": "off",
        "memorylocked": "off",
        "memoryuse": "8G",
        "mount_devfs": "1",
        "mount_fdescfs": "1",
        "mount_linprocfs": "0",
        "mount_procfs": "0",
        "mountpoint": "/iocage/jails/9b8e1033-d065-11e5-8209-d05099728dbf",
        "msgqqueued": "off",
        "msgqsize": "off",
        "nmsgq": "off",
        "notes": "none",
        "nsemop": "off",
        "nshm": "off",
        "nthr": "off",
        "openfiles": "off",
        "origin": "-",
        "owner": "root",
        "pcpu": "off",
        "pkglist": "none",
        "priority": "99",
        "pseudoterminals": "off",
        "quota": "none",
        "release": "10.2-RELEASE",
        "reservation": "none",
        "resolver": "none",
        "rlimits": "off",
        "securelevel": "2",
        "shmsize": "off",
        "stacksize": "off",
        "start": "-",
        "stop_timeout": "30",
        "swapuse": "off",
        "sync_stat": "-",
        "sync_target": "none",
        "sync_tgt_zpool": "none",
        "tag": "test",
        "template": "-",
        "type": "basejail",
        "used": "1.76M",
        "vmemoryuse": "off",
        "vnet": "off",
        "vnet0_mac": "none",
        "vnet1_mac": "none",
        "vnet2_mac": "none",
        "vnet3_mac": "none",
        "wallclock": "off"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-10 21:49:26 -06:00
2016-02-10 09:38:58 -05:00
2015-12-08 14:37:18 -05:00
2016-02-08 14:12:48 -05:00

Table of Contents generated with DocToc

SysAdm

Official repo for PC-BSD's sysadm middleware WebSocket & REST server

This middleware acts as the core for controlling a PC-BSD or FreeBSD
system either locally or remotely via WebSockets or REST.

Required Qt Modules

Qt5 Core (pkg install qt5-core)
Qt5 Concurrent (pkg install qt5-concurrent)
Qt5 Websockets (pkg install qt5-websockets)

Building SysAdm

% git clone https://github.com/pcbsd/sysadm.git
% cd sysadm/src
% /usr/local/lib/qt5/bin/qmake -recursive
% make && sudo make install

Starting SysAdm

(For WebSockets - Required for SysAdm Client)
% sudo sysrc -f /etc/rc.conf sysadm_websocket_enable="YES"
% sudo service sysadm-websocket start

(Optional for REST)
% sudo sysrc -f /etc/rc.conf sysadm_restserver_enable="YES"
% sudo service sysadm-restserver start

API Documentation

https://api.pcbsd.org

Contributing new API calls

Adding new API calls to the middleware is very straight-forward, simply
add a new function which accepts JSON in, and returns JSON, then connect
it to the backend.

Example: 4d3b590f46

Adding new Classes for API calls

Adding a new API class requires tweaking a few more files than a new API call only.

Example: 1ba65b3388

Testing new API calls / classes

Before committing or sending a pull request, you'll need to run our
"api-test.sh" script and confirm it works properly. To do so, first add
your new call and restart the websocket server. Next do the following:

% cd sysadm/tests
% ./api-test.sh

The api-test script will prompt you to enter username, password, and some
information about which class / API call to run. When that is done, and you
have verified the functionality of your new call you should add the output
of the test script (either from copy-n-paste, or from the file /tmp/api-response)
to your commit. (This will allow us to document the new call / class)

Description
No description provided
Readme BSD-2-Clause 5.2 MiB
Languages
C++ 85.6%
Shell 12.7%
C 0.8%
QMake 0.6%
JavaScript 0.2%