Skip to main content

Service

The behaviors that service calls, and each call that its examples make. osapi dsl chain get --name service shows the same.

Chain​

Behaviorservice
Chainservice → (object, managedfile)
Callsobject, managedfile
Used bynone

A service that osapi deployed reads by its name (list)​

CALLSENDSGETS
service list[{"name":"ssh","state":"running","enabled":true,"description":"OpenBS…
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…

A host with two services (list)​

CALLSENDSGETS
service list[{"name":"ssh","state":"running","enabled":true,"description":"OpenBS…
└─ managedfile getpath=/etc/systemd/system/osapi-app.serviceerror: /etc/systemd/system/osapi-app.service: not managed

A running service (get)​

CALLSENDSGETS
service getname=sshdescription="OpenBSD Secure Shell server" enabled=true managed=false …
└─ managedfile getpath=/etc/systemd/system/osapi-ssh.serviceerror: /etc/systemd/system/osapi-ssh.service: not managed

A name with .service (get)​

CALLSENDSGETS
service getname=ssh.servicedescription="OpenBSD Secure Shell server" enabled=true managed=false …
└─ managedfile getpath=/etc/systemd/system/osapi-ssh.serviceerror: /etc/systemd/system/osapi-ssh.service: not managed

A service that osapi deployed, by the name it was deployed with (get)​

CALLSENDSGETS
service getname=appdescription="Example app" enabled=false managed=true name=app state=d…
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…

A service that osapi deployed, by its unit's name (get)​

CALLSENDSGETS
service getname=osapi-appdescription="Example app" enabled=false managed=true name=app state=d…
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…

Deploy a unit file (create)​

CALLSENDSGETS
service createname=app object=app.servicechanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.serviceerror: /etc/systemd/system/osapi-app.service: not managed
└─ object getname=app.servicecontent=<8 lines> content_type=raw name=app.service sha256=f1f13ddd26…
└─ managedfile updatecontent=<8 lines> metadata={"object":"app.service"} mode=0644 object=…changed=true path=/etc/systemd/system/osapi-app.service

A unit file that has the content (create)​

CALLSENDSGETS
service createname=app object=app.servicechanged=false name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…
└─ object getname=app.servicecontent=<8 lines> content_type=raw name=app.service sha256=f1f13ddd26…
└─ managedfile updatecontent=<8 lines> metadata={"object":"app.service"} mode=0644 object=…changed=false path=/etc/systemd/system/osapi-app.service

A new unit file (update)​

CALLSENDSGETS
service updatename=app object=app-v2.servicechanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…
└─ object getname=app-v2.servicecontent=<9 lines> content_type=raw name=app-v2.service sha256=a67ff5f…
└─ managedfile updatecontent=<9 lines> metadata={"object":"app-v2.service"} mode=0644 obje…changed=true path=/etc/systemd/system/osapi-app.service

Remove a service (delete)​

CALLSENDSGETS
service deletename=appchanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…
└─ managedfile deletepath=/etc/systemd/system/osapi-app.servicechanged=true path=/etc/systemd/system/osapi-app.service

A service that osapi did not deploy (delete)​

CALLSENDSGETS
service deletename=appchanged=false name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.serviceerror: /etc/systemd/system/osapi-app.service: not managed

A unit file that osapi did not deploy (delete)​

CALLSENDSGETS
service deletename=agentchanged=false name=agent
└─ managedfile getpath=/etc/systemd/system/osapi-agent.serviceerror: /etc/systemd/system/osapi-agent.service: not managed

Start the service (start)​

CALLSENDSGETS
service startname=appchanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…

Stop the service (stop)​

CALLSENDSGETS
service stopname=appchanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…

Restart the service (restart)​

CALLSENDSGETS
service restartname=appchanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…

Enable the service (enable)​

CALLSENDSGETS
service enablename=appchanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…

A unit with no [Install] section (enable)​

CALLSENDSGETS
service enablename=staticchanged=false name=static
└─ managedfile getpath=/etc/systemd/system/osapi-static.servicemetadata={"object":"static.service"} object_sha256=716bed98f25a213a18…

Disable the service (disable)​

CALLSENDSGETS
service disablename=appchanged=true name=app
└─ managedfile getpath=/etc/systemd/system/osapi-app.servicemetadata={"object":"app.service"} object_sha256=f1f13ddd26ea6233bbcc7…