Commit Graph

10 Commits

Author SHA1 Message Date
Ken Moore
25ca2d430d Cleanup the service manager backend a bit.
Make it more robust concerning OpenRC vs rc.d management.
2018-04-04 10:59:45 -04:00
Charlie Root
10bf9bf994 Initial whack at making service manager understand openrc 2016-12-11 08:24:53 -05:00
Ken Moore
6924dad755 When making changes to the update manager repo/url - clear out the last check for updates so the next ping will re-check using the new settings.
Also remove some old comments from the service manager.
2016-09-19 09:50:43 -04:00
Ken Moore
0408f61f4c API CHANGE
Add the "is_running" output field to the sysadm/services "list_services" output.
This also cleans up the is_enabled detection routine so it should be more reliable.
2016-08-30 13:32:53 -04:00
Ken Moore
8a594044bb API CHANGE
Add 3 new API calls (all almost the same - just different "actions" and the return message will be slightly different)

"action":"start" OR "stop" OR "restart"
This will [start/stop/restart] services on the system.
REQUIRED ARGUMENTS:
"services" : <string with a single service, or array of services>

EXAMPLE "start" command (change "services_started" in responce to "services_[started/stopped/restarted]" as needed to match the action:

REST Request (example):
-------------------------------
PUT /sysadm/services
{
   "action" : "start",
   "services" : [
      "cupsd"
   ]
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "start",
      "services" : [
         "cupsd"
      ]
   },
   "name" : "services",
   "id" : "fooid",
   "namespace" : "sysadm"
}

Response:
-------------------------------
{
  "args": {
    "services_started": [
      "cupsd"
    ]
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-08-30 11:27:51 -04:00
Ken Moore
ce86331f1e Clean up the new sysadm/services class just a bit more. Getting ready to add all the start/stop/restart API calls. 2016-08-29 16:09:30 -04:00
Ken Moore
0d4eb2c4f3 Cleanup the rc.conf parsing a bit more - turn of debugging messages, and ensure we use [one][start/stop/restart] as needed depending on if it is enabled or not. 2016-08-29 14:59:32 -04:00
Ken Moore
2f7bfe06aa API CHANGE
Modify the output fields for the sysadm/services, "list_services" action:
Now each service entry will look like this:
"accounting": {
        "description": "",
        "is_enabled": "false",
        "name": "accounting",
        "path": "/etc/rc.d/accounting",
        "tag": "accounting_enable"
      }

I will probably be adding an "is_running" [true/false] field here soon as well - the backend for that still needs to be written first.
2016-08-29 14:09:20 -04:00
Ken Moore
1bf0ec425f API CHANGE
Add a new API class/call to sysadm:
namespace: sysadm
name: services
This class is for managing all the background daemons on the system.

Initial API call:
args : {"action" : "list_services" }
This will return a list of all services available on the system.

*Note: return message shortened for example purposes - there are usually tons of services available

REST Request (example):
-------------------------------
PUT /sysadm/services
{
   "action" : "list_services"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "action" : "list_services"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "services"
}

Response:
-------------------------------
{
  "args": {
    "services": {
      "accounting": {
        "name": "accounting",
        "tag": "accounting_enable"
      },
      "addswap": {
        "name": "addswap",
        "tag": "addswap_enable"
      },
      "amd": {
        "name": "amd",
        "tag": "amd_enable"
      },
      "apm": {
        "name": "apm",
        "tag": "apm_enable"
      },
      "apmd": {
        "name": "apmd",
        "tag": "apmd_enable"
      },
      "atm": {
        "name": "atm",
        "tag": "atm_enable"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
2016-08-29 11:41:15 -04:00
Ken Moore
1146b14917 Cleanup the library/server interactions for sysadm: Now the "library" directory is just an internal collection of classes/files, rather than an actual library of system calls. This allows for in-server globals usage (such as the dispatcher/events systems) within the library files as needed. 2016-02-01 12:29:25 -05:00