paradrop.core.chute package¶
Submodules¶
paradrop.core.chute.chute module¶
-
class
Chute
(descriptor, strip=None)[source]¶ Bases:
object
Wrapper class for Chute objects.
-
CONFIG_FIELDS
= set(['environment', 'web', 'net', 'host_config'])¶
-
STATE_DISABLED
= 'disabled'¶
-
STATE_FROZEN
= 'frozen'¶
-
STATE_INVALID
= 'invalid'¶
-
STATE_RUNNING
= 'running'¶
-
STATE_STOPPED
= 'stopped'¶
-
appendCache
(key, val)[source]¶ Finds the key they requested and appends the val into it, this function assumes the cache object is of list type, if the key hasn’t been defined yet then it will set it to an empty list.
-
dumpCache
()[source]¶ Return a string of the contents of this chute’s cache. In case of catastrophic failure dump all cache content so we can debug.
-
getHostConfig
()[source]¶ Get the chute’s host_config options for Docker.
Returns an empty dictionary if there is no host_config setting.
-
getWebPort
()[source]¶ Get the port configured for the chute’s web server.
Returns port (int) or None if no port is configured.
-
paradrop.core.chute.chute_storage module¶
-
class
ChuteStorage
(filename=None, save_timer=0)[source]¶ Bases:
paradrop.lib.utils.pd_storage.PDStorage
ChuteStorage class.
This class holds onto the list of Chutes on this AP.
It implements the PDStorage class which allows us to save the chuteList to disk transparently
-
chuteList
= {}¶
-
deleteChute
(ch)[source]¶ Deletes a chute from the chute storage. Can be sent the chute object, or the chute name.
-
paradrop.core.chute.restart module¶
Contains the functions required to restart chutes properly on power cycle of device. Checks with pdconfd to make sure it was able to properly bring up all interfaces before starting chutes.
-
reloadChutes
()[source]¶ This function is called to restart any chutes that were running prior to the system being restarted. It waits for pdconfd to come up and report whether or not it failed to bring up any of the interfaces that existed before the power cycle. If pdconfd indicates something failed we then force a stop update in order to bring down all interfaces associated with that chute and mark it with a warning. If the stop fails we mark the chute with a warning manually and change its state to stopped and save to storage this isn’t great as it could mean our system still has interfaces up associated with that chute. If pdconfd doesn’t report failure we attempt to start the chute and if this fails we trust the abort process to restore the system to a consistent state and we manually mark the chute as stopped and add a warning to it. :param None :returns: (list) A list of update dicts to be used to create updateObjects that should be run before accepting new updates.
-
updateStatus
(update)[source]¶ This function is a callback for the updates we do upon restarting the system. It checks whether or not the update completed successfully and if not it changes the state of the chute to stopped and adds a warning. :param update: The update object containing information about the chute that was created and whether it was successful or not. :type update: obj :returns: None