paradrop.core.update package

Submodules

paradrop.core.update.update_fetcher module

Fetch new updates from the pdserver and apply the updates

class UpdateFetcher(update_manager)[source]

Bases: object

pull_update(**kwargs)[source]

Start updates by polling the server for the latest updates.

This is the only method that needs to be called from outside. The rest are triggered asynchronously.

Call chain: pull_update -> _updates_received -> _update_complete

_auto: Set to True when called by the scheduled LoopingCall.

start_long_poll(**kwargs)[source]
start_polling()[source]

paradrop.core.update.update_manager module

class UpdateManager(reactor)[source]

This class is in charge of making the configuration changes required on the chutes. It utilizes the ChuteStorage class to hold onto the chute data.

Use @updateChutes to make the configuration changes on the AP.
This function is thread-safe, this class will only call one update set at a time. All others are held in a queue until the last update is complete.
add_provision_update(hostconfig_patch, zerotier_networks)[source]
add_update(**update)[source]

MUTEX: updateLock Take the list of Chutes and push the list into a queue object, this object will then call the real update function in another thread so the function that called us is not blocked.

We take a callable responseFunction to call, when we are done with this update we should call it.

assign_change_id()[source]

Get a unique change ID for an update.

This should be used to set the change_id field in an update object.

clear_update_list()[source]

MUTEX: updateLock Clears all updates from list (new array).

find_change(change_id)[source]

Search active and queued changes for the requested change.

Returns an Update object or None.

paradrop.core.update.update_object module

This holds onto the UpdateObject class. It allows us to easily abstract away different update types and provide a uniform way to interpret the results through a set of basic actionable functions.

class UpdateChute(obj, reuse_existing=False)[source]

Bases: paradrop.core.update.update_object.UpdateObject

Updates specifically tailored to chute actions like create, delete, etc…

has_chute_build()[source]

Check whether this update involves building a chute.

updateModuleList = [<module 'paradrop.core.plan.name' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/name.py'>, <module 'paradrop.core.plan.state' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/state.py'>, <module 'paradrop.core.plan.struct' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/struct.py'>, <module 'paradrop.core.plan.resource' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/resource.py'>, <module 'paradrop.core.plan.traffic' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/traffic.py'>, <module 'paradrop.core.plan.runtime' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/runtime.py'>]
class UpdateObject(obj)[source]

Bases: object

The base UpdateObject class, covers a few basic methods but otherwise all the intelligence exists in the inherited classes.

All update information passed by the API server is contained as variables of this class such as update.updateType, update.updateClass, etc…

By default, the following variables should be utilized:

responses : an array of messages any module can choose to append warnings or errors to

failure : the module that chose to fail this update can set a string message to return
: to the user in the failure variable. It should be very clear as to why the : failure occurred, but if the user wants more information they may find it : in the responses variable which may contain debug information, etc…
add_message_observer(observer)[source]
cache_get(key, default=None)[source]

Get a value from the cache or the default value if it does not exist.

cache_set(key, value)[source]

Set a value in the cache.

complete(**kwargs)[source]

Signal to the API server that any action we need to perform is complete and the API server can finish its connection with the client that initiated the API request.

execute()[source]

The function that actually walks through the main process required to create the chute. It follows the executeplan module through the paces of:

  1. Generate the plans for each plan module
  2. Prioritize the plans
  3. Execute the plans

If at any point we fail then this function will directly take care of completing the update process with an error state and will close the API connection.

has_chute_build()[source]

Check whether this update involves building a chute.

progress(message)[source]
remove_message_observer(observer)[source]
started()[source]

This function should be called when the updated object is dequeued and execution is about to begin.

Sends a notification to the pdserver if this is a tracked update.

updateModuleList = []
class UpdateRouter(obj)[source]

Bases: paradrop.core.update.update_object.UpdateObject

Updates specifically tailored to router configuration.

updateModuleList = [<module 'paradrop.core.plan.hostconfig' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/hostconfig.py'>, <module 'paradrop.core.plan.router' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/router.py'>]
class UpdateSnap(obj)[source]

Bases: paradrop.core.update.update_object.UpdateObject

Updates specifically tailored to installing snaps.

updateModuleList = [<module 'paradrop.core.plan.snap' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/latest/paradrop/daemon/paradrop/core/plan/snap.py'>]
parse(obj)[source]

Determines the update type and returns the proper class.

Module contents