wizard.deploy

Object model for querying information and manipulating deployments of autoinstalls. Every Deployment has an app.ApplicationVersion which in turn has an app.Application.

Classes

class wizard.deploy.Deployment(location, version=None)

Represents a deployment of an autoinstall, e.g. directory that has a .wizard directory in it. Supply version with an ApplicationVersion only if you were reading from the versions store and care about speed (data from there can be stale).

The Deployment interface is somewhat neutered, so you may want to use WorkingCopy or ProductionCopy for more powerful operations.

Note

For legacy purposes, deployments can also be marked by a .scripts directory or a .scripts-version file.

app_version

The app.ApplicationVersion of this deployment.

application

The app.Application of this deployment.

backup_dir

The absolute path to .wizard/backups.

blacklisted_file

The absolute path of the .wizard/blacklisted file.

configured

Whether or not an autoinstall has been configured/installed for use.

detectVersion()

Returns the real version, based on filesystem, of install.

Throws a VersionDetectionError if we couldn’t figure out what the real version was.

dsn

The sqlalchemy.engine.url.URL for this deployment.

dsn_file

The absolute path of the .wizard/dsn override file.

extract()

Extracts all the values of all variables from deployment. These variables may be used for parametrizing generic parent commits and include things such as database access credentials and local configuration.

invalidateCache()

Invalidates all cached variables. This currently applies to app_version, old_log and read().

location

Absolute path to the deployment

migrated

Whether or not the autoinstalls has been migrated.

nextUrl()

Initializes url with a possible URL the web application may be located at. It may be called again to switch to another possible URL, usually in the event of a web access failure.

old_log

The wizard.old_log.Log of this deployment. This is only applicable to un-migrated autoinstalls.

old_version_file

The absolute path of either .scripts-version.

static parse(line)

Parses a line from the versions store.

Note

Use this method only when speed is of the utmost importance. You should prefer to directly create a deployment with only a location when possible.

pending_file

The absolute path of the .wizard/pending file.

read(file, force=False)

Reads a file’s contents, possibly from cache unless force is True.

setAppVersion(app_version)

Manually resets the application version; useful if the working copy is off in space (i.e. not anchored to something we can git describe off of) or there is no metadata to be heard of.

url

The urlparse.ParseResult for this deployment.

url_file

The absolute path of the .wizard/url override file.

verify(no_touch=False)

Checks if this is an autoinstall, throws an exception if there are problems. If no_touch is True, it will not attempt edit the installation.

verifyConfigured()

Checks if the autoinstall is configured running.

verifyGit(srv_path)

Checks if the autoinstall’s Git repository makes sense, checking if the tag is parseable and corresponds to a real application, and if the tag in this repository corresponds to the one in the remote repository.

verifyTag(srv_path)

Checks if the purported version has a corresponding tag in the upstream repository.

verifyVersion()

Checks if our version and the version number recorded in a file are consistent.

version

The distutils.version.LooseVersion of this deployment.

version_file

The absolute path of the .wizard/version file.

wizard_dir

The absolute path of the Wizard directory.

class wizard.deploy.ProductionCopy(location, version=None)

Bases: wizard.deploy.Deployment

Represents the production copy of a deployment. This copy is canonical, and is the only one guaranteed to be accessible via web, have a database, etc.

backup(options)

Performs a backup of database schemas and other non-versioned data.

fetch(path, post=None)

Performs a HTTP request on the website.

remove(options)

Deletes all non-local or non-filesystem data (such as databases) that this application uses.

restore(backup, options)

Restores a backup. Destroys state, so be careful! Also, this does NOT restore the file-level backup, which is what ‘wizard restore’ does, so you probably do NOT want to call this elsewhere unless you know what you’re doing (call ‘wizard restore’ instead).

upgrade(version, options)

Performs an upgrade of database schemas and other non-versioned data.

verifyDatabase()

Checks if the autoinstall has a properly configured database.

verifyWeb()

Checks if the autoinstall is viewable from the web. If you do not run this, there is no guarantee that the url returned by this application is the correct one.

class wizard.deploy.WorkingCopy(location, version=None)

Bases: wizard.deploy.Deployment

Represents a temporary clone of a deployment that we can make modifications to without fear of interfering with a production deployment. More operations are permitted on these copies.

parametrize(deployment)

Edits files in dir to replace WIZARD_* variables with literal instances based on deployment. This is used for constructing virtual merge bases, and as such deployment will generally not equal self.

prepareConfig()

Edits files in the deployment such that any user-specific configuration is replaced with generic WIZARD_* variables.

prepareMerge()

Performs various edits to files in the current working directory in order to make a merge go more smoothly. This is usually used to fix botched line-endings.

resolveConflicts()

Resolves conflicted files in this working copy. Returns whether or not all conflicted files were resolved or not. Fully resolved files are added to the index, but no commit is made.

Functions

wizard.deploy.get_install_lines(versions_store, user=None)

Low level function that retrieves a list of lines from the versions store that can be passed to Deployment.parse().

wizard.deploy.parse_install_lines(show, versions_store, yield_errors=False, user=None)

Generator function for iterating through all autoinstalls. Each item is an instance of Deployment, or possibly a wizard.deploy.Error if yield_errors is True. You can filter out applications and versions by specifying app or app-1.2.3 in show. This function may generate log output.

wizard.deploy.chdir_to_location(f)

Decorator for making a function have working directory Deployment.location.

wizard.deploy.web(dir, url=None)

Attempts to determine the URL a directory would be web-accessible at. If url is specified, automatically use it. Returns a generator which produces a list of candidate urls.

This function implements a plugin interface named wizard.deploy.web.

Exceptions

exception wizard.deploy.Error

Base error class for this module

exception wizard.deploy.AlreadyVersionedError(dir)

The deployment contained a .git directory but no .wizard directory.

dir

Directory of deployment

exception wizard.deploy.NotMigratedError(dir)

The deployment contains a .scripts-version file, but no .git or .wizard directory.

dir

Directory of deployment

exception wizard.deploy.NotConfiguredError(dir)

The install was missing essential configuration.

dir

Directory of unconfigured install

exception wizard.deploy.NotAutoinstallError(dir)

Application is not an autoinstall.

dir

Directory of the not autoinstall

exception wizard.deploy.CorruptedAutoinstallError(dir)

The install was missing a .git directory, but had a .wizard directory.

dir

Directory of the corrupted install

exception wizard.deploy.NoTagError(tag)

Deployment has a tag that does not have an equivalent in upstream repository.

tag

Missing tag

exception wizard.deploy.NoLocalTagError(tag)

Could not find tag in local repository.

tag

Missing tag

exception wizard.deploy.InconsistentPristineTagError(tag)

Pristine tag commit ID does not match upstream pristine tag commit ID.

tag

Inconsistent tag

exception wizard.deploy.InconsistentWizardTagError(tag)

Wizard tag commit ID does not match upstream wizard tag commit ID.

tag

Inconsistent tag

exception wizard.deploy.HeadNotDescendantError(tag)

HEAD is not connected to tag.

tag

Tag that HEAD should have been descendant of.

exception wizard.deploy.VersionDetectionError

Could not detect real version of application.

exception wizard.deploy.VersionMismatchError(real_version, git_version)

Git version of application does not match detected version.

git_version

Version from Git

real_version

Detected version

exception wizard.deploy.WebVerificationError

Could not access the application on the web

exception wizard.deploy.DatabaseVerificationError

Could not access the database

exception wizard.deploy.UnknownWebPath

Could not determine application’s web path.

Table Of Contents

Previous topic

wizard.app.php

Next topic

wizard.git

This Page