Added subsections to section 3: dispatcher, life preserver, and system state.
Added examples of dispatcher messaging to parts of section 4: Classes.
Added further examples of messaging to section 3 in the subsections.
This will remove the given packages from the system.
Required arguments:
"pkg_origins" = (single origin string or array of origin strings).
Optional arguments:
"recursive" = "true" or "false" (default: "true"). If true, other packages which depend on this package will also be removed (no broken dependencies).
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"recursive" : "false",
"action" : "pkg_remove",
"pkg_origins" : "games/angband"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"name" : "pkg",
"namespace" : "sysadm",
"args" : {
"action" : "pkg_remove",
"recursive" : "false",
"pkg_origins" : "games/angband"
}
}
Response:
-------------------------------
{
"args": {
"pkg_remove": {
"proc_cmd": "pkg delete -y games/angband",
"proc_id": "sysadm_pkg_remove-{2aa844aa-f6a8-4e8f-ae71-b56af735ccb8}",
"status": "pending"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This will install the given packages on the system.
Required arguments:
"pkg_origins" = (single origin string or array of origin strings).
Optional arguments:
"repo": Name of the remote repository to use (if not supplied, pkg will automatically determine repository).
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"pkg_origins" : "games/angband",
"action" : "pkg_install",
"repo" : "pcbsd-major"
}
WebSocket Request:
-------------------------------
{
"name" : "pkg",
"namespace" : "sysadm",
"id" : "fooid",
"args" : {
"action" : "pkg_install",
"pkg_origins" : "games/angband",
"repo" : "pcbsd-major"
}
}
Response:
-------------------------------
{
"args": {
"pkg_install": {
"proc_cmd": "pkg install -y --repository \"pcbsd-major\" games/angband",
"proc_id": "sysadm_pkg_install-{ae444472-47df-4a65-91eb-013cc82ce4ad}",
"status": "pending"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This will have pkg update it's databases if necessary (not typically used).
Optional argument: "force" = "true" or "false" (default: "false"). If true, this will force pkg to completely re-sync all databases with all known repos (may take some time).
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"force" : "true",
"action" : "pkg_update"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"name" : "pkg",
"namespace" : "sysadm",
"args" : {
"force" : "true",
"action" : "pkg_update"
}
}
Response:
-------------------------------
{
"args": {
"pkg_update": {
"proc_cmd": "pkg update -f",
"proc_id": "sysadm_pkg_update-{8d65bbc5-fefc-4f34-8743-167e61a54c4c}",
"status": "pending"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This will have pkg check to see if there are any package updates available.
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"action" : "pkg_check_upgrade"
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "pkg_check_upgrade"
},
"namespace" : "sysadm",
"name" : "pkg",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"pkg_check_upgrade": {
"proc_cmd": "pkg upgrade -n",
"proc_id": "sysadm_pkg_check_upgrade-{c5e9d9a1-7c49-4a70-9d7c-4a84277c83b0}",
"status": "pending"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This will have pkg upgrade all currently-installed packages.
NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"action" : "pkg_upgrade"
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "pkg_upgrade"
},
"name" : "pkg",
"namespace" : "sysadm",
"id" : "fooid"
}
Response:
-------------------------------
{
"args": {
"pkg_upgrade": {
"proc_cmd": "pkg upgrade -y",
"proc_id": "sysadm_pkg_upgrade-{19ace7c9-0d83-4a0d-9249-0b56cb105762}",
"status": "pending"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This will perform an audit of all installed packages and report any vulnerable packages and which other packages these impact. NOTE: The actual information will be returned as a Dispatcher event - this API call just queues up the pkg operation (limitation of pkg - only one process call at a time)
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"action" : "pkg_audit"
}
WebSocket Request:
-------------------------------
{
"args" : {
"action" : "pkg_audit"
},
"name" : "pkg",
"id" : "fooid",
"namespace" : "sysadm"
}
Response:
-------------------------------
{
"args": {
"pkg_audit": {
"proc_cmd": "pkg audit -qr",
"proc_id": "sysadm_pkg_audit-{257cc46b-9178-4990-810a-12416ddfad79}",
"status": "pending"
}
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
1) "action"="list_categories" (optional argument: "repo"). This will list all the known categories within the given repository (local repository used by default if none specified). WARNING: Just because a category is listed from here does not mean there are packages existing within that category. This might be corrected later on to only return categories where packages reside.
2) "action"="list_repos" (no other arguments). This will scan the pkg repo config files and return any repos that pkg is currently aware of. NOTE: All of the repos returns by this function are valid as the optional "repo" argument for the other sysadm/pkg API calls.
API Call #1:
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"repo" : "local",
"action" : "list_categories"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"args" : {
"action" : "list_categories",
"repo" : "local"
},
"namespace" : "sysadm",
"name" : "pkg"
}
Response:
-------------------------------
{
"args": {
"list_categories": [
"ports-mgmt",
"x11",
"gnome",
"textproc",
"devel",
"python",
"misc",
"print",
"graphics",
"security",
"x11-fonts",
"lang",
"ipv6",
"perl5",
"converters",
"math",
"x11-toolkits",
"sysutils",
"dns",
"net",
"accessibility",
"databases",
"shells",
"x11-themes",
"multimedia",
"audio",
"www",
"ftp",
"net-im",
"archivers",
"comms",
"java",
"deskutils",
"kde",
"mail",
"editors",
"emulators",
"games",
"irc",
"japanese",
"news",
"x11-servers",
"tk",
"net-mgmt",
"ruby",
"x11-drivers",
"x11-wm",
"x11-clocks",
"kld",
"tcl",
"enlightenment",
"linux"
]
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
API Call #2
REST Request:
-------------------------------
PUT /sysadm/pkg
{
"action" : "list_repos"
}
WebSocket Request:
-------------------------------
{
"id" : "fooid",
"namespace" : "sysadm",
"name" : "pkg",
"args" : {
"action" : "list_repos"
}
}
Response:
-------------------------------
{
"args": {
"list_repos": [
"local",
"pcbsd-major"
]
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
1) Add a new optional argument: "category". This option will be used if the "pkg_origins" argument is not, and limits the results to packages within the designated category.
2) Add a new optional argument: "result". This option may be set to anything other than "full" to restrict the information output to just the basic/simple information (no sub-categories of info such as "dependencies","requires","depends","options", etc...)
Example JSON request:
{"action":"pkg_info","category":"x11","result":"simple"}
These argument will result in a basic listing of all the packages within the x11 category. (name, version, origin, www, arch, comment, etc....)
{