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.

delCache(key)[source]

Delete the key:val from the _cache dict object.

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.

getCache(key)[source]

Get the val out of the _cache dict object, or None if it doesn’t exist.

getCacheContents()[source]

Return the cache dictionary.

getConfiguration()[source]

Get the chute’s configuration object.

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.

isRunning()[source]
isValid()[source]

Return True only if the Chute object we have has all the proper things defined to be in a valid state.

setCache(key, val)[source]

Set the key:val into the _cache dict object to carry around.

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

attrSaveable()[source]

Returns True if we should save the ChuteList, otherwise False.

chuteList = {}
clearChuteStorage()[source]
deleteChute(ch)[source]

Deletes a chute from the chute storage. Can be sent the chute object, or the chute name.

getAttr()[source]

Get our attr (as class variable for all to see)

getChute(name)[source]

Returns a reference to a chute we have in our cache, or None.

getChuteList()[source]

Return a list of the names of the chutes we know of.

saveChute(ch)[source]

Saves the chute provided in our internal chuteList. Also since we just received a new chute to hold onto we should save our ChuteList to disk.

setAttr(attr)[source]

Save our attr however we want (as class variable for all to see)

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

Module contents