Send a command to the pdinstall service.
Commands: install - Install snaps from a file path or http(s) URL.
Required data fields: sources - List with at least one snap file path or URL. The snapsare installed in order until one succeeds or all fail.
Returns True/False for success. Currently, we cannot check whether the call succeeded, only whether it was delived. A return value of False means we could not deliver the command to pdinstall.
The ProcessMonitor class ensures that a service is running and that its pid file is consistent.
This addresses an issue we have had with Docker on Ubuntu Snappy, where its pid file sometimes persists and prevents the service from starting.
ProcessMonitor(service, cmdstring=None, pidfile=None, action='restart')[source]¶
allowedActions= set(['reboot', 'restart'])¶
Check that the service is running and consistent with pid file(s).
Returns True or False.
Look through checking and restarting the service until it is ready or the maximum number of tries has been reached.
delay: time delay (seconds) between retries. tries: maximum number of restart-wait-check cycles.
Resource optimization functions.
Allocate resources among slices with specified and unspecified reservations.
Returns a new list of values with the following properties: - Every value is >= the corresponding input value. - The result sums to total.
Examples: allocate([0.25, None, None]) -> [0.5, 0.25, 0.25] allocate([0.4, None, None]) -> [0.6, 0.2, 0.2] allocate([0.2, 0.2, 0.2]) -> [0.33, 0.33, 0.33] allocate([None, None, None]) -> [0.33, 0.33, 0.33] allocate([0.5, 0.5, 0.5]) -> ERROR
Client for interacting with the snapd API to manage installed snaps.