Source Docs

auslib.AUS

class auslib.AUS.AUS
evaluateRules(updateQuery, transaction=None)
updates_are_disabled(product, channel, transaction=None)
class auslib.AUS.ForceResult(name, query_value)

Enumerated “result” class that represents a non-random result chosen by a caller.

auslib.AUS.getFallbackChannel(channel)
auslib.AUS.isForbiddenUrl(url, product, allowlistedDomains)
auslib.AUS.isSpecialURL(url, specialForceHosts)

auslib.blobs

class auslib.blobs.apprelease.DesupportBlob(**kwargs)

This blob is used to inform users that their OS is no longer supported. This is available on the client side since Firefox 24 (bug 843497).

The XML should look like this (whitespace for clarity & consistency only):

<?xml version="1.0"?>
<updates>
    <update type="major" unsupported="true" detailsURL="http://moreinfo">
    </update>
</updates>
containsForbiddenDomain(product, allowlistedDomains)
getInnerFooterXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerHeaderXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
jsonschema = 'desupport.yml'
shouldServeUpdate(updateQuery)

Should be implemented by subclasses. In the event that it’s not, False is the safest thing to return (it will fail closed instead of failing open).

class auslib.blobs.apprelease.MultipleUpdatesXMLMixin
class auslib.blobs.apprelease.NewStyleVersionsMixin
getAppVersion(platform, locale)
getApplicationVersion(platform, locale)

For v2 schema, appVersion really is the app version

getDisplayVersion(platform, locale)
getPlatformVersion(platform, locale)
class auslib.blobs.apprelease.ProofXMLMixin
class auslib.blobs.apprelease.ReleaseBlobBase(**kwargs)
containsForbiddenDomain(product, allowlistedDomains)

Returns True if the blob contains any file URLs that contain a domain that we’re not allowed to serve updates to.

getBuildID(platform, locale)
getInnerFooterXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerHeaderXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)

This method, along with getHeaderXML and getFooterXML are the entry point for update XML creation for all Gecko app blobs. However, the XML and underlying data has changed over time, so there is a lot of indirection and calls factored out to subclasses. Below is a brief description of the flow of control that should help in understanding this code. Inner methods that are shared between blob versions live in Mixin classes so that they can be easily shared. Inner methods that only apply to a single blob version live on concrete blob classes (but should be moved if they need to be shared in the future).

  • getInnerXML, getFooterXML and getHeaderXML called by web layer, live on this base class. The V1 blob class override them to support bug 1113475, but still calls the base class one to do most of the work.

  • _getUpdateLineXML() called to get information that is independent of specific MARs. Most notably, version information changed starting with V2 blobs.

  • _getPatchesXML() called to get the information that describes specific MARs. Where in the blob this information comes from changed significantly starting with V3 blobs.

    • _getSpecificPatchXML() called to translate MAR information into XML. This transformation in blob version independent, so it lives on the base class to avoid duplication.

    • _getUrl() called to figure out what the MAR URL is for a specific patch. This changed starting with V4 blobs. V3 and earlier use SeparatedFileUrlsMixin, V4 and later use UnifiedFileUrlsMixin.

    • _getFtpFilename/_getBouncerProduct called to substitute some paths with real information. This is another part of the blob format that changed starting with V3 blobs. It was later deprecated in V4 and thus not used for UnifiedFileUrlsMixin blobs.

getLocaleData(platform, locale)
getLocaleOrTopLevelParam(platform, locale, param)
getPlatformData(platform)
getResolvedPlatform(platform)
matchesUpdateQuery(updateQuery, aliases={})
processSpecialForceHosts(url, specialForceHosts, force_arg)
shouldServeUpdate(updateQuery)

Should be implemented by subclasses. In the event that it’s not, False is the safest thing to return (it will fail closed instead of failing open).

class auslib.blobs.apprelease.ReleaseBlobV1(**kwargs)

This is the legacy format for apps based on Gecko 1.8.0 to 1.9.2, which translates to

  • Firefox 1.5 to 3.6.x

  • Thunderbird 1.5 to 3.1.y

It was deprecated by https://bugzilla.mozilla.org/show_bug.cgi?id=530872 during Gecko 2.0 development (aka 1.9.3).

createSnippets(updateQuery, update_type, allowlistedDomains, specialForceHosts)
getApplicationVersion(platform, locale)

We used extv as the application version for v1 schema, while appv may have been a pretty version for users to see

getAppv(platform, locale)
getExtv(platform, locale)
getInnerHeaderXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)

In order to update some older versions of Firefox without prompting them for add-on compatibility, we need to be able to modify the appVersion and extVersion attributes. bug 998721 and bug 1174605 have additional background on this. It would be nicer to do this in _getUpdateLineXML to avoid overriding this method, but that doesn’t have access to the updateQuery to lookup the version making the request.

getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

jsonschema = 'apprelease-v1.yml'
class auslib.blobs.apprelease.ReleaseBlobV2(**kwargs)

Compatible with Gecko 1.9.3a3 and above, ie Firefox/Thunderbird 4.0 and above.

Client-side changes in https://bugzilla.mozilla.org/show_bug.cgi?id=530872 renamed or introduced several attributes in update.xml

Changed parameters from ReleaseBlobV1:
  • appv, extv become appVersion, platformVersion, displayVersion

Added:
  • actions, billboardURL, openURL, notificationURL, alertURL, showPrompt, showNeverForVersion, isOSUpdate

Removed:
  • oldVersionSpecialCases

createSnippets(updateQuery, update_type, allowlistedDomains, specialForceHosts)
getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

interpolable_ = ('billboardURL', 'openURL', 'notificationURL', 'alertURL')
jsonschema = 'apprelease-v2.yml'
optional_ = ('billboardURL', 'showPrompt', 'showNeverForVersion', 'actions', 'openURL', 'notificationURL', 'alertURL')
class auslib.blobs.apprelease.ReleaseBlobV3(**kwargs)

Compatible with Gecko 1.9.3a3 and above, ie Firefox/Thunderbird 4.0 and above.

This is an internal change to add functionality to Balrog.

Changes from ReleaseBlobV2:
  • support multiple partials

    • remove “partial” and “complete” from locale level

    • add “partials” and “completes” to locale level, ftpFilenames, and bouncerProducts

createSnippets(updateQuery, update_type, allowlistedDomains, specialForceHosts)
getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

interpolable_ = ('billboardURL', 'openURL', 'notificationURL', 'alertURL')
jsonschema = 'apprelease-v3.yml'
optional_ = ('billboardURL', 'showPrompt', 'showNeverForVersion', 'actions', 'openURL', 'notificationURL', 'alertURL')
class auslib.blobs.apprelease.ReleaseBlobV4(**kwargs)

Compatible with Gecko 1.9.3a3 and above, ie Firefox/Thunderbird 4.0 and above.

This is an internal change to add functionality to Balrog.

Changes from ReleaseBlobV3:
  • Support pushing release builds to the beta channel with bouncer support (bug 1021026)

    • Combine fileUrls, bouncerProducts, and ftpFilenames into a larger data structure, still called “fileUrls”. (See below for a more detailed description.)

classmethod fromV3(v3Blob)

Creates a v4 blob based on the v3 blob given.

getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

interpolable_ = ('billboardURL', 'openURL', 'notificationURL', 'alertURL')
jsonschema = 'apprelease-v4.yml'
optional_ = ('billboardURL', 'showPrompt', 'showNeverForVersion', 'actions', 'openURL', 'notificationURL', 'alertURL')
class auslib.blobs.apprelease.ReleaseBlobV5(**kwargs)

Compatible with Gecko 19.0 and above, ie Firefox/Thunderbird 19.0 and above.

Driven by a client-side change made in

https://bugzilla.mozilla.org/show_bug.cgi?id=813322

Changes from ReleaseBlobV4:
  • Support optional promptWaitTime attribute

getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

interpolable_ = ('billboardURL', 'openURL', 'notificationURL', 'alertURL')
jsonschema = 'apprelease-v5.yml'
optional_ = ('billboardURL', 'showPrompt', 'showNeverForVersion', 'actions', 'openURL', 'notificationURL', 'alertURL', 'promptWaitTime')
class auslib.blobs.apprelease.ReleaseBlobV6(**kwargs)

Compatible with Gecko 51.0 and above, ie Firefox/Thunderbird 51.0 and above.

Changes from ReleaseBlobV5:
  • Removes support for platformVersion, billboardURL, licenseURL, version, and extensionVersion

For further information:
getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

interpolable_ = ('openURL', 'notificationURL', 'alertURL')
jsonschema = 'apprelease-v6.yml'
optional_ = ('showPrompt', 'showNeverForVersion', 'actions', 'openURL', 'notificationURL', 'alertURL', 'promptWaitTime')
class auslib.blobs.apprelease.ReleaseBlobV8(**kwargs)

Compatible with Gecko 51.0 and above, ie Firefox/Thunderbird 51.0 and above.

Changes from ReleaseBlobV6:
  • Adds support for ProofXMLMixin (placed as first parameter for inheritance preference)

For further information:
getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

interpolable_ = ('openURL', 'notificationURL', 'alertURL')
jsonschema = 'apprelease-v8.yml'
optional_ = ('showPrompt', 'showNeverForVersion', 'actions', 'openURL', 'notificationURL', 'alertURL', 'promptWaitTime', 'binTransMerkleRoot', 'binTransCertificate', 'binTransSCTList')
class auslib.blobs.apprelease.ReleaseBlobV9(**kwargs)

Compatible with Gecko 51.0 and above, ie Firefox/Thunderbird 51.0 and above.

Changes from ReleaseBlobV8:
  • Moved most <update> properties into new updateLine data structure

For further information:
getApplicationVersion(platform, locale)
getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

interpolable_ = ('openURL', 'notificationURL', 'alertURL', 'detailsURL')
jsonschema = 'apprelease-v9.yml'
validate(*args, **kwargs)

Raises a BlobValidationError if the blob is invalid.

class auslib.blobs.apprelease.SeparatedFileUrlsMixin
class auslib.blobs.apprelease.SingleUpdateXMLMixin
class auslib.blobs.apprelease.UnifiedFileUrlsMixin
class auslib.blobs.base.Blob(*args, **kwargs)
containsForbiddenDomain(product, allowlistedDomains)
getJSON()

Returns a JSON formatted version of this blob.

getReferencedReleases()
Returns

Returns set of names of partially referenced releases that the current release references

getSchema()
jsonschema = None
loadJSON(data)

Replaces this blob’s contents with parsed contents of the json string provided.

shouldServeUpdate(updateQuery)

Should be implemented by subclasses. In the event that it’s not, False is the safest thing to return (it will fail closed instead of failing open).

validate(product, allowlistedDomains)

Raises a BlobValidationError if the blob is invalid.

class auslib.blobs.base.GenericBlob(*args, **kwargs)
getResponse()
class auslib.blobs.base.XMLBlob(*args, **kwargs)
getFooterXML()
Returns

Returns the outer most footer. Returns the outer most header

getHeaderXML()
Returns

Returns the outer most header. Returns the outer most header

getInnerFooterXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerHeaderXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
getResponseBlobs()
Returns

Usually returns None. It the Blob is a systemaddons superblob, it returns the list of return blobs

getResponseProducts()
Returns

Usually returns None. If the Blob is a SuperBlob, it returns the list of return products.

auslib.blobs.base.createBlob(data)

Takes a string form of a blob (eg from DB or API) and converts into an actual blob, taking care to notice the schema

auslib.blobs.base.merge_dicts(ancestor, left, right)

Perform a 3-way merge on dictonaries. We used to use an external library for this, but we replaced it with this because our merge can be a bit more liberal than the general case. Specifically:

  • Lists are treated as sets (see above for details)

  • A type mismatch of unicode vs string is OK as long as the text is the same (Any other type mismatches result in a failure to merge.)

auslib.blobs.base.merge_lists(*lists)

Merge an arbitrary number of lists together, keeping only the unique items, and not worrying about order. This is essentially a hack to treat lists in blobs as sets. In an ideal world, that’s what they’d be, but because we use jsonschema for validation, we cannot use proper sets.

class auslib.blobs.gmp.GMPBlobV1(**kwargs)
containsForbiddenDomain(product, allowlistedDomains)

Returns True if the blob contains any file URLs that contain a domain that we’re not allowed to serve updates to.

getInnerFooterXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerHeaderXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
getPlatformData(vendor, platform)
getResolvedPlatform(vendor, platform)
getVendorsForPlatform(platform)
jsonschema = 'gmp.yml'
shouldServeUpdate(updateQuery)

Should be implemented by subclasses. In the event that it’s not, False is the safest thing to return (it will fail closed instead of failing open).

validate(product, allowlistedDomains)

Raises a BlobValidationError if the blob is invalid.

class auslib.blobs.guardian.GuardianBlob(*args, **kwargs)
containsForbiddenDomain(product, allowlistedDomains)
getResponse(updateQuery, allowlistedDomains)
jsonschema = 'guardian.yml'
shouldServeUpdate(updateQuery)

Should be implemented by subclasses. In the event that it’s not, False is the safest thing to return (it will fail closed instead of failing open).

class auslib.blobs.superblob.SuperBlob(**kwargs)
containsForbiddenDomain(product, allowlistedDomains)
getInnerFooterXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerHeaderXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Header specific to GMP and systemaddons superblob

getResponseBlobs()
Returns

Blob names in case of systemaddon Blobs

getResponseProducts()
Returns

Product in case of GMP supreblob

jsonschema = 'superblob.yml'
shouldServeUpdate(updateQuery)

Should be implemented by subclasses. In the event that it’s not, False is the safest thing to return (it will fail closed instead of failing open).

class auslib.blobs.systemaddons.SystemAddonsBlob(**kwargs)
containsForbiddenDomain(product, allowlistedDomains)

Returns True if the blob contains any file URLs that contain a domain that we’re not allowed to serve updates to.

getAddonsForPlatform(platform)
getInnerFooterXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerHeaderXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
Returns

Releases-specific header should be implemented for individual blobs

getInnerXML(updateQuery, update_type, allowlistedDomains, specialForceHosts)
getPlatformData(addon, platform)
getResolvedPlatform(addon, platform)
hasUpdates(updateQuery, allowlistedDomains)
jsonschema = 'systemaddons.yml'
shouldServeUpdate(updateQuery)

Should be implemented by subclasses. In the event that it’s not, False is the safest thing to return (it will fail closed instead of failing open).

auslib.config

class auslib.config.AUSConfig(filename)
getCaches()
getDburi()
getDomainAllowlist()
getLogLevel()
getLogfile()
loglevels = {'CRITICAL': 50, 'DEBUG': 10, 'ERROR': 40, 'INFO': 20, 'WARNING': 30}
required_options = {'database': ['dburi'], 'logging': ['logfile']}
validate()
class auslib.config.AdminConfig(filename)
getPageTitle()
getSecretKey()
getSystemAccounts()
required_options = {'app': ['secret_key'], 'database': ['dburi'], 'logging': ['logfile'], 'site-specific': ['page_title']}
class auslib.config.ClientConfig(filename)
getSpecialForceHosts()

auslib.db

class auslib.db.AUSDatabase(dburi=None, mysql_traditional_mode=False, releases_history_buckets=None, releases_history_class=<class 'auslib.db.GCSHistory'>, async_releases_history_class=<class 'auslib.db.GCSHistoryAsync'>)
begin()
create(version=None)
property dockerflow
downgrade(version)
property emergencyShutoffs
engine = None
getUserRoles(*args, **kwargs)
hasPermission(*args, **kwargs)
hasRole(*args, **kwargs)
isAdmin(*args, **kwargs)
isKnownUser(username)
migrate_repo = '/home/docs/checkouts/readthedocs.org/user_builds/mozilla-balrog/checkouts/latest/src/auslib/migrate'
property permissions
property permissionsRequiredSignoffs
property productRequiredSignoffs
property release_assets
property releases
property releases_json
reset()
property rules
setDburi(dburi, mysql_traditional_mode=False, releases_history_buckets=None, releases_history_class=<class 'auslib.db.GCSHistory'>, async_releases_history_class=<class 'auslib.db.GCSHistoryAsync'>)

Setup the database connection. Note that SQLAlchemy only opens a connection to the database when it needs to, however.

setDomainAllowlist(domainAllowlist)
setSystemAccounts(systemAccounts)
setupChangeMonitors(relayhost, port, username, password, to_addr, from_addr, use_tls=False, notify_tables=None)
upgrade(version=None)
class auslib.db.AUSTable(db, dialect, historyClass=None, historyKwargs={}, versioned=True, scheduled_changes=False, scheduled_changes_kwargs={}, onInsert=None, onUpdate=None, onDelete=None)

Base class for all AUS Tables. By default, all tables have a history table created for them, too, which mirrors their own structure and adds a record of who made a change, and when the change happened.

Parameters
  • history (bool) – Whether or not to create a history table for this table. When True, a History object will be created for this table, and all changes will be logged to it. Defaults to True.

  • versioned (bool) – Whether or not this table is versioned. When True, an additional ‘data_version’ column will be added to the Table, and its version increased with every update. This is useful for detecting colliding updates.

  • scheduled_changes (bool) – Whether or not this table should allow changes to be scheduled. When True, two additional tables will be created: a $name_scheduled_changes, which will contain data needed to schedule changes to $name, and $name_scheduled_changes_history, which tracks the history of a scheduled change.

  • onInsert (callable) –

    A callback that will be called whenever an insert is made to the table. It must accept the following 4 parameters:

    • The table object the query is being performed on

    • The type of query being performed (eg: INSERT)

    • The name of the user making the change

    • The query object that will be execeuted

    If the callback raises an exception the change will be aborted.

  • onDelete (callable) – See onInsert

  • onUpdate (callable) – See onInsert

async async_delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

async async_insert(changed_by=None, transaction=None, dryrun=False, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

async async_update(where, what, changed_by=None, old_data_version=None, transaction=None, dryrun=False)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

count(column='*', where=None, transaction=None)
delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getEngine()
getRecentChanges(limit=10, transaction=None)
insert(changed_by=None, transaction=None, dryrun=False, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

select(where=None, transaction=None, **kwargs)

Perform a SELECT statement on this table. See AUSTable._selectStatement for possible arguments.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

Return type

sqlalchemy.engine.base.ResultProxy

update(where, what, changed_by=None, old_data_version=None, transaction=None, dryrun=False)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

class auslib.db.AUSTransaction(engine)

Manages a single transaction. Requires a connection object.

Parameters

conn (sqlalchemy.engine.base.Connection) – connection object to perform the transaction on

close()
commit()
execute(statement)
rollback()
exception auslib.db.AlreadySetupError
auslib.db.BlobColumn(impl=<class 'sqlalchemy.sql.sqltypes.Text'>)

BlobColumns are used to store Release Blobs, which are ultimately dicts. Release Blobs must be serialized before storage, and deserialized upon retrevial. This type handles both conversions. Some database engines (eg: mysql) may require a different underlying type than Text. The desired type may be passed in as an argument.

exception auslib.db.ChangeScheduledError(*arg, **kw)

Raised when a Scheduled Change cannot be created, modified, or deleted for data consistency reasons.

class auslib.db.CompatibleBooleanColumn(*args, **kwargs)

A Boolean column that is compatible with all of our supported database engines (mysql, sqlite). SQLAlchemy’s built-in Boolean does not work because it creates a CHECK constraint that makes it impossible to downgrade a database with sqlalchemy-migrate.

impl

alias of sqlalchemy.sql.sqltypes.Integer

process_bind_param(value, dialect)

Receive a bound parameter value to be converted.

Subclasses override this method to return the value that should be passed along to the underlying TypeEngine object, and from there to the DBAPI execute() method.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

This operation should be designed with the reverse operation in mind, which would be the process_result_value method of this class.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

process_result_value(value, dialect)

Receive a result-row column value to be converted.

Subclasses should implement this method to operate on data fetched from the database.

Subclasses override this method to return the value that should be passed back to the application, given a value that is already processed by the underlying TypeEngine object, originally from the DBAPI cursor method fetchone() or similar.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

This operation should be designed to be reversible by the “process_bind_param” method of this class.

class auslib.db.ConditionsTable(db, dialect, metadata, baseName, conditions, historyClass=<class 'auslib.db.HistoryTable'>)
condition_groups = {'time': ('when',), 'uptake': ('telemetry_product', 'telemetry_channel', 'telemetry_uptake')}
validate(conditions)
class auslib.db.Dockerflow(db, metadata, dialect)
getDockerflowEntry(transaction=None)
incrementWatchdogValue(changed_by, transaction=None, dryrun=False)
class auslib.db.EmergencyShutoffs(db, metadata, dialect)
delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False, signoffs=None)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getPotentialRequiredSignoffs(affected_rows, transaction=None)
insert(changed_by, transaction=None, dryrun=False, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

class auslib.db.GCSHistory(db, dialect, metadata, baseTable, buckets, identifier_columns, data_column)
forDelete(rowData, changed_by, trans)
forInsert(insertedKeys, columns, changed_by, trans)
forUpdate(rowData, changed_by, trans)
getChange(change_id=None, column_values=None, data_version=None, transaction=None)
class auslib.db.GCSHistoryAsync(db, dialect, metadata, baseTable, buckets, identifier_columns, data_column)
async forDelete(rowData, changed_by, trans)
async forInsert(insertedKeys, columns, changed_by, trans)
async forUpdate(rowData, changed_by, trans)
class auslib.db.HistoryTable(db, dialect, metadata, baseTable)

Represents a history table that may be attached to another AUSTable. History tables mirror the structure of their baseTable, with the exception that nullable and primary_key attributes are always overwritten to be True and False respectively. Additionally, History tables have a unique change_id for each row, and record the username making a change, and the timestamp of each change. The methods forInsert, forDelete, and forUpdate will generate appropriate INSERTs to the History table given appropriate inputs, and are documented below. History tables are never versioned, and cannot have history of their own.

forDelete(rowData, changed_by, trans)

Deletes cause a single row to be created, which only contains the primary key data. This represents that the row no longer exists.

forInsert(insertedKeys, columns, changed_by, trans)

Inserts cause two rows in the History table to be created. The first one records the primary key data and NULLs for other row data. This represents that the row did not exist prior to the insert. The timestamp for this row is 1 millisecond behind the real timestamp to reflect this. The second row records the full data of the row at the time of insert.

forUpdate(rowData, changed_by, trans)

Updates cause a single row to be created, which contains the full, new data of the row at the time of the update.

getChange(change_id=None, column_values=None, data_version=None, transaction=None)

Returns the unique change that matches the give change_id or combination of data_version and values for the specified columns. column_values is a dict that contains the column names that are versioned and their values. Ignores non primary key attributes specified in column_values.

getPointInTime(timestamp, transaction=None)
class auslib.db.JSONColumn(*args, **kwargs)

JSONColumns are used for types that are deserialized JSON (usually dicts) in memory, but need to be serialized to text before storage. JSONColumn handles the conversion both ways, serialized just before storage, and deserialized just after retrieval.

impl

alias of sqlalchemy.sql.sqltypes.Text

process_bind_param(value, dialect)

Receive a bound parameter value to be converted.

Subclasses override this method to return the value that should be passed along to the underlying TypeEngine object, and from there to the DBAPI execute() method.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

This operation should be designed with the reverse operation in mind, which would be the process_result_value method of this class.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

process_result_value(value, dialect)

Receive a result-row column value to be converted.

Subclasses should implement this method to operate on data fetched from the database.

Subclasses override this method to return the value that should be passed back to the application, given a value that is already processed by the underlying TypeEngine object, originally from the DBAPI cursor method fetchone() or similar.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

This operation should be designed to be reversible by the “process_bind_param” method of this class.

exception auslib.db.MismatchedDataVersionError(*arg, **kw)

Raised when the data version of a scheduled change and its associated conditions row do not match after an insert or update.

exception auslib.db.OutdatedDataError(*arg, **kw)

Raised when an update or delete fails because of outdated data.

class auslib.db.Permissions(db, metadata, dialect)

allPermissions defines the structure and possible options for all available permissions. Permissions can be limited to specific types of actions. Eg: granting the “rule” permission with “actions” set to [“create”] allows rules to be created but not modified or deleted. Permissions that relate to rules or releases can be further limited by product. Eg: granting the “release” permission with “products” set to [“GMP”] allows the user to modify GMP releases, but not Firefox.

allPermissions = {'admin': ['products'], 'emergency_shutoff': ['actions', 'products'], 'permission': ['actions'], 'release': ['actions', 'products'], 'release_locale': ['actions', 'products'], 'release_read_only': ['actions', 'products'], 'required_signoff': ['products'], 'rule': ['actions', 'products'], 'scheduled_change': ['actions']}
assertOptionsExist(permission, options)
assertPermissionExists(permission)
countAllUsers(transaction=None)
delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False, signoffs=None)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getAllPermissions(transaction=None)
getAllUsers(transaction=None)
getOptions(username, permission, transaction=None)
getPermission(username, permission, transaction=None)
getPotentialRequiredSignoffs(affected_rows, transaction=None)
getUserPermissions(username, retrieving_as, transaction=None)
getUserRoles(username, transaction=None)
grantRole(username, role, changed_by, transaction=None)
hasPermission(username, thing, action, product=None, transaction=None)
hasRole(username, role, transaction=None)
insert(changed_by, transaction=None, dryrun=False, signoffs=None, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

isAdmin(username, transaction=None)
isKnownUser(username)
revokeRole(username, role, changed_by=None, old_data_version=None, transaction=None)
update(where, what, changed_by, old_data_version, transaction=None, dryrun=False, signoffs=None)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

class auslib.db.PermissionsRequiredSignoffsTable(db, metadata, dialect)
decisionColumns = ['product']
class auslib.db.ProductRequiredSignoffsTable(db, metadata, dialect)
decisionColumns = ['product', 'channel']
class auslib.db.ReleaseAssets(db, metadata, dialect, history_buckets, historyClass)
async async_delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False, signoffs=None)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

async async_insert(changed_by, transaction=None, dryrun=False, signoffs=None, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

async async_update(where, what, changed_by, old_data_version, transaction=None, dryrun=False, signoffs=None)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getPotentialRequiredSignoffs(affected_rows, transaction=None)
class auslib.db.Releases(db, metadata, dialect, history_buckets, historyClass)
addLocaleToRelease(name, product, platform, locale, data, old_data_version, changed_by, transaction=None, alias=None)

Adds or update’s the existing data for a specific platform + locale combination, in the release identified by ‘name’. The data is validated before commiting it, and a ValueError is raised if it is invalid.

change_readonly(where, is_readonly, changed_by, old_data_version, transaction=None)
delete(where, changed_by, old_data_version, transaction=None, dryrun=False, signoffs=None)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getLocale(name, platform, locale, transaction=None)
getPotentialRequiredSignoffs(affected_rows, transaction=None)
getPotentialRequiredSignoffsForProduct(product, transaction=None)
getReleaseBlob(name, transaction=None)
getReleaseInfo(names=None, product=None, limit=None, transaction=None, nameOnly=False, name_prefix=None)
getReleaseNames(**kwargs)
getReleases(name=None, product=None, limit=None, transaction=None)
insert(changed_by, transaction=None, dryrun=False, signoffs=None, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

isMappedTo(name, transaction=None)
isReadOnly(name, limit=None, transaction=None)
localeExists(name, platform, locale, transaction=None)
setDomainAllowlist(domainAllowlist)
update(where, what, changed_by, old_data_version, transaction=None, dryrun=False, signoffs=None)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

validate_readonly_change(where, new_readonly_state, changed_by, release=None, transaction=None, dryrun=False, signoffs=None)
class auslib.db.ReleasesJSON(db, metadata, dialect, history_buckets, historyClass)
async async_delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False, signoffs=None)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

async async_insert(changed_by, transaction=None, dryrun=False, signoffs=None, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

async async_update(where, what, changed_by, old_data_version, transaction=None, dryrun=False, signoffs=None)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getPotentialRequiredSignoffs(affected_rows, transaction=None)
getPotentialRequiredSignoffsForProduct(product, transaction=None)
class auslib.db.RequiredSignoffsTable(db, dialect)

RequiredSignoffsTables store and validate information about what types and how many signoffs are required for the data provided in decisionColumns. Subclasses are required to create a Table with the necessary columns, and add those columns names to decisionColumns. When changes are made to a RequiredSignoffsTable, it will look at its own rows to determine whether or not that change needs signoff.

decisionColumns = []
delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False, signoffs=None)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getPotentialRequiredSignoffs(affected_rows, transaction=None)
insert(changed_by, transaction=None, dryrun=False, signoffs=None, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

update(where, what, changed_by, old_data_version, transaction=None, dryrun=False, signoffs=None)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

validate(columns, transaction=None)
class auslib.db.Rules(db, metadata, dialect)
delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False, signoffs=None)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

getOrderedRules(where=None, transaction=None)

Returns all of the rules, sorted in ascending order

getPotentialRequiredSignoffs(affected_rows, transaction=None)
getRule(id_or_alias, transaction=None)

Returns the unique rule that matches the give rule_id or alias.

getRulesMatchingQuery(updateQuery, fallbackChannel, transaction=None)

Returns all of the rules that match the given update query. For cases where a particular updateQuery channel has no fallback, fallbackChannel should match the channel from the query.

insert(changed_by, transaction=None, dryrun=False, signoffs=None, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

update(where, what, changed_by, old_data_version, transaction=None, dryrun=False, signoffs=None)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

class auslib.db.ScheduledChangeTable(db, dialect, metadata, baseTable, conditions=('time', 'uptake'), historyClass=<class 'auslib.db.HistoryTable'>)

A Table that stores the necessary information to schedule changes to the baseTable provided. A ScheduledChangeTable ends up mirroring the columns of its base, and adding the necessary ones to provide the schedule. By default, ScheduledChangeTables enable History on themselves.

async asyncEnactChange(sc_id, enacted_by, transaction=None)

Enacts a previously scheduled change by running update, insert, or delete on the base table.

auto_signoff(changed_by, transaction, sc_id, dryrun, columns)
delete(where, changed_by=None, old_data_version=None, transaction=None, dryrun=False)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

enactChange(sc_id, enacted_by, transaction=None)

Enacts a previously scheduled change by running update, insert, or delete on the base table.

insert(changed_by, transaction=None, dryrun=False, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

mergeUpdate(old_row, what, changed_by, transaction=None)

Merges an update to the base table into any changes that may be scheduled for the affected row. If the changes are unmergable (meaning: the scheduled change and the new version of the row modify the same columns), an UpdateMergeError is raised.

select(where=None, transaction=None, **kwargs)

Perform a SELECT statement on this table. See AUSTable._selectStatement for possible arguments.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

Return type

sqlalchemy.engine.base.ResultProxy

update(where, what, changed_by, old_data_version, transaction=None, dryrun=False)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

validate(base_columns, condition_columns, changed_by, sc_id=None, transaction=None)
class auslib.db.SetSqlMode
connect(dbapi_con, connection_record)

Called once for each new DB-API connection or Pool’s creator().

dbapi_con

A newly connected raw DB-API connection (not a SQLAlchemy Connection wrapper).

con_record

The _ConnectionRecord that persistently manages the connection

class auslib.db.SignoffsTable(db, metadata, dialect, baseName)
delete(where, changed_by=None, transaction=None, dryrun=False, reset_signoff=False)

Perform a DELETE statement on this table. See AUSTable._deleteStatement for a description of where. To simplify versioning, this method can only delete a single row per invocation. If the where clause given would delete zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • changed_by (str) – The username of the person deleting the row(s). Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the delete statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

insert(changed_by=None, transaction=None, dryrun=False, **columns)

Perform an INSERT statement on this table. See AUSTable._insertStatement for a description of columns.

Parameters
  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • transaction – A transaction object to add the insert statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

update(where, what, changed_by=None, transaction=None, dryrun=False)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

exception auslib.db.TransactionError(*arg, **kw)

Raised when a transaction fails for any reason.

class auslib.db.UTF8PrettyPrinter(indent=1, width=80, depth=None, stream=None, *, compact=False, sort_dicts=True)

Encodes strings as UTF-8 before printing to avoid ugly u’’ style prints. Adapted from http://stackoverflow.com/questions/10883399/unable-to-encode-decode-pprint-output

format(object, context, maxlevels, level)

Format object for a specific context, returning a string and flags indicating whether the representation is ‘readable’ and whether the object represents a recursive construct.

class auslib.db.UnquotedStr
exception auslib.db.UpdateMergeError(*arg, **kw)
class auslib.db.UserRoles(db, metadata, dialect)
update(where, what, changed_by, old_data_version, transaction=None, dryrun=False)

Perform an UPDATE statement on this table. See AUSTable._updateStatement for a description of where and what. This method can only update a single row per invocation. If the where clause given would update zero or multiple rows, a WrongNumberOfRowsError is raised.

Parameters
  • where (list of clauses or key/value pairs.) – A list of SQLAlchemy clauses, or a key/value pair of columns and values.

  • what (key/value pairs) – Key/value pairs containing new values for the given columns.

  • changed_by (str) – The username of the person inserting the row. Required when history is enabled. Unused otherwise. No authorization checks are done at this level.

  • old_data_version (int) – Previous version of the row to be deleted. If this version doesn’t match the current version of the row, an OutdatedDataError will be raised and the delete will fail. Required when versioning is enabled.

  • transaction – A transaction object to add the update statement (and history changes) to. If provided, you must commit the transaction yourself. If None, they will be added to a locally-scoped transaction and committed.

  • dryrun (bool) – If true, this insert statement will not actually be run.

Return type

sqlalchemy.engine.base.ResultProxy

exception auslib.db.WrongNumberOfRowsError(*arg, **kw)

Raised when an update or delete fails because the clause matches more than one row.

auslib.db.generate_random_string(length)
auslib.db.make_change_notifier(relayhost, port, username, password, to_addr, from_addr, use_tls)
auslib.db.make_change_notifier_for_read_only(relayhost, port, username, password, to_addr, from_addr, use_tls)
auslib.db.rows_to_dicts(rows)

Converts SQL Alchemy result rows to dicts.

You might want this if you want to mutate objects (SQLAlchemy rows are immutable), or if you want to serialize them to JSON (SQLAlchemy rows get confused if you try to serialize them).

auslib.db.send_email(relayhost, port, username, password, to_addr, from_addr, table, subj, body, use_tls)
auslib.db.verify_signoffs(potential_required_signoffs, signoffs)

Determines whether or not something is signed off given: * A list of potential required signoffs * A list of signoffs that have been made

The real number of signoffs required is found by looking through the potential required signoffs and finding the highest number required for each role. If there are not enough signoffs provided for any of the groups, a SignoffRequiredError is raised.

auslib.dockerflow

auslib.dockerflow.create_dockerflow_endpoints(app, heartbeat_database_fn=<function _heartbeat_database_fn>)

Wrapper that creates the endpoints required by CloudOps’ Dockerflow spec: https://github.com/mozilla-services/Dockerflow. This gets used by both the admin and public apps. :param heartbeat_database_fn: Function that calls the database when reponding to /__heartbeat__. A database object is passed to this function.

If heartbeat_database_fn is None, a default function is be set. The default function writes in a dummy table. Even though we respond to GET, we do insert/update something in the database. This allows us to see if the connection to the database exists, is active, and if the credentials given are the correct ones. For more context see bug 1289178.

auslib.dockerflow.get_version(version_file)
auslib.dockerflow.heartbeat_response(heartbeat_database_fn)

Per the Dockerflow spec: Respond to /__heartbeat__ with a HTTP 200 or 5xx on error. This should depend on services like the database to also ensure they are healthy.

auslib.dockerflow.lbheartbeat_response()

Per the Dockerflow spec: Respond to /__lbheartbeat__ with an HTTP 200. This is for load balancer checks and should not check any dependent services.

auslib.errors

exception auslib.errors.BadDataError

Raised when a client sends data that appears to be invalid.

exception auslib.errors.BlobValidationError(message, errors, *args, **kwargs)
exception auslib.errors.PermissionDeniedError
exception auslib.errors.ReadOnlyError

Raised when a release marked as read-only is attempted to be changed.

exception auslib.errors.SignoffRequiredError

Raised when someone attempts to directly modify an object that requires signoff.

auslib.global_state

class auslib.global_state.DbWrapper
setDb(dburi, releases_history_buckets=None, releases_history_class=None, async_releases_history_class=None)

auslib.log

class auslib.log.BalrogLogger(name, level=0)
makeRecord(name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)

A factory method which can be overridden in subclasses to create specialized LogRecords.

class auslib.log.JsonLogFormatter(fmt=None, datefmt=None, logger_name='Balrog')

Log formatter that outputs machine-readable json.

This log formatter outputs JSON format messages that are compatible with Mozilla’s standard heka-based log aggregation infrastructure.

See also: https://mana.mozilla.org/wiki/display/CLOUDSERVICES/Logging+Standard https://mana.mozilla.org/wiki/pages/viewpage.action?pageId=42895640

Adapted from: https://github.com/mozilla-services/mozservices/blob/master/mozsvc/util.py#L106

DEFAULT_SYSLOG_LEVEL = 200
EXCLUDED_LOGRECORD_ATTRS = {'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename', 'funcName', 'levelname', 'levelno', 'lineno', 'message', 'module', 'msecs', 'msg', 'name', 'pathname', 'process', 'processName', 'relativeCreated', 'stack_info', 'thread', 'threadName'}
LOGGING_FORMAT_VERSION = '2.0'
SYSLOG_LEVEL_MAP = {10: 100, 20: 200, 30: 400, 40: 500, 50: 600}
format(record)

Map from Python LogRecord attributes to JSON log format fields

auslib.log.configure_logging(stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, formatter=<class 'auslib.log.JsonLogFormatter'>, format_='%(asctime)s - %(levelname)s - PID: %(process)s - Request: %(requestid)s - %(name)s.%(funcName)s#%(lineno)s: %(message)s', level=10)
auslib.log.safer_format_traceback(exc_typ, exc_val, exc_tb)

Format an exception traceback into safer string. We don’t want to let users write arbitrary data into our logfiles, which could happen if they e.g. managed to trigger a ValueError with a carefully-crafted payload. This function formats the traceback using “%r” for the actual exception data, which passes it through repr() so that any special chars are safely escaped.

auslib.util

exception auslib.util.auth.AuthError(error, status_code)
auslib.util.auth.get_access_token(request)
auslib.util.auth.get_additional_userinfo(*args, **kwargs)
auslib.util.auth.get_jwks(*args, **kwargs)
auslib.util.auth.verified_userinfo(request, auth_domain, auth_audience)
auslib.util.autograph.make_hash(content)
auslib.util.autograph.sign_hash(autograph_uri, keyid, id, key, hash)
class auslib.util.cache.MaybeCacher

MaybeCacher is a very simple wrapper to work around the fact that we have two consumers of the auslib library (admin app, non-admin app) that require cache different things. Most notably, the non-admin app caches blobs and blob versions, while the admin app only caches blobs (because blob versions can change frequently). This class is intended to be instantiated as a global object, and then have caches created by consumers through calls to make_cache. Consumers that make changes (ie: the admin app) generally also set make_copies to True to get the cache to copy values on get/put to avoid the possibility of accidental cache pollution. For performance reasons, this should be disabled when not necessary.

If the cache given to get/put/clear/invalidate doesn’t exist, these methods are essentially no-ops. In a world where bug 1109295 is fixed, we might only need to handle the caching case.

clear(name=None)
get(name, key, value_getter=None)

Returns the value of the specified key from the named cache. If value_getter is provided and no cache is found, or no value is found for the key, the return value of value_getter will be returned instead.

invalidate(name, key)
make_cache(name, maxsize, timeout)
property make_copies
put(name, key, value)
reset()
auslib.util.comparison.either_eq(value, operand)

The order of eq matters with GlobVersion; test both orders.

Nightly: because StrictVersion also compares self.prerelease,

StrictVersion(“70.0a1”) != GlobVersion(“70.*”), but GlobVersion(“70.*”) == StrictVersion(“70.0a1”)

dot-0: because StrictVersion can drop the trailing .0,

GlobVersion(“80.0.*”) != StrictVersion(“80.0.0”), but StrictVersion(“80.0.0”) == GlobVersion(“80.0.*”)

Because of this, let’s test eq in both directions.

auslib.util.comparison.get_op(pattern)
auslib.util.comparison.has_operator(value)
auslib.util.comparison.int_compare(value, compstr)

Do a int comparison of a bare int with another, which may carry a comparison operator. eg int_compare(1, ‘>2’) is False

auslib.util.comparison.string_compare(value, compstr)

Do a string comparison of a bare string with another, which may carry a comparison operator. eg string_compare(‘a’, ‘>b’) is False

auslib.util.comparison.strip_operator(value)
auslib.util.comparison.version_compare(value, compstr, versionClass=<function MozillaVersion>)

Do a version comparison between a string (representing a version), with another which may carry a comparison operator. A true version comparison is done. eg version_compare(‘1.1’, ‘>1.0’) is True

auslib.util.hashes.getHashLen(hashName)
auslib.util.jsonschema_validators.ascii_validator(field_value)
auslib.util.jsonschema_validators.background_rate_validator(field_value)
auslib.util.jsonschema_validators.data_version_validator(field_value)
auslib.util.jsonschema_validators.integer_and_range_validator(field_name, field_value, min_val=None, max_val=None)
auslib.util.jsonschema_validators.json_field_validator(field_value)
auslib.util.jsonschema_validators.operator_validator(field_value)
auslib.util.jsonschema_validators.priority_validator(field_value)
auslib.util.jsonschema_validators.rule_id_validator(field_value)
auslib.util.jsonschema_validators.sc_when_validator(field_value)
auslib.util.jsonschema_validators.signoffs_required_validator(field_value)
auslib.util.jsonschema_validators.telemetry_uptake_validator(field_value)
auslib.util.jsonschema_validators.version_validator(field_value)
auslib.util.rulematching.matchBoolean(ruleValue, queryValue)

As with all other columns, if the value isn’t present in the Rule, the Rule matches. Unlike other columns, the non-existence of a boolean field in the updateQuery evaluates to False, so we need to handle True, False, and None explicitly. Note that None in the updateQuery is treated as “unknown”, and will cause any Rule without an explicit value for the field to match. The full truth table is:

rule | query | matches?
  F      0        Y
  F      1        N
  F     null      N
  T      0        N
  T      1        Y
  T     null      N
null     0        Y
null     1        Y
null    null      Y

Additional context in https://bugzilla.mozilla.org/show_bug.cgi?id=1386756

auslib.util.rulematching.matchBuildID(ruleBuildID, queryBuildID)

Decides whether a buildID from the rules matches an incoming one. If the ruleBuildID is null, we match any queryBuildID. If it’s not null, we must either match exactly, or match with a camparison operator.

auslib.util.rulematching.matchChannel(ruleChannel, queryChannel, fallbackChannel)

Decides whether a channel from the rules matches an incoming one. If the ruleChannel is null, we match any queryChannel. We also match if the channels match exactly, or match after wildcards in ruleChannel are resolved. Channels may have a fallback specified, too, so we must check if the fallback version of the queryChannel matches the ruleChannel.

auslib.util.rulematching.matchCsv(csvString, queryString, substring=True)

Decides whether a column from a rule matches an incoming one. Some columns in a rule may specify multiple values delimited by a comma. Once split we do a full or substring match against the query string. Because we support substring matches, there’s no need to support globbing as well.

auslib.util.rulematching.matchLocale(ruleLocales, queryLocale)

Decides if a comma seperated list of locales in a rule matches an update request

auslib.util.rulematching.matchMemory(ruleMemory, queryMemory)

Decides whether a memory value from the rules matches an incoming one. If the ruleMemory is null, we match any queryMemory. If it’s not null, we must either match exactly, or match with a comparison operator.

auslib.util.rulematching.matchRegex(foo, bar)
auslib.util.rulematching.matchSimpleExpression(ruleString, queryString, substring=True)

Decides whether a column from a rule matches an incoming one using simplified boolean logic. Only two operators are supported: ‘&&’ (and), ‘,’ (or). A rule like ‘AMD,SSE’ will match incoming rules that contain either ‘AMD’ or ‘SSE’. A rule like ‘AMD&&SSE’ will only match incoming rules that contain both ‘AMD’ and ‘SSE’. This function can do substring matching or full string matching. When doing substring matching, a rule specifying ‘AMD,Windows 10’ WILL match an incoming rule such as ‘Windows 10.1.2’. When doing full string matching, a rule specifying ‘AMD,SSE’ will NOT match an incoming rule that contains ‘SSE3’, but WILL match an incoming rule that contains either ‘AMD’ or ‘SSE3’.

auslib.util.rulematching.matchSimpleExpressionSubRule(subRuleString, queryString, substring)

Performs the actual logical ‘AND’ operation on a rule as well as partial/full string matching for each section of a rule. If all parts of the subRuleString match the queryString, then we have successfully resolved the logical ‘AND’ operation and return True. Partial matching makes use of Python’s “<substring> in <string>” functionality, giving us the ability for an incoming rule to match only a substring of a rule. Full matching makes use of Python’s “<string> in <list>” functionality, giving us the ability for an incoming rule to exactly match the whole rule. Currently, incoming rules are comma-separated strings.

auslib.util.rulematching.matchVersion(ruleVersion, queryVersion, versionClass=<function MozillaVersion>)

Decides whether a version from the rules matches an incoming version. If the ruleVersion is null, we match any queryVersion. If it’s not null, we must either match exactly, or match a comparison operator.

auslib.util.thirdparty.extendsyspath()
auslib.util.timestamp.getMillisecondTimestamp()
class auslib.util.versions.AncientMozillaVersion(vstring=None)

A version class that is slightly less restrictive than StrictVersion. Instead of just allowing “a” or “b” as prerelease tags, it allows any alpha. This allows us to support the once-shipped “3.6.3plugin1” and similar versions. It also supports versions w.x.y.z by transmuting to w.x.z, which is useful for versions like 1.5.0.x and 2.0.0.y

version_re = re.compile('^(\\d+) \\. (\\d+) \\. \\d (\\. (\\d+))\n                                ([a-zA-Z]+(\\d+))?$', re.VERBOSE)
class auslib.util.versions.GlobVersion(vstring=None)

A version class that supports Firefox versions 5.0 and up, which ends with a glob *. Not really a StrictVersion at all, but it needs to be to compare with other MozillaVersions.

parse(vstring)
prerelease = None
version_re = re.compile('^(\\d+) \\. (\\d+\\.\\*|\\*)$', re.VERBOSE)
class auslib.util.versions.GlobVersionTuple(iterable=(), /)
class auslib.util.versions.ModernMozillaVersion(vstring=None)

A version class that is slightly less restrictive than StrictVersion. Instead of just allowing “a” or “b” as prerelease tags, it allows any alpha. This allows us to support the once-shipped “3.6.3plugin1” and similar versions.

version_re = re.compile('^(\\d+) \\. (\\d+) (\\. (\\d+))?\n                                ([a-zA-Z]+(\\d+))?$', re.VERBOSE)
auslib.util.versions.MozillaVersion(version)
class auslib.util.versions.PostModernMozillaVersion(vstring=None)

A version class that supports Firefox versions 5.0 and up, which may have “a1” but not “b2” tags in them

version_re = re.compile('^(\\d+) \\. (\\d+) (\\. (\\d+))?\n                                (a(\\d+))?$', re.VERBOSE)
auslib.util.versions.decrement_version(version)

Decrements a version to its ‘previous’ version by subtracting one from its last part. If the last part is 0, it is changed to 999, and the second last part is subtracted by one. This is repeated until subtraction happens or we run out of parts.

auslib.util.versions.get_version_class(product)
auslib.util.versions.get_version_parts(version)
auslib.util.versions.increment_version(version)

Increments a version to its ‘next’ version by adding one to the last part of the version.

auslib.web.admin

class auslib.web.admin.base.UnquotingMiddleware(app)
auslib.web.admin.base.add_security_headers(response)
auslib.web.admin.base.blob_validation_error(error)
auslib.web.admin.base.complete_request(response)
auslib.web.admin.base.ise(error)
auslib.web.admin.base.permission_denied_error(error)
auslib.web.admin.base.read_only_error(error)
auslib.web.admin.base.setup_request()
auslib.web.admin.base.signoff_required_error(error)
auslib.web.admin.base.unicode(error)
auslib.web.admin.base.value_error(error)
auslib.web.admin.emergency_shutoff.get_emergency_shutoff(product, channel)
auslib.web.admin.emergency_shutoff.scheduled_changes()
auslib.web.admin.emergency_shutoff.scheduled_changes_signoffs(sc_id)
auslib.web.admin.emergency_shutoff.scheduled_changes_signoffs_delete(sc_id)
auslib.web.admin.emergency_shutoff.shutoff_exists(product, channel)
class auslib.web.admin.views.base.AdminView(*args, **kwargs)
delete(**kwargs)
methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

post(**kwargs)
put(**kwargs)
auslib.web.admin.views.base.handleGeneralExceptions(messages)
auslib.web.admin.views.base.requirelogin(f)
auslib.web.admin.views.base.transactionHandler(request_handler)
class auslib.web.admin.views.history.HistoryView(table, *args, **kwargs)

Base class for history views. Provides basics operations to get all object revisions and revert object to specific revision.

@param table: Table. @type table: auslib.db.AUSTable

get_revisions(get_object_callback, history_filters_callback, revisions_order_by, process_revisions_callback=None, obj_not_found_msg='Requested object does not exist', response_key='revisions')

Get revisions for Releases, Rules or ScheduledChanges. Uses callable parameters to handle specific AUS object data.

@param get_object_callback: A callback to get requested AUS object. @type get_object_callback: callable

@param history_filters_callback: A callback that get the filters list to query the history. @type history_filters_callback: callable

@param process_revisions_callback: A callback that process revisions according to the requested AUS object. @type process_revisions_callback: callable

@param revisions_order_by: Fields list to sort history. @type revisions_order_by: list

@param obj_not_found_msg: Error message for not found AUS object. @type obj_not_found_msg: string

@param response_key: Dictionary key to wrap returned revisions. @type response_key: string

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

revert_to_revision(get_object_callback, change_field, get_what_callback, changed_by, response_message, transaction, obj_not_found_msg='Requested object does not exist')

Reverts Releases, Rules or ScheduledChanges object to specific revision. Uses callable parameters to handle specific AUS object data.

@param get_object_callback: A callback to get requested AUS object. @type get_object_callback: callable

@param change_field: Specific table field to match revision. @type change_field: string

@param get_what_callback: Criteria to revert revision. @type get_what_callback: callable

@param changed_by: User. @type changed_by: string

@param response_message: Success message. @type response_message: string

@param transaction: Transaction @type transaction: auslib.db.AUSTransaction

@param obj_not_found_msg: Error message for not found AUS object. @type obj_not_found_msg: string

auslib.web.admin.views.mapper.enact_scheduled_change_permissions_post(sc_id)

POST /scheduled_changes/permissions/<int:sc_id>/enact

auslib.web.admin.views.mapper.enact_scheduled_change_permissions_rs_post(sc_id)

POST /scheduled_changes/required_signoffs/permissions/<int:sc_id>/enact

auslib.web.admin.views.mapper.enact_scheduled_change_product_rs_post(sc_id)

POST /scheduled_changes/required_signoffs/product/<int:sc_id>/enact

auslib.web.admin.views.mapper.enact_scheduled_change_releases_post(sc_id)

POST /scheduled_changes/releases/<int:sc_id>/enact

auslib.web.admin.views.mapper.enact_scheduled_change_rules_post(sc_id)

POST /scheduled_changes/rules/<int:sc_id>/enact

auslib.web.admin.views.mapper.release_get()

GET /releases

auslib.web.admin.views.mapper.release_post()

POST /releases

auslib.web.admin.views.mapper.release_read_only_get(release)

GET /releases/:release/read_only

auslib.web.admin.views.mapper.release_read_only_product_required_signoffs_get(release)

PUT /releases/:release/read_only/product/required_signoffs

auslib.web.admin.views.mapper.release_read_only_put(release)

PUT /releases/:release/read_only

auslib.web.admin.views.mapper.release_single_column_get(column)

GET /releases/columns/:column

auslib.web.admin.views.mapper.release_single_locale_view_put(release, platform, locale)

PUT /releases/[release]/builds/[platform]/[locale]

auslib.web.admin.views.mapper.required_signoffs_permissions_delete()

DELETE /required_signoffs/permissions

auslib.web.admin.views.mapper.required_signoffs_permissions_get()

GET /required_signoffs/permissions

auslib.web.admin.views.mapper.required_signoffs_permissions_post()

POST /required_signoffs/permissions

auslib.web.admin.views.mapper.required_signoffs_permissions_revisions_get()

GET /required_signoffs/permissions/revisions

auslib.web.admin.views.mapper.required_signoffs_product_delete()

DELETE /required_signoffs/product

auslib.web.admin.views.mapper.required_signoffs_product_get()

GET /required_signoffs/product

auslib.web.admin.views.mapper.required_signoffs_product_post()

POST /required_signoffs/product

auslib.web.admin.views.mapper.required_signoffs_product_revisions_get()

GET /required_signoffs/product/revisions

auslib.web.admin.views.mapper.rules_id_or_alias_delete(id_or_alias)

DELETE /rules/:id

auslib.web.admin.views.mapper.rules_id_or_alias_post(id_or_alias)

POST /rules/:id

auslib.web.admin.views.mapper.rules_id_or_alias_put(id_or_alias)

PUT /rules/:id

auslib.web.admin.views.mapper.rules_post()

POST /rules

auslib.web.admin.views.mapper.rules_revisions_post(rule_id)

POST /rules/:id/revisions

auslib.web.admin.views.mapper.scheduled_change_permissions_delete(sc_id)

DELETE /scheduled_changes/permissions/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_permissions_history_get(sc_id)

GET /scheduled_changes/permissions/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_permissions_history_post(sc_id)

POST /scheduled_changes/permissions/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_permissions_post(sc_id)

POST /scheduled_changes/permissions/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_permissions_rs_delete(sc_id)

DELETE /scheduled_changes/required_signoffs/permissions/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_permissions_rs_history_get(sc_id)

GET /scheduled_changes/required_signoffs/permissions/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_permissions_rs_history_post(sc_id)

POST /scheduled_changes/required_signoffs/permissions/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_permissions_rs_post(sc_id)

POST /scheduled_changes/required_signoffs/permissions/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_permissions_rs_signoffs_delete(sc_id)

DELETE /scheduled_changes/required_signoffs/permissions/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_permissions_rs_signoffs_post(sc_id)

POST /scheduled_changes/required_signoffs/permissions/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_permissions_signoffs_delete(sc_id)

DELETE /scheduled_changes/permissions/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_permissions_signoffs_post(sc_id)

POST /scheduled_changes/permissions/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_product_rs_delete(sc_id)

DELETE /scheduled_changes/required_signoffs/product/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_product_rs_history_get(sc_id)

GET /scheduled_changes/required_signoffs/product/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_product_rs_history_post(sc_id)

POST /scheduled_changes/required_signoffs/product/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_product_rs_post(sc_id)

POST /scheduled_changes/required_signoffs/product/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_product_rs_signoffs_delete(sc_id)

DELETE /scheduled_changes/required_signoffs/product/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_product_rs_signoffs_post(sc_id)

POST /scheduled_changes/required_signoffs/product/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_release_signoffs_delete(sc_id)

DELETE /scheduled_changes/releases/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_release_signoffs_post(sc_id)

POST /scheduled_changes/releases/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_releases_delete(sc_id)

DELETE /scheduled_changes/releases/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_releases_get_by_id(sc_id)
auslib.web.admin.views.mapper.scheduled_change_releases_history_get(sc_id)

GET /scheduled_changes/releases/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_releases_history_post(sc_id)

POST /scheduled_changes/releases/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_releases_post(sc_id)

POST /scheduled_changes/releases/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_rules_delete(sc_id)

DELETE /scheduled_changes/rules/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_rules_get_by_id(sc_id)
auslib.web.admin.views.mapper.scheduled_change_rules_history_get(sc_id)

GET /scheduled_changes/rules/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_rules_history_post(sc_id)

POST /scheduled_changes/rules/<int:sc_id>/revisions

auslib.web.admin.views.mapper.scheduled_change_rules_post(sc_id)

POST /scheduled_changes/rules/<int:sc_id>

auslib.web.admin.views.mapper.scheduled_change_rules_signoffs_delete(sc_id)

DELETE /scheduled_changes/rules/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_change_rules_signoffs_post(sc_id)

POST /scheduled_changes/rules/<int:sc_id>/signoffs

auslib.web.admin.views.mapper.scheduled_changes_permissions_get()

GET /scheduled_changes/permissions

auslib.web.admin.views.mapper.scheduled_changes_permissions_post()

POST /scheduled_changes/permissions

auslib.web.admin.views.mapper.scheduled_changes_releases_get()

GET /scheduled_changes/releases

auslib.web.admin.views.mapper.scheduled_changes_releases_post()

POST /scheduled_changes/releases

auslib.web.admin.views.mapper.scheduled_changes_rs_permissions_get()

GET /scheduled_changes/required_signoffs/permissions

auslib.web.admin.views.mapper.scheduled_changes_rs_permissions_post()

POST /scheduled_changes/required_signoffs/permissions

auslib.web.admin.views.mapper.scheduled_changes_rs_product_get()

GET /scheduled_changes/required_signoffs/product

auslib.web.admin.views.mapper.scheduled_changes_rs_product_post()

POST /scheduled_changes/required_signoffs/product

auslib.web.admin.views.mapper.scheduled_changes_rules_get()

GET /scheduled_changes/rules

auslib.web.admin.views.mapper.scheduled_changes_rules_post()

POST /scheduled_changes/rules

auslib.web.admin.views.mapper.scheduled_release_diff_get(sc_id)

GET /scheduled_changes/diff/release/:sc_id

auslib.web.admin.views.mapper.single_release_delete(release)

DELETE /releases/:release

auslib.web.admin.views.mapper.single_release_post(release)

POST /releases/:release

auslib.web.admin.views.mapper.single_release_put(release)

PUT /releases/:release

auslib.web.admin.views.mapper.single_rule_column_get(column)

GET /rules/columns/:column

auslib.web.admin.views.mapper.specific_user_get(username)

GET /users/:username

auslib.web.admin.views.mapper.user_permissions_get(username)

GET /users/:username/permissions

auslib.web.admin.views.mapper.user_role_delete(username, role)

DELETE /users/:username/roles/:role

auslib.web.admin.views.mapper.user_role_put(username, role)

PUT /users/:username/roles/:role

auslib.web.admin.views.mapper.user_specific_permission_delete(username, permission)

DELETE /users/:username/permissions/:permission

auslib.web.admin.views.mapper.user_specific_permission_get(username, permission)

GET /users/:username/permissions/:permission

auslib.web.admin.views.mapper.user_specific_permission_post(username, permission)

POST /users/:username/permissions/:permission

auslib.web.admin.views.mapper.user_specific_permission_put(username, permission)

PUT /users/:username/permissions/:permission

auslib.web.admin.views.mapper.users_get()

GET /users

class auslib.web.admin.views.permissions.PermissionsView(*args, **kwargs)

/users/:username/permissions

get(**kwargs)
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.permissions.SpecificPermissionView(*args, **kwargs)

/users/:username/permissions/:permission

get(**kwargs)
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.permissions.UsersView(*args, **kwargs)

/users

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

auslib.web.admin.views.problem.problem(status, title, detail, type=None, instance=None, headers=None, ext=None)

Returns a Problem Details error response.

Method is an exact copy of connexion.problem method except the returned Response object is of type flask.Response) instead of ConnexionResponse.

Reason: using connexion.problem results in TypeError: ‘ConnexionResponse’ object is not callable, sporadically in some APIs. Hence using flask.Response.

Parameters
  • status (int) – The HTTP status code generated by the origin server for this occurrence of the problem.

  • title (str) – A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localisation.

  • detail (str) – An human readable explanation specific to this occurrence of the problem.

  • type – An absolute URI that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation for the problem type (e.g., using HTML). When this member is not present its value is assumed to be “about:blank”.

  • instance (str) – An absolute URI that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.

  • headers (dict | None) – HTTP headers to include in the response

  • ext (dict | None) – Extension members to include in the body

Type

type: str

Returns

error response

Return type

Response

class auslib.web.admin.views.releases.SingleLocaleView(*args, **kwargs)

/releases/[release]/builds/[platform]/[locale]

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.releases.SingleReleaseView(*args, **kwargs)
methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.EnactPermissionsRequiredSignoffScheduledChangeView

/scheduled_changes/required_signoffs/permissions/<int:sc_id>/enact

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.EnactProductRequiredSignoffScheduledChangeView

/scheduled_changes/required_signoffs/product/<int:sc_id>/enact

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.PermissionsRequiredSignoffScheduledChangeHistoryView

/scheduled_changes/required_signoffs/permissions/<int:sc_id>/revisions

methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.PermissionsRequiredSignoffScheduledChangeSignoffsView

/scheduled_changes/required_signoffs/permissions/<int:sc_id>/signoffs

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.PermissionsRequiredSignoffScheduledChangeView

/scheduled_changes/required_signoffs/permissions/<int:sc_id>

methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.PermissionsRequiredSignoffsHistoryAPIView

/required_signoffs/permissions/revisions

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.PermissionsRequiredSignoffsScheduledChangesView

/scheduled_changes/required_signoffs/permissions

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.PermissionsRequiredSignoffsView

/required_signoffs/permissions

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.ProductRequiredSignoffScheduledChangeHistoryView

/scheduled_changes/required_signoffs/product/<int:sc_id>/revisions

methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.ProductRequiredSignoffScheduledChangeSignoffsView

/scheduled_changes/required_signoffs/product/<int:sc_id>/signoffs

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.ProductRequiredSignoffScheduledChangeView

/scheduled_changes/required_signoffs/product/<int:sc_id>

methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.ProductRequiredSignoffsHistoryAPIView

/required_signoffs/product/revisions

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.ProductRequiredSignoffsScheduledChangesView

/scheduled_changes/required_signoffs/product

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.ProductRequiredSignoffsView

/required_signoffs/product

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.RequiredSignoffsHistoryAPIView(table, decisionFields)
get(input_dict)
get_all()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.required_signoffs.RequiredSignoffsView(table, decisionFields)
get(where=None)
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.EnactRuleScheduledChangeView

/scheduled_changes/rules/<int:sc_id>/enact

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.RuleHistoryAPIView

/rules/:id/revisions

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.RuleScheduledChangeHistoryView

/scheduled_changes/rules/<int:sc_id>/revisions

methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.RuleScheduledChangeSignoffsView

/scheduled_changes/rules/<int:sc_id>/signoffs

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.RuleScheduledChangeView

/scheduled_changes/rules/<int:sc_id>

methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.RuleScheduledChangesView

/scheduled_changes/rules

get()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.RulesAPIView(*args, **kwargs)

/rules

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.SingleRuleColumnView(*args, **kwargs)

/rules/columns/:column

get(column)
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.rules.SingleRuleView(*args, **kwargs)

/rules/:id

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

auslib.web.admin.views.rules.process_rule_form(form_data)

Method to process either new/existing Rule form’s data without wtfForm validations :param form_data: input json form data in dict :return: dictionary of processed form field values and list of valid mapping key’s value.

class auslib.web.admin.views.scheduled_changes.EnactScheduledChangeView(namespace, table)

/scheduled_changes/:namespace/:sc_id/enact

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.scheduled_changes.ScheduledChangeHistoryView(namespace, table, *args, **kwargs)

/scheduled_changes/:namespace/revisions

get(sc_id)
get_all()
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.scheduled_changes.ScheduledChangeView(namespace, table)

/scheduled_changes/:namespace/:sc_id

get(sc_id)
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.scheduled_changes.ScheduledChangesView(namespace, table)

/scheduled_changes/:namespace

get(where=None)
methods: Optional[List[str]] = {'DELETE', 'GET', 'POST', 'PUT'}

A list of methods this view can handle.

class auslib.web.admin.views.scheduled_changes.SignoffsView(namespace, table)

/scheduled_change/:namespace/:sc_id/signoffs

methods: Optional[List[str]] = {'DELETE', 'POST', 'PUT'}

A list of methods this view can handle.

auslib.web.admin.views.scheduled_changes.add_signoff_information(row, table, sc_table)
class auslib.web.admin.views.validators.BalrogRequestBodyValidator(schema, consumes, api, is_null_value_valid=False, validator=None, strict_validation=False)
validate_schema(data, url)

This function is largely based on https://github.com/zalando/connexion/blob/master/connexion/decorators/validation.py and should largely be kept in line with it.

auslib.web.admin.views.validators.is_when_present_and_in_past_validator(what)

Validates if scheduled_change_time value i.e. ‘when’ field value is present in input dictionary/object and if its value is in past or not

auslib.web.common

auslib.web.common.emergency_shutoff.get()
auslib.web.common.emergency_shutoff.get_by_id(product, channel)
auslib.web.common.history_all.permissions_history()

GET /permissions/history

auslib.web.common.history_all.permissions_required_signoffs_history()

GET /permissions_required_signoffs/history

auslib.web.common.history_all.product_required_signoffs_history()

GET /required_signoffs/product/history

auslib.web.common.history_all.rules_history()

GET /rules/history

class auslib.web.common.history.HistoryHelper(hist_table, order_by, get_object_callback, history_filters_callback, process_revisions_callback=None, obj_not_found_msg='Requested object does not exist')
get_history(response_key='revisions')
auslib.web.common.history.annotateRevisionDifferences(revisions)
auslib.web.common.history.get_input_dict()
auslib.web.common.releases.get_release(release)
auslib.web.common.releases.get_release_single_locale(release, platform, locale)
auslib.web.common.releases.get_releases()
auslib.web.common.releases.release_list(request)
auslib.web.common.releases.serialize_releases(request, releases)
auslib.web.common.releases.strip_data(release)

Return a release with all the fields except data.

This is used in multiple APIs to save bandwidth and present a simplified view of the release by removing its largest field, data, which is of no use except when serving clients.

auslib.web.common.rules.get_rule(id_or_alias)
auslib.web.common.rules.get_rule_history(rule_id)
auslib.web.common.rules.get_rules()

auslib.web.public

auslib.web.public.base.apply_security_headers(response)
auslib.web.public.base.contributejson()
auslib.web.public.base.fourohfour(error)
auslib.web.public.base.generic(error)

Deals with any unhandled exceptions. If the exception is not a BadDataError, it will be sent to Sentry, and a 400 will be returned, because BadDataErrors are considered to be the client’s fault. Otherwise, the error is just re-raised (which causes a 500).

auslib.web.public.base.get_yaml()
auslib.web.public.base.robots()
auslib.web.public.base.set_cache_control()
auslib.web.public.base.unicode(error)
auslib.web.public.client.extract_query_version(request_url)
auslib.web.public.client.getCleanQueryFromURL(url)
auslib.web.public.client.getHeaderArchitecture(buildTarget, ua)
auslib.web.public.client.getQueryFromURL(url)
auslib.web.public.client.getSystemCapabilities(systemCapabilities)
auslib.web.public.client.get_update_blob(transaction, **url)
auslib.web.public.client.get_update_blob_1(transaction, **url)
auslib.web.public.client.get_update_blob_2(transaction, **url)
auslib.web.public.client.get_update_blob_3(transaction, **url)
auslib.web.public.client.get_update_blob_3_esrpre(transaction, **url)
auslib.web.public.client.get_update_blob_4(transaction, **url)
auslib.web.public.client.get_update_blob_5(transaction, **url)
auslib.web.public.client.get_update_blob_6(transaction, **url)
auslib.web.public.dockerflow.heartbeat()
auslib.web.public.dockerflow.lbheartbeat()
auslib.web.public.dockerflow.version()
auslib.web.public.json.get_update(transaction, **parameters)