lifted package¶
Submodules¶
lifted.config module¶
- 
lifted.config.configure(conf)[source]¶
- Add lifted settings to the configuration - Parameters
- conf (ComposerConfig) -- configuration object 
- Returns
- None 
 - This uses the composer.share_dir and composer.lib_dir as the base directories for the settings. 
lifted.providers module¶
- 
lifted.providers.delete_profile(ucfg, provider_name, profile)[source]¶
- Delete a provider's profile settings file - Parameters
- Raises
- ValueError when passed invalid settings or an invalid profile name 
- Raises
- RuntimeError when the provider or profile couldn't be found 
 
- 
lifted.providers.list_providers(ucfg)[source]¶
- List the names of the available upload providers - Parameters
- ucfg (object) -- upload config 
- Returns
- a list of all available provider_names 
- Return type
- list of str 
 
- 
lifted.providers.load_profiles(ucfg, provider_name)[source]¶
- Return all settings profiles associated with a provider 
- 
lifted.providers.load_settings(ucfg, provider_name, profile)[source]¶
- Load settings for a provider's profile - Parameters
- Returns
- The profile settings for the selected provider 
- Return type
- Raises
- ValueError when passed invalid settings or an invalid profile name 
- Raises
- RuntimeError when the provider or profile couldn't be found 
- Raises
- ValueError when the passed settings are invalid 
 - This also calls validate_settings on the loaded settings, potentially raising an error if the saved settings are invalid. 
- 
lifted.providers.resolve_playbook_path(ucfg, provider_name)[source]¶
- Given a provider's name, return the path to its playbook 
- 
lifted.providers.resolve_provider(ucfg, provider_name)[source]¶
- Get information about the specified provider as defined in that provider's provider.toml, including the provider's display name and expected settings. - At a minimum, each setting has a display name (that likely differs from its snake_case name) and a type. Currently, there are two types of settings: string and boolean. String settings can optionally have a "placeholder" value for use on the front end and a "regex" for making sure that a value follows an expected pattern. 
- 
lifted.providers.save_settings(ucfg, provider_name, profile, settings)[source]¶
- Save (and overwrite) settings for a given provider 
lifted.queue module¶
- 
lifted.queue.cancel_upload(ucfg, uuid)[source]¶
- Cancel an upload - Parameters
- ucfg (ComposerConfig) -- the compose config 
- uuid (str) -- the UUID of the upload to cancel 
 
 
- 
lifted.queue.create_upload(ucfg, provider_name, image_name, settings)[source]¶
- Creates a new upload - Parameters
- Returns
- the created upload object 
- Return type
 
- 
lifted.queue.delete_upload(ucfg, uuid)[source]¶
- Delete an upload - Parameters
- ucfg (ComposerConfig) -- the compose config 
- uuid (str) -- the UUID of the upload to delete 
 
 
- 
lifted.queue.get_all_uploads(ucfg)[source]¶
- Get a list of all stored Upload objects - Parameters
- ucfg (object) -- upload config 
- Returns
- a list of all stored upload objects 
- Return type
- list of Upload 
 
- 
lifted.queue.get_upload(ucfg, uuid, ignore_missing=False, ignore_corrupt=False)[source]¶
- Get an Upload object by UUID - Parameters
- ucfg (object) -- upload config 
- uuid (str) -- UUID of the upload to get 
- ignore_missing (bool) -- if True, don't raise a RuntimeError when the specified upload is missing, instead just return None 
- ignore_corrupt (bool) -- if True, don't raise a RuntimeError when the specified upload could not be deserialized, instead just return None 
 
- Returns
- the upload object or None 
- Return type
- Raises
- RuntimeError 
 
- 
lifted.queue.get_uploads(ucfg, uuids)[source]¶
- Gets a list of Upload objects from a list of upload UUIDs, ignoring missing or corrupt uploads - Parameters
- ucfg (object) -- upload config 
- uuids (list of str) -- list of upload UUIDs to get 
 
- Returns
- a list of the uploads that were successfully deserialized 
- Return type
- list of Upload 
 
- 
lifted.queue.ready_upload(ucfg, uuid, image_path)[source]¶
- Pass an image_path to an upload and mark it ready to execute 
- 
lifted.queue.reset_upload(ucfg, uuid, new_image_name=None, new_settings=None)[source]¶
- Reset an upload so it can be attempted again 
- 
lifted.queue.start_upload_monitor(ucfg)[source]¶
- Start a thread that manages the upload queue - Parameters
- ucfg (ComposerConfig) -- the compose config 
 
lifted.upload module¶
- 
class lifted.upload.Upload(uuid=None, provider_name=None, playbook_path=None, image_name=None, settings=None, creation_time=None, upload_log=None, upload_pid=None, image_path=None, status_callback=None, status=None)[source]¶
- Bases: - object- Represents an upload of an image to a cloud provider. Instances of this class are serialized as TOML and stored in the upload queue directory, which is /var/lib/lorax/upload/queue/ by default - 
cancel(status_callback=None)[source]¶
- Cancel the upload. Sends a SIGINT to self.upload_pid. - Parameters
- status_callback (function) -- a function of the form callback(self) 
 
 - 
execute(status_callback=None)[source]¶
- Execute the upload. Meant to be called from a dedicated process so that the upload can be cancelled by sending a SIGINT to self.upload_pid. - Parameters
- status_callback (function) -- a function of the form callback(self) 
 
 - 
is_cancellable()[source]¶
- Is the upload in a cancellable state? - Returns
- whether the upload is cancellable 
- Return type
 
 - 
ready(image_path, status_callback)[source]¶
- Provide an image_path and mark the upload as ready to execute - Parameters
- image_path (str) -- path of the image to upload 
- status_callback (function) -- a function of the form callback(self) 
 
 
 - 
reset(status_callback)[source]¶
- Reset the upload so it can be attempted again - Parameters
- status_callback (function) -- a function of the form callback(self) 
 
 - 
serializable()[source]¶
- Returns a representation of the object as a dict for serialization - Returns
- the object's __dict__ 
- Return type
 
 
-