948 Commits

Author SHA1 Message Date
Kris Moore
ccd73e7270 Update the various lpreserver API backends, to use new CLI
syntax, and uppdate README with further information about testing
2016-02-08 13:12:06 -05:00
Kris Moore
0300aab643 Update API test script to use 'sudo' if running as user and
needing to pkg install utils
2016-02-08 12:30:27 -05:00
Kris Moore
172962421c Fix required modules section 2016-02-08 11:37:49 -05:00
Kris Moore
1110170081 Update the SysAdm README with much more useful information 2016-02-08 11:35:12 -05:00
dlavigne
48a9463262 Add beadm class. 2016-02-05 13:23:29 -05:00
dlavigne
8f3b7ec2e0 Doc cleanall action. 2016-02-05 13:02:40 -05:00
dlavigne
6b3a2750f8 Doc cleanreleases action. 2016-02-05 12:29:56 -05:00
dlavigne
9c5df4348c Doc cleanreleases action. 2016-02-05 12:11:38 -05:00
dlavigne
8760097189 Doc cleanjails action. 2016-02-05 11:56:34 -05:00
dlavigne
91358a6b35 Doc capjail action. 2016-02-05 11:46:36 -05:00
dlavigne
8f431e81c6 Doc rmiso command. 2016-02-05 11:06:53 -05:00
Kris Moore
23d5136e22 Merge branch 'master' of https://github.com/pcbsd/sysadm 2016-02-05 11:04:09 -05:00
Kris Moore
1ba65b3388 Add new API class and call for 'beadm', with the initial listbes
API call

REST Request:
-------------------------------
PUT /sysadm/beadm
{
   "action" : "listbes"
}

WebSocket Request:
-------------------------------
{
   "name" : "beadm",
   "namespace" : "sysadm",
   "id" : "fooid",
   "args" : {
      "action" : "listbes"
   }
}

Response:
-------------------------------
{
  "args": {
    "listbes": {
      "11.0-CURRENTJAN2016-up-20160128_150853": {
        "active": "NR",
        "date": "2016-01-28",
        "mount": "/",
        "nick": "14:57",
        "space": "10.2G"
      },
      "initial": {
        "active": "-",
        "date": "2016-01-28",
        "mount": "-",
        "nick": "07:00",
        "space": "1.2G"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-05 11:02:47 -05:00
dlavigne
b7d4a52981 Doc renameiso action. 2016-02-05 10:59:38 -05:00
dlavigne
24295f65a1 Doc fetchiso action. 2016-02-05 08:53:13 -05:00
dlavigne
208ce54e98 Clarify description for deactivatepool. 2016-02-05 08:40:21 -05:00
Brandon Schneider
5cde5b594d Add new iocage API to clean all.
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "cleanall"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "args" : {
      "action" : "cleanall"
   },
   "id" : "fooid",
   "name" : "iocage"
}

Response:
-------------------------------
{
  "args": {
    "cleanall": {
      "success": "All iocage datasets have been cleaned."
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 22:39:32 -06:00
Brandon Schneider
285002d9e8 Add new iocage API call to clean all templates.
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "cleantemplates"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "cleantemplates"
   },
   "name" : "iocage",
   "id" : "fooid",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "cleantemplates": {
      "success": "All templates have been cleaned."
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 22:36:02 -06:00
Brandon Schneider
920a51f997 Add new iocage API call to clean all RELEASEs
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "cleanreleases"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "namespace" : "sysadm",
   "args" : {
      "action" : "cleanreleases"
   },
   "name" : "iocage"
}

Response:
-------------------------------
{
  "args": {
    "cleanreleases": {
      "success": "All RELEASEs have been cleaned."
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 22:34:01 -06:00
Brandon Schneider
dbbcf44d35 Add new iocage API call to clean all jails.
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "cleanjails"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "args" : {
      "action" : "cleanjails"
   },
   "id" : "fooid",
   "name" : "iocage"
}

Response:
-------------------------------
{
  "args": {
    "cleanjails": {
      "success": "All jails have been cleaned."
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 22:31:19 -06:00
Brandon Schneider
27cc7f279e Add new iocage API call to cap a jail.
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "jail" : "test",
   "action" : "capjail"
}

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

Response:
-------------------------------
{
  "args": {
    "capjail": {
      "success": "jail test capped."
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 22:00:26 -06:00
JoshDW19
5cb8dcf026 Add new API call to iohyve to remove a iso dataset
Target is the iso we are removing from iohyve

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "action" : "rmiso",
   "target" : "FreeBSD-10.2-RELEASE-amd64-bootonly.iso"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "name" : "iohyve",
   "args" : {
      "target" : "FreeBSD-10.2-RELEASE-amd64-bootonly.iso",
      "action" : "rmiso"
   },
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "rmiso": {
      "target": "FreeBSD-10.2-RELEASE-amd64-bootonly.iso"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 15:53:45 -05:00
Kris Moore
4d3b590f46 Add new API call to iohyve to rename an existing ISO file on
disk

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "source" : "test.iso",
   "target" : "102.iso",
   "action" : "renameiso"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "target" : "102.iso",
      "source" : "test.iso",
      "action" : "renameiso"
   },
   "id" : "fooid",
   "name" : "iohyve",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "renameiso": {
      "source": "test.iso",
      "target": "102.iso"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 15:23:44 -05:00
Kris Moore
a727b4a8a2 Add new API call to fetch an ISO for iohyve
Uses the "url" argument, which should be the address understood by "fetch" to
grab an ISO from, I.E. http://, ftp://, file://, etc

The task will queue, and return an event when finished

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "url" : "ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso",
   "action" : "fetchiso"
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "name" : "iohyve",
   "args" : {
      "url" : "ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso",
      "action" : "fetchiso"
   },
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "fetchiso": {
      "command": "iohyve fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso",
      "comment": "Task Queued",
      "queueid": "{b3a8b980-a564-4ff8-86a2-1971bd4f58d1}"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-04 14:58:29 -05:00
dlavigne
dda2ede751 Add new iohyve class. 2016-02-04 13:07:31 -05:00
dlavigne
40f629230a Doc deactivatepool action. 2016-02-04 12:43:29 -05:00
dlavigne
b848d76be0 Doc activatepool action. 2016-02-04 11:47:21 -05:00
Kris Moore
21d016e3b8 Merge branch 'master' of https://github.com/pcbsd/sysadm 2016-02-04 11:37:25 -05:00
Kris Moore
a17cc0b7e4 Update the api-test script, now we only "simulate" the REST request
and show the same reponse from websockets. This prevents issues
from running API requests two times in a row

Also, add support for ENV variables to be used, instead of interactive
elements
2016-02-04 11:36:30 -05:00
dlavigne
e899e2c678 Doc stopjail action. 2016-02-04 11:30:06 -05:00
dlavigne
521e7f9ec8 Doc startjail action. 2016-02-04 11:21:18 -05:00
dlavigne
ee8fa9d436 Doc setsysctl action. 2016-02-04 11:07:54 -05:00
dlavigne
661c0e8cbe Doc sysctllist action. 2016-02-04 10:58:58 -05:00
dlavigne
916cbaff6e Doc killproc action. 2016-02-04 10:51:54 -05:00
dlavigne
c100aa2b93 Unclobber systemmanager rename in docs. 2016-02-04 10:37:29 -05:00
dlavigne
a9887c9156 Add ip4 to examples. 2016-02-04 10:28:47 -05:00
dlavigne
69d8a97944 Doc procinfo action. 2016-02-04 10:25:01 -05:00
dlavigne
1750146d3d Correct description of standalone update. 2016-02-04 10:01:40 -05:00
Brandon Schneider
98409969c5 Add a new iocage API call to deactivate pools.
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "deactivatepool",
   "pool" : "tank"
}

REST Response:
-------------------------------
{
    "args": {
        "deactivatepool": {
            "success": "pool tank deactivated."
        }
    }
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "name" : "iocage",
   "args" : {
      "pool" : "tank",
      "action" : "deactivatepool"
   },
   "namespace" : "sysadm"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "deactivatepool": {
      "success": "pool tank deactivated."
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

Also added some error control to the activate API call.
2016-02-03 19:37:23 -06:00
Brandon Schneider
1048b3a6da Add a new iocage API call to activate zpools.
It has 2 different outputs depending on if `pool` was actually specified.

If you specify a pool this is what you get:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "activatepool",
   "pool" : "tank"
}

REST Response:
-------------------------------
{
    "args": {
        "activatepool": {
            "success": "pool tank activated."
        }
    }
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "activatepool",
      "pool" : "tank"
   },
   "name" : "iocage",
   "id" : "fooid",
   "namespace" : "sysadm"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "activatepool": {
      "success": "pool tank activated."
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

If you do not specify a pool, this is your output:
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "activatepool"
}

REST Response:
-------------------------------
{
    "args": {
        "activatepool": {
            "currently active": {
                "pool": " tank"
            }
        }
    }
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "activatepool"
   },
   "namespace" : "sysadm",
   "name" : "iocage",
   "id" : "fooid"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "activatepool": {
      "currently active": {
        "pool": " tank"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-03 19:14:18 -06:00
Brandon Schneider
437b3d76f3 Added stopping an iocage jail API call
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "stopjail",
   "jail" : "test"
}

REST Response:
-------------------------------
{
    "args": {
        "stopjail": {
            "test": {
                "* Stopping 0bf985de-ca0f-11e5-8d45-d05099728dbf (test)": "",
                "+ Removing jail process OK": "",
                "+ Running post-stop OK": "",
                "+ Running pre-stop OK": "",
                "+ Stopping services OK": ""
            }
        }
    }
}

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

WebSocket Response:
-------------------------------
{
  "args": {
    "stopjail": {
      "test": {
        "INFO": " 0bf985de-ca0f-11e5-8d45-d05099728dbf (test) is already down"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-03 17:18:28 -06:00
Brandon Schneider
a5f05b7162 Added starting iocage jail API call
Websocket is duplicated after REST call, so it actually shows the jail as up since the REST request has already run

REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "startjail",
   "jail" : "test"
}

REST Response:
-------------------------------
{
    "args": {
        "startjail": {
            "test": {
                "* Starting 0bf985de-ca0f-11e5-8d45-d05099728dbf (test)": "",
                "+ Started (shared IP mode) OK": "",
                "+ Starting services OK": ""
            }
        }
    }
}

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

WebSocket Response:
-------------------------------
{
  "args": {
    "startjail": {
      "test": {
        "INFO": " 0bf985de-ca0f-11e5-8d45-d05099728dbf (test) is already up"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-03 17:14:09 -06:00
Brandon Schneider
668aae79df Removed duplicate qDebug include 2016-02-03 16:11:05 -06:00
Kris Moore
f4a61e7d0a Add new API call to set a sysctl
REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
   "value" : "0",
   "sysctl" : "security.jail.mount_devfs_allowed",
   "action" : "setsysctl"
}

REST Response:
-------------------------------
{
    "args": {
        "setsysctl": {
            "response": "security.jail.mount_devfs_allowed: 1 -> 0",
            "sysctl": "security.jail.mount_devfs_allowed",
            "value": "0"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "value" : "0",
      "action" : "setsysctl",
      "sysctl" : "security.jail.mount_devfs_allowed"
   },
   "name" : "systemmanager",
   "namespace" : "sysadm",
   "id" : "fooid"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "setsysctl": {
      "response": "security.jail.mount_devfs_allowed: 1 -> 0",
      "sysctl": "security.jail.mount_devfs_allowed",
      "value": "0"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-03 13:21:00 -05:00
Kris Moore
fccac94ab6 Add new API call "sysctllist"
Returns the list of all setable sysctl values

REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
   "action" : "sysctllist"
}

REST Response:
-------------------------------
{
    "args": {
        "sysctllist": {
            "compat.ia32.maxdsiz": "536870912",
            "compat.ia32.maxssiz": "67108864",
            "compat.ia32.maxvmem": "0",
            "compat.linux.osname": "Linux",
            "compat.linux.osrelease": "2.6.18",
            "compat.linux.oss_version": "198144",
            "compat.linux32.maxdsiz": "536870912",
            "compat.linux32.maxssiz": "67108864",
            "compat.linux32.maxvmem": "0",
            ....
        }
    }
}

WebSocket Request:
-------------------------------
{
   "name" : "systemmanager",
   "namespace" : "sysadm",
   "id" : "fooid",
   "args" : {
      "action" : "sysctllist"
   }
}

WebSocket Response:
-------------------------------
{
  "args": {
    "sysctllist": {
      "compat.ia32.maxdsiz": "536870912",
      "compat.ia32.maxssiz": "67108864",
      "compat.ia32.maxvmem": "0",
      "compat.linux.osname": "Linux",
      "compat.linux.osrelease": "2.6.18",
      "compat.linux.oss_version": "198144",
      "compat.linux32.maxdsiz": "536870912",
      "compat.linux32.maxssiz": "67108864",
      "compat.linux32.maxvmem": "0",
      ....
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-03 13:09:31 -05:00
Kris Moore
36d2f77d5c Add API call to kill processes on the system
pid = <pid>
signal = {INT|QUIT|ABRT|KILL|ALRM|TERM}

REST Request:
-------------------------------
PUT /sysadm/systemmanager
{
   "signal" : "KILL",
   "pid" : "13939",
   "action" : "killproc"
}

REST Response:
-------------------------------
{
    "args": {
        "killproc": {
            "action": "killproc",
            "pid": "13939",
            "signal": "KILL"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "args" : {
      "pid" : "13939",
      "action" : "killproc",
      "signal" : "KILL"
   },
   "id" : "fooid",
   "name" : "systemmanager"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "killproc": {
      "action": "killproc",
      "pid": "13939",
      "signal": "KILL"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-03 12:45:02 -05:00
Kris Moore
6fd9a689b4 Rename "systeminfo" class -> "systemmanager"
Updated the docs as part of this commit
2016-02-03 12:27:06 -05:00
Ken Moore
37224472cc Make the websocket/rest server distinctions a bit more clear. Now the logs are in websocket/restserver subdirectories, the LP file watchers will resume from the last log point (server-type aware), and a couple other changes for saving server-dependent variables. 2016-02-03 10:12:01 -05:00
Brandon Schneider
b2cde628fb Whoops! Fixed that unintended whitespace. 2016-02-03 01:10:41 -06:00
Brandon Schneider
5a048cbdba Add ip4 to iocage's listjails sysadm API call
REST Request:
-------------------------------
PUT /sysadm/iocage
{
   "action" : "listjails"
}

REST Response:
-------------------------------
{
    "args": {
        "listjails": {
            "0bf985de-ca0f-11e5-8d45-d05099728dbf": {
                "boot": "off",
                "ip4": "-",
                "jid": "-",
                "state": "down",
                "tag": "test",
                "type": "basejail"
            }
        }
    }
}

WebSocket Request:
-------------------------------
{
   "name" : "iocage",
   "id" : "fooid",
   "args" : {
      "action" : "listjails"
   },
   "namespace" : "sysadm"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "listjails": {
      "0bf985de-ca0f-11e5-8d45-d05099728dbf": {
        "boot": "off",
        "ip4": "-",
        "jid": "-",
        "state": "down",
        "tag": "test",
        "type": "basejail"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-02-03 01:08:31 -06:00