bodhi.server.models — bodhi 3.1.0 documentation

# bodhi.server.models

Bodhi’s database models.

Functions

`and_`(*clauses) | Produce a conjunction of expressions joined by `AND`.
`backref`(name, **kwargs) | Create a back reference with explicit keyword arguments, which are the same arguments one can send to `relationship()`.
`build_evr`(build) | Return a tuple of strings of the given build’s epoch, version, and release.
`class_mapper`(class_[, configure]) | Given a class, return the primary `Mapper` associated with the key.
`declarative_base`([bind, metadata, mapper, ...]) | Construct a base class for declarative class definitions.
`flash_log`(msg) | Log the given message at debug level.
`get_avatar`(context, username, size) | Return a URL of an avatar for the given username of the given size.
`get_nvr`(nvr) | Return the (name, version, release) from a given name-ver-rel string.
`get_rpm_header`(nvr[, tries]) | Get the rpm header for a given build.
`header`(x) | Display a given message as a heading.
`or_`(*clauses) | Produce a conjunction of expressions joined by `OR`.
`packagename_from_nvr`(context, nvr) | Extract and return the package name from the given nvr string.
`pagure_api_get`(pagure_api_url) | Perform a GET request against Pagure.
`quote`(() -> ) | Each part of a URL, e.g.
`relationship`(argument[, secondary, ...]) | Provide a relationship between two mapped classes.
`text`(text[, bind, bindparams, typemap, ...]) | Construct a new `TextClause` clause, representing a textual SQL string directly.
`tokenize`(string) | Interpret the given string as a space or comma separated ordered iterable of strings.
`validates`(*names, **kw) | Decorate a method as a ‘validator’ for one or more named properties.
`wrap`(text[, width]) | Wrap a single paragraph of text, returning a list of wrapped lines.

Classes

`Base`(**kwargs) | Base class for the SQLAlchemy model base class.
`BodhiBase` | Base class for the SQLAlchemy model base class.
`Boolean`([create_constraint, name, ...]) | A bool datatype.
`Bug`(**kwargs) | Represents a Bugzilla bug.
`BugKarma`(**kwargs) | Karma for a bug associated with a comment.
`Build`(**kwargs) | This model represents a specific build of a package.
`BuildrootOverride`(**kwargs) | This model represents a Koji buildroot override.
`CVE`(**kwargs) | Represents a CVE.
`Column`(*args, **kwargs) | Represents a column in a database table.
`Comment`(**kwargs) | An update comment.
`Compose`(**kwargs) | Express the status of an in-progress compose job.
`ComposeState` | Define the various states that a `Compose` can be in.
`ContentType` | Used to differentiate between different kinds of content in various models.
`DateTime`([timezone]) | A type for `datetime.datetime()` objects.
`DeclEnum` | Declarative enumeration.
`DeclEnumType`(enum) | A database column type for an enum.
`Enum`(*enums, **kw) | Generic Enum Type.
`EnumMeta`(classname, bases, dict_) | Generate new DeclEnum classes.
`EnumSymbol`(cls_, name, value, description) | Define a fixed symbol tied to a parent class.
`ForeignKey`(column[, _constraint, use_alter, ...]) | Defines a dependency between two columns.
`Group`(**kwargs) | A group of users.
`Integer` | A type for `int` integers.
`MediaWiki`(api_url[, cookie_file, cookiejar, ...]) | Create a new object to access a wiki via api_url.
`ModuleBuild`(**kwargs) | Represents a Module build.
`ModulePackage`(**kwargs) | Represents a Module package.
`Package`(**kwargs) | This model represents a package.
`PkgDB`([url, insecure, login_callback, ...]) | PkgDB class used to interact with the Package DB instance via its API.
`RelationshipProperty`(argument[, secondary, ...]) | Describes an object property that holds a single item or list of items that correspond to a related database table.
`Release`(**kwargs) | Represent a distribution release, such as Fedora 27.
`ReleaseState` | An enum that describes the state of a `Release`.
`RpmBuild`(**kwargs) | Represents an RPM build.
`RpmPackage`(**kwargs) | Represents a RPM package.
`SchemaType`([name, schema, metadata, ...]) | Mark a type as possibly requiring schema-level DDL for usage.
`Stack`(**kwargs) | A group of packages that are commonly pushed together as a group.
`Table`(*args, **kw) | Represent a table in a database.
`TestCase`(**kwargs) | Represents test cases from the wiki.
`TestCaseKarma`(**kwargs) | Karma for a TestCase associated with a comment.
`TestGatingStatus` | This class lists the different status the `Update.test_gating_status` flag can have.
`TypeDecorator`(*args, **kwargs) | Allows the creation of types which add additional functionality to an existing type.
`Unicode`([length]) | A variable length Unicode string type.
`UnicodeText`([length]) | An unbounded-length Unicode string type.
`UniqueConstraint`(*columns, **kw) | A table-level UNIQUE constraint.
`Update`(**kwargs) | This model represents an update.
`UpdateRequest` | An enum used to specify an update requesting to change states.
`UpdateSeverity` | An enum used to specify the severity of the update.
`UpdateStatus` | An enum used to describe the current state of an update.
`UpdateSuggestion` | An enum used to tell the user whether they need to reboot or logout after applying an update.
`UpdateType` | An enum used to classify the type of the update.
`User`(**kwargs) | A Bodhi user.
`datetime`(year, month, day[, hour[, minute[, ...) | The year, month and day arguments are required.
`defaultdict` | defaultdict(default_factory[, ...]) –> dict with default factory

Exceptions

`BodhiException` | Used to express a variety of errors in the codebase.
`LockedUpdateException` | Raised when something attempts to operate on a locked update.
`NoResultFound` | A database result was required but none was found.

class `bodhi.server.models.` `BodhiBase`

  Bases: `object`

  Base class for the SQLAlchemy model base class.

  `__exclude_columns__`

    tuple – A list of columns to exclude from JSON

  `__include_extras__`

    tuple – A list of methods or attrs to include in JSON

  `__get_by__`

    tuple – A list of columns that `get()` will query.

  `id`

    int – An integer id that serves as the default primary key.

  `query`

    sqlalchemy.orm.query.Query – a class property which produces a Query object against the class and the current Session when called.

  `__getitem__`(key)

    Define a dictionary like interface for the models.

    Parameters: | key (string) – The name of an attribute you wish to retrieve from the model.
    Returns: | The value of the attribute represented by key.
    Return type: | object

  `__json__`(request=None, anonymize=False)

    Return a JSON representation of this model.

    Parameters: | request (pyramid.util.Request or None) – The current web request, or None. anonymize (bool) – If True, scrub out some information from the JSON blob using the model’s `__anonymity_map__`. Defaults to False.
    Returns: | A JSON representation of the model.
    Return type: | basestring

  `__repr__`()

    Return a string representation of this model.

    Returns: | A string representation of this model.
    Return type: | basestring

  `__weakref__`

    list of weak references to the object (if defined)

  classmethod `find_polymorphic_child`(identity)

    Find a child of a polymorphic base class.

    For example, given the base Package class and the ‘rpm’ identity, this class method should return the RpmPackage class.

    This is accomplished by iterating over all classes in scope. Limiting that to only those which are an extension of the given base class. Among those, return the one whose polymorphic_identity matches the value given. If none are found, then raise a NameError.

    Parameters: | identity (EnumSymbol) – An instance of EnumSymbol used to identify the child.
    Returns: | The type-specific child class.
    Return type: | BodhiBase
    Raises: | `KeyError` – If this class is not polymorphic. `NameError` – If no child class is found for the given identity. `TypeError` – If identity is not an EnumSymbol.

  classmethod `get`(id, db)

    Return an instance of the model by using its __get_by__ attribute with id.

    Parameters: | id (object) – An attribute to look up the model by. db (sqlalchemy.orm.session.Session) – A database session.
    Returns: | An instance of the model that matches the id, or `None` if no match was found.
    Return type: | BodhiBase or None

  classmethod `grid_columns`()

    Return the column names for the model, except for the excluded ones.

    Returns: | A list of column names, with excluded ones removed.
    Return type: | list

  `update_relationship`(name, model, data, db)

    Add items to or remove items from a many-to-many relationship.

    Parameters: | name (basestring) – The name of the relationship column on self, as well as the key in `data`. model (BodhiBase) – The model class of the relationship that we’re updating. data (dict) – A dict containing the key name with a list of values. db (sqlalchemy.orm.session.Session) – A database session.
    Returns: | A three-tuple of lists, new, same, and removed, indicating which items have been added and removed, and which remain unchanged.
    Return type: | tuple

class `bodhi.server.models.` `Bug`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Represents a Bugzilla bug.

  `bug_id`

    int – The bug’s id.

  `title`

    unicode – The description of the bug.

  `security`

    bool – True if the bug is marked as a security issue.

  `url`

    unicode – The URL for the bug. Inaccessible due to being overridden by the url property (https://github.com/fedora-infra/bodhi/issues/1995).

  `parent`

    bool – True if this is a parent tracker bug for release-specific bugs.

  `cves`

    sqlalchemy.orm.collections.InstrumentedList – An interable of `CVEs` this bug is associated with.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `add_comment`(update, comment=None)

    Add a comment to the bug, pertaining to the given update.

    Parameters: | update (Update) – The update that is related to the bug. comment (basestring or None) – The comment to add to the bug. If None, a default message is added to the bug. Defaults to None.

  `close_bug`(update)

    Close the bug.

    Parameters: | update (Update) – The update associated with the bug.

  `default_message`(update)

    Return a default comment to add to a bug with add_comment().

    Parameters: | update (Update) – The update that is related to the bug.
    Returns: | The default comment to add to the bug related to the given update.
    Return type: | basestring

  `modified`(update)

    Change the status of this bug to MODIFIED unless it is a parent security bug.

    Parameters: | update (Update) – The update that is associated with this bug.

  `testing`(update)

    Change the status of this bug to ON_QA.

    Also, comment on the bug with some details on how to test and provide feedback for the given update.

    Parameters: | update (Update) – The update associated with the bug.

  `update_details`(bug=None)

    Grab details from rhbz to populate our bug fields.

    This is typically called “offline” in the UpdatesHandler consumer.

    Parameters: | bug (bugzilla.bug.Bug or None) – The Bug to retrieve details from Bugzilla about. If None, self.bug_id will be used to retrieve the bug. Defaults to None.

  `url`

    Return a URL to the bug.

    Returns: | The URL to this bug.
    Return type: | basestring

class `bodhi.server.models.` `BugKarma`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Karma for a bug associated with a comment.

  `karma`

    int – The karma associated with this bug and comment.

  `comment`

    Comment – The comment this BugKarma is part of.

  `bug`

    Bug – The bug this BugKarma pertains to.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `Build`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  This model represents a specific build of a package.

  This model uses single-table inheritance to allow for different build types.

  `inherited`

    bool – The purpose of this column is unknown, and it appears to be unused. At the time of this writing, there are 112,234 records with inherited set to False and 0 with it set to True in the Fedora Bodhi deployment.

  `nvr`

    unicode – The nvr field is really a mapping to the Koji build_target.name field, and is used to reference builds in Koji. It is named nvr in reference to the dash-separated name-version-release Koji name for RPMs, but it is used by other types as well. At the time of this writing, it was not practical to rename nvr since it is used in the REST API to reference builds. Thus, it should be thought of as a Koji build identifier rather than strictly as an RPM’s name, version, and release.

  `package_id`

    int – A foreign key to the Package that this Build is part of.

  `release_id`

    int – A foreign key to the Release that this Build is part of.

  `signed`

    bool – If True, this package has been signed by robosignatory. If False, it has not been signed yet.

  `update_id`

    int – A foreign key to the Update that this Build is part of.

  `release`

    sqlalchemy.orm.relationship – A relationship to the Release that this build is part of.

  `type`

    int – The polymorphic identify of the row. This is used by sqlalchemy to identify which subclass of Build to use.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `get_tags`(koji=None)

    Return a list of koji tags for this build.

    Parameters: | koji (bodhi.server.buildsys.Buildsysem or koji.ClientSession) – A koji client. Defaults to calling bodhi.server.buildsys.get_session().
    Returns: | A list of strings of the Koji tags on this Build.
    Return type: | list

  `get_url`()

    Return a the url to details about this build.

    This method appears to be unused and incorrect.

    Returns: | A URL for this build.
    Return type: | str

  `unpush`(koji)

    Move this build back to the candidate tag and remove any pending tags.

    Parameters: | koji (bodhi.server.buildsys.Buildsysem or koji.ClientSession) – A koji client.

  `untag`(koji, db)

    Remove all known tags from this build.

    Parameters: | koji (bodhi.server.buildsys.Buildsysem or koji.ClientSession) – A koji client. db (sqlalchemy.orm.session.Session) – A database Session.

class `bodhi.server.models.` `BuildrootOverride`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  This model represents a Koji buildroot override.

  A buildroot override is a way to add a build to the Koji buildroot (the set of packages used to build a package) manually. Normally, builds are only available after they are pushed to “stable”, but this allows a build to be added to the buildroot immediately. This is useful for updates that depend on each other to be built.

  `notes`

    unicode – A text field that holds arbitrary notes about the buildroot override.

  `submission_date`

    DateTime – The date that the buildroot override was submitted.

  `expiration_date`

    DateTime – The date that the buildroot override expires.

  `expired_date`

    DateTime – The date that the buildroot override expired.

  `build_id`

    int – The primary key of the `Build` this override is related to.

  `build`

    Build – The build this override is related to.

  `submitter_id`

    int – The primary key of the `User` this override was created by.

  `submitter`

    User – The user this override was created by.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  classmethod `edit`(request, **data)

    Edit an existing buildroot override.

    Parameters: | request (pyramid.util.Request) – The current web request. data (dict) – The changed being made to the BuildrootOverride.
    Returns: | The new updated override.
    Return type: | BuildrootOverride

  `enable`()

    Mark the BuildrootOverride as enabled.

  `expire`()

    Mark the BuildrootOverride as expired.

  classmethod `new`(request, **data)

    Create a new buildroot override.

    Parameters: | request (pyramid.util.Request) – The current web request. data (dict) – A dictionary of all the attributes to be used on the new override.
    Returns: | The newly created BuildrootOverride instance.
    Return type: | BuildrootOverride

  `nvr`

    Return the NVR of the `Build` associated with this override.

    Returns: | The override’s `Build's` NVR.
    Return type: | basestring

class `bodhi.server.models.` `CVE`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Represents a CVE.

  `cve_id`

    unicode – The CVE identifier for this CVE.

  `updates`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of `Updates` associated with this CVE.

  `bugs`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of `Bugs` associated with this CVE.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `url`

    Return a URL about this CVE.

    Returns: | A URL describing this CVE.
    Return type: | str

class `bodhi.server.models.` `Comment`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  An update comment.

  `karma`

    int – The karma associated with this comment. Defaults to 0.

  `karma_critpath`

    int – The critpath karma associated with this comment. Defaults to 0.

  `text`

    unicode – The text of the comment.

  `anonymous`

    bool – If True, the comment was from an anonymous user. Defaults to False.

  `timestamp`

    datetime.datetime – The time the comment was created. Defaults to the return value of datetime.utcnow().

  `update`

    Update – The update that this comment pertains to.

  `user`

    User – The user who wrote this comment.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `__json__`(*args, **kwargs)

    Return a JSON string representation of this comment.

    Parameters: | args (list) – A list of extra args to pass on to `BodhiBase.__json__()`. kwargs (dict) – Extra kwargs to pass on to `BodhiBase.__json__()`.
    Returns: | A JSON representation of this comment.
    Return type: | basestring

  `__str__`()

    Return a str representation of this comment.

    Returns: | A str representation of this comment.
    Return type: | str

  `unique_testcase_feedback`

    Return a list of unique `TestCaseKarma` objects found in the testcase_feedback.

    This will filter out duplicates for `TestCases`. It will return the correct number of TestCases in testcase_feedback as a list.

    Returns: | A list of unique `TestCaseKarma` objects associated with this comment.
    Return type: | list

  `url`()

    Return a URL to this comment.

    Returns: | A URL to this comment.
    Return type: | basestring

class `bodhi.server.models.` `Compose`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Express the status of an in-progress compose job.

  This object is used in a few ways:

  > - It ensures that only one compose process runs per repo, serving as a compose “lock”.
  > - It marks which updates are part of a compose, serving as an update “lock”.
  > - It gives the compose process a place to log which step it is in, which will allow us to provide compose monitoring tools.

  `__exclude_columns__`

    tuple – A tuple of columns to exclude when __json__() is called.

  `__include_extras__`

    tuple – A tuple of attributes to add when __json__() is called.

  `__tablename__`

    str – The name of the table in the database.

  `checkpoints`

    unicode – A JSON serialized object describing the checkpoints the masher has reached.

  `date_created`

    datetime.datetime – The time this Compose was created.

  `error_message`

    unicode – An error message indicating what happened if the Compose failed.

  `id`

    None – We don’t want the superclass’s primary key since we will use a natural primary key for this model.

  `release_id`

    int – The primary key of the `Release` that is being composed. Forms half of the primary key, with the other half being the `request`.

  `request`

    UpdateRequest – The request of the release that is being composed. Forms half of the primary key, with the other half being the `release_id`.

  `release`

    Release – The release that is being composed.

  `state_date`

    datetime.datetime – The time of the most recent change to the state attribute.

  `state`

    ComposeState – The state of the compose.

  `updates`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of updates included in this compose.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `__lt__`(other)

    Return `True` if this compose has a higher priority than the other.

    Parameters: | other (Compose) – Another compose we are comparing this compose to for sorting.
    Returns: | `True` if this compose has a higher priority than the other, else `False`.
    Return type: | bool

  `__str__`()

    Return a human-readable representation of this compose.

    Returns: | A string to be displayed to users decribing this compose.
    Return type: | basestring

  `content_type`

    Return the content_type of this compose.

    Returns: | The content type of this compose, or None if there are no associated `Updates`.
    Return type: | (ContentType or None)

  classmethod `from_dict`(db, compose)

    Return a `Compose` instance from the given dict representation of it.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session to use to query for the compose. compose (dict) – A dictionary representing the compose, in the format returned by `Compose.__json__()`.
    Returns: | The requested compose instance.
    Return type: | bodhi.server.models.Compose

  classmethod `from_updates`(updates)

    Return a list of Compose objects to compose the given updates.

    The updates will be collated by release, request, and content type, and will be added to new Compose objects that match those groupings.

    Note that calling this will cause each of the updates to become locked once the transaction is committed.

    Parameters: | updates (list) – A list of `Updates` that you wish to Compose.
    Returns: | A list of new compose objects for the given updates.
    Return type: | list

  `security`

    Return whether this compose is a security related compose or not.

    Returns: | `True` if any of the `Updates` in this compose are marked as security updates.
    Return type: | bool

  static `update_state_date`(target, value, old, initiator)

    Update the `state_date` when the state changes.

    Parameters: | target (Compose) – The compose that has had a change to its state attribute. value (EnumSymbol) – The new value of the state. old (EnumSymbol) – The old value of the state initiator (sqlalchemy.orm.attributes.Event) – The event object that is initiating this transition.

class `bodhi.server.models.` `ComposeState`

  Bases: `bodhi.server.models.DeclEnum`

  Define the various states that a `Compose` can be in.

  `requested`

    EnumSymbol – A compose has been requested, but it has not started yet.

  `pending`

    EnumSymbol – The request for the compose has been received by the backend worker, but the compose has not started yet.

  `initializing`

    EnumSymbol – The compose is initializing.

  `updateinfo`

    EnumSymbol – The updateinfo.xml is being generated.

  `punging`

    EnumSymbol – A Pungi soldier has been deployed to deal with the situation.

  `notifying`

    EnumSymbol – Pungi has finished successfully, and we are now sending out various forms of notifications, such as e-mail, fedmsgs, and bugzilla.

  `success`

    EnumSymbol – The Compose has completed successfully.

  `failed`

    EnumSymbol – The compose has failed, abandon hope.

class `bodhi.server.models.` `ContainerBuild`(**kwargs)

  Bases: `bodhi.server.models.Build`

  Represents a Container build.

  Note that this model uses single-table inheritance with its Build superclass.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `ContainerPackage`(**kwargs)

  Bases: `bodhi.server.models.Package`

  Represents a Container package.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `ContentType`

  Bases: `bodhi.server.models.DeclEnum`

  Used to differentiate between different kinds of content in various models.

  This enum is used to mark objects as pertaining to particular kinds of content type, such as RPMs or Modules.

  `base`

    EnumSymbol – This is used to represent base classes that are shared between specific content types.

  `rpm`

    EnumSymbol – Used to represent RPM related objects.

  `module`

    EnumSymbol – Used to represent Module related objects.

  `container`

    EnumSymbol – Used to represent Container related objects.

  classmethod `infer_content_class`(base, build)

    Identify and return the child class associated with the appropriate ContentType.

    For example, given the Package base class and a normal koji build, return the RpmPackage model class. Or, given the Build base class and a container build, return the ContainerBuild model class.

    Parameters: | base (BodhiBase) – A base model class, such as `Build` or `Package`. build (dict) – Information about the build from the build system (koji).
    Returns: | The type-specific child class of base that is appropriate to use with the given koji build.
    Return type: | BodhiBase
    Raises: | `NotImplementedError` – If the build is a container.

class `bodhi.server.models.` `DeclEnum`

  Bases: `object`

  Declarative enumeration.

  `__weakref__`

    list of weak references to the object (if defined)

  classmethod `db_type`()

    Return a database column type to be used for this enum.

    Returns: | A DeclEnumType to be used for this enum.
    Return type: | DeclEnumType

  classmethod `from_string`(value)

    Convert a string version of the enum to its enum type.

    Parameters: | value (basestring) – A string that you wish to convert to an Enum value.
    Returns: | The symbol corresponding to the value.
    Return type: | EnumSymbol
    Raises: | `ValueError` – If no symbol matches the given value.

  classmethod `values`()

    Return the possible values that this enum can take on.

    Returns: | A list of strings of the values that this enum can represent.
    Return type: | list

class `bodhi.server.models.` `DeclEnumType`(enum)

  Bases: `sqlalchemy.sql.sqltypes.SchemaType`, `sqlalchemy.sql.type_api.TypeDecorator`

  A database column type for an enum.

  `__init__`(enum)

    Initialize with the given enum.

    Parameters: | enum (bodhi.server.models.EnumMeta) – The enum metaclass.

  `copy`()

    Return a copy of self.

    Returns: | A copy of self.
    Return type: | DeclEnumType

  `create`(bind=None, checkfirst=False)

    Issue CREATE ddl for this type, if applicable.

  `drop`(bind=None, checkfirst=False)

    Issue DROP ddl for this type, if applicable.

  `process_bind_param`(value, dialect)

    Return the value of the enum.

    Parameters: | value (bodhi.server.models.enum.EnumSymbol) – The enum symbol we are resolving the value of. dialect (sqlalchemy.engine.default.DefaultDialect) – Unused.
    Returns: | The EnumSymbol’s value.
    Return type: | basestring

  `process_result_value`(value, dialect)

    Return the enum that matches the given string.

    Parameters: | value (basestring) – The name of an enum. dialect (sqlalchemy.engine.default.DefaultDialect) – Unused.
    Returns: | The enum that matches value, or `None` if `value` is `None`.
    Return type: | EnumSymbol or None

class `bodhi.server.models.` `EnumMeta`(classname, bases, dict_)

  Bases: `type`

  Generate new DeclEnum classes.

  `__init__`(classname, bases, dict_)

    Initialize the metaclass.

    Parameters: | classname (basestring) – The name of the enum. bases (list) – A list of base classes for the enum. dict (dict) – A key-value mapping for the new enum’s attributes.
    Returns: | A new DeclEnum.
    Return type: | DeclEnum

  `__iter__`()

    Iterate the enum values.

    Returns: | An iterator for the enum values.
    Return type: | iterator

class `bodhi.server.models.` `EnumSymbol`(cls_, name, value, description)

  Bases: `object`

  Define a fixed symbol tied to a parent class.

  `__init__`(cls_, name, value, description)

    Initialize the EnumSymbol.

    Parameters: | cls (EnumMeta) – The metaclass this symbol is tied to. name (basestring) – The name of this symbol. value (basestring) – The value used in the database to represent this symbol. description (basestring) – A human readable description of this symbol.

  `__iter__`()

    Iterate over this EnumSymbol’s value and description.

    Returns: | An iterator over the value and description.
    Return type: | iterator

  `__json__`(request=None)

    Return a JSON representation of this EnumSymbol.

    Parameters: | request (pyramid.util.Request) – The current request.
    Returns: | A string representation of this EnumSymbol’s value.
    Return type: | basestring

  `__reduce__`()

    Allow unpickling to return the symbol linked to the DeclEnum class.

    Returns: | A 2-tuple of the `getattr` function, and a 2-tuple of the EnumSymbol’s member class and name.
    Return type: | tuple

  `__repr__`()

    Return a string representation of this EnumSymbol.

    Returns: | A string representation of this EnumSymbol’s value.
    Return type: | basestring

  `__unicode__`()

    Return a string representation of this EnumSymbol.

    Returns: | A string representation of this EnumSymbol’s value.
    Return type: | unicode

  `__weakref__`

    list of weak references to the object (if defined)

class `bodhi.server.models.` `Group`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  A group of users.

  `name`

    unicode – The name of the Group.

  `users`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of the `Users` who are in the group.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `ModuleBuild`(**kwargs)

  Bases: `bodhi.server.models.Build`

  Represents a Module build.

  Note that this model uses single-table inheritance with its Build superclass.

  `nvr`

    unicode – A unique Koji identifier for the module build.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `ModulePackage`(**kwargs)

  Bases: `bodhi.server.models.Package`

  Represents a Module package.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `Package`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  This model represents a package.

  This model uses single-table inheritance to allow for different package types.

  `name`

    unicode – A unicode string that uniquely identifies the package.

  `requirements`

    unicode – A unicode string that lists space-separated taskotron test results that must pass for this package

  `type`

    int – The polymorphic identity column. This is used to identify what Python class to create when loading rows from the database.

  `builds`

    sqlalchemy.orm.collections.InstrumentedList – A list of `Build` objects.

  `test_cases`

    sqlalchemy.orm.collections.InstrumentedList – A list of `TestCase` objects.

  `committers`

    sqlalchemy.orm.collections.InstrumentedList – A list of `User` objects who are committers.

  `stack_id`

    int – A foreign key to the `Stack`

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `__str__`()

    Return a string representation of the package.

    Returns: | A string representing this package.
    Return type: | basestring

  `fetch_test_cases`(db)

    Get a list of test cases for this package from the wiki.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session.

  `get_pkg_committers_from_pagure`()

    Pull users and groups who can commit on a package in Pagure.

    Returns a tuple with two lists: * The first list contains usernames that have commit access. * The second list contains FAS group names that have commit access.

  `get_pkg_pushers`(branch, settings)

    Return users who can commit and are watching a package.

    Return two two-tuples of lists:
      - The first tuple is for usernames. The second tuple is for groups.
      - The first list of the tuples is for committers. The second is for watchers.
  `validate_builds`(key, build)

    Validate builds being appended to ensure they are all the same type as the Package.

    This method checks to make sure that all the builds on self.builds have their type attribute equal to self.type. The goal is to make sure that Builds of a specific type are only ever associated with Packages of the same type and vice-versa. For example, RpmBuilds should only ever associate with RpmPackages and never with ModulePackages.

    Parameters: | key (str) – The field’s key, which is un-used in this validator. build (Build) – The build object which was appended to the list of builds.
    Raises: | `ValueError` – If the build being appended is not the same type as the package.

class `bodhi.server.models.` `Release`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Represent a distribution release, such as Fedora 27.

  `name`

    unicode – The name of the release, such as ‘F27’.

  `long_name`

    unicode – A human readable name for the release, such as ‘Fedora 27’.

  `version`

    unicode – The version of the release, such as ‘27’.

  `id_prefix`

    unicode – The prefix to use when forming update aliases for this release, such as ‘FEDORA’.

  `branch`

    unicode – The dist-git branch associated with this release, such as ‘f27’.

  `dist_tag`

    unicode – The koji dist_tag associated with this release, such as ‘f27’.

  `stable_tag`

    unicode – The koji tag to be used for stable builds in this release, such as ‘f27-updates’.

  `testing_tag`

    unicode – The koji tag to be used for testing builds in this release, such as ‘f27-updates-testing’.

  `candidate_tag`

    unicode – The koji tag used for builds that are candidates to be updates, such as ‘f27-updates-candidate’.

  `pending_signing_tag`

    unicode – The koji tag that specifies that a build is waiting to be signed, such as ‘f27-signing-pending’.

  `pending_testing_tag`

    unicode – The koji tag that indicates that a build is waiting to be mashed into the testing repository, such as ‘f27-updates-testing-pending’.

  `pending_stable_tag`

    unicode – The koji tag that indicates that a build is waiting to be mashed into the stable repository, such as ‘f27-updates-pending’.

  `override_tag`

    unicode – The koji tag that is used when a build is added as a buildroot override, such as ‘f27-override’.

  `state`

    `ReleaseState` – The current state of the release. Defaults to `ReleaseState.disabled`.

  `id`

    int – The primary key of this release.

  `builds`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of `Builds` associated with this release.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  classmethod `all_releases`(session)

    Return a mapping of release states to a list of dictionaries describing the releases.

    Parameters: | session (sqlalchemy.orm.session.Session) – A database session.
    Returns: | Mapping strings of `ReleaseState` names to lists of dictionaries that describe the releases in those states.
    Return type: | defaultdict

  `collection_name`

    Return the collection name of this release (eg – Fedora EPEL).

    Returns: | The collection name of this release.
    Return type: | basestring

  classmethod `from_tags`(tags, session)

    Find a release associated with one of the given koji tags.

    Parameters: | tags (list) – A list of koji tags for which an associated release is desired. session (sqlalchemy.orm.session.Session) – A database session.
    Returns: | The first release found that matches the first tag. If no release is found, `None` is returned.
    Return type: | Release or None

  classmethod `get_tags`(session)

    Return a 2-tuple mapping tags to releases.

    Parameters: | session (sqlalchemy.orm.session.Session) – A database session.
    Returns: | A 2-tuple. The first element maps the keys ‘candidate’, ‘testing’, ‘stable’, ‘override’, ‘pending_testing’, and ‘pending_stable’ each to a list of tags for various releases that correspond to those tag semantics. The second element maps each koji tag to the release’s name that uses it.
    Return type: | tuple

  `mandatory_days_in_testing`

    Return the number of days that updates in this release must spend in testing.

    Returns: | The number of days in testing that updates in this release must spend in testing. If the release isn’t configured to have mandatory testing time, `None` is returned.
    Return type: | int or None

  `version_int`

    Return an integer representation of the version of this release.

    Returns: | The version of the release.
    Return type: | int

class `bodhi.server.models.` `ReleaseState`

  Bases: `bodhi.server.models.DeclEnum`

  An enum that describes the state of a `Release`.

  `disabled`

    EnumSymbol – Indicates that the release is disabled.

  `pending`

    EnumSymbol – Indicates that the release is pending.

  `current`

    EnumSymbol – Indicates that the release is current.

  `archived`

    EnumSymbol – Indicates taht the release is archived.

class `bodhi.server.models.` `RpmBuild`(**kwargs)

  Bases: `bodhi.server.models.Build`

  Represents an RPM build.

  Note that this model uses single-table inheritance with its Build superclass.

  `nvr`

    unicode – A dash (-) separated string of an RPM’s name, version, and release (e.g. u’bodhi-2.5.0-1.fc26’)

  `epoch`

    int – The RPM’s epoch.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `evr`

    Return the RpmBuild’s epoch, version, release, all basestrings in a 3-tuple.

    Returns: | (epoch, version, release)
    Return type: | tuple

  `get_changelog`(timelimit=0)

    Retrieve the RPM changelog of this package since it’s last update, or since timelimit.

    Parameters: | timelimit (int) – Timestamp, specified as the number of seconds since 1970-01-01 00:00:00 UTC.
    Returns: | The RpmBuild’s changelog.
    Return type: | str

  `get_latest`()

    Return the nvr string of the most recent evr that is less than this RpmBuild’s nvr.

    If there is no other Build, this returns `None`.

    Returns: | An nvr string, formatted like RpmBuild.nvr. If there is no other Build, returns `None`.
    Return type: | basestring or None

class `bodhi.server.models.` `RpmPackage`(**kwargs)

  Bases: `bodhi.server.models.Package`

  Represents a RPM package.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `Stack`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  A group of packages that are commonly pushed together as a group.

  `name`

    unicode – The name of the stack.

  `packages`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of `Packages` associated with this stack.

  `description`

    unicode – A human readable description of the stack.

  `requirements`

    unicode – The required tests for the stack.

  `users`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of `Users` associated with this stack.

  `groups`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of `Groups` associated with this stack.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `TestCase`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Represents test cases from the wiki.

  `name`

    unicode – The name of the test case.

  `package_id`

    int – The primary key of the `Package` associated with this test case.

  `package`

    Package – The package associated with this test case.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `TestCaseKarma`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Karma for a TestCase associated with a comment.

  `karma`

    int – The karma associated with this TestCase comment.

  `comment`

    Comment – The comment this TestCaseKarma is associated with.

  `testcase`

    TestCase – The TestCase this TestCaseKarma pertains to.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class `bodhi.server.models.` `TestGatingStatus`

  Bases: `bodhi.server.models.DeclEnum`

  This class lists the different status the `Update.test_gating_status` flag can have.

  `waiting`

    EnumSymbol – Bodhi is waiting to hear about the test gating status of the update.

  `ignored`

    EnumSymbol – Greenwave said that the update does not require any tests.

  `queued`

    EnumSymbol – Greenwave said that the required tests for this update have been queued.

  `running`

    EnumSymbol – Greenwave said that the required tests for this update are running.

  `passed`

    EnumSymbol – Greenwave said that the required tests for this update have passed.

  `failed`

    EnumSymbol – Greenwave said that the required tests for this update have failed.

class `bodhi.server.models.` `Update`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  This model represents an update.

  `title`

    unicode – The update’s title which uniquely identifies the update. This is generally an ordered list of the build NVRs contained in the update.

  `autokarma`

    bool – A boolean that indicates whether or not the update will be automatically pushed when the stable_karma threshold is reached.

  `stable_karma`

    int – A positive integer that indicates the amount of “good” karma the update must receive before being automatically marked as stable.

  `unstable_karma`

    int – A positive integer that indicates the amount of “bad” karma the update must receive before being automatically marked as unstable.

  `requirements`

    unicode – A list of taskotron tests that must pass for this update to be considered stable.

  `require_bugs`

    bool – Indicates whether or not positive feedback needs to be provided for the associated bugs before the update can be considered stable.

  `require_testcases`

    bool – Indicates whether or not the update requires that positive feedback be given on all associated wiki test cases before the update can pass to stable. If the update has no associated wiki test cases, this option has no effect.

  `notes`

    unicode – Notes about the update. This is a human-readable field that describes what the update is for (e.g. the bugs it fixes).

  `type`

    EnumSymbol – The type of the update (e.g. enhancement, bugfix, etc). It must be one of the values defined in `UpdateType`.

  `status`

    EnumSymbol – The current status of the update. Possible values include ‘pending’ to indicate it is not yet in a repository, ‘testing’ to indicate it is in the testing repository, etc. It must be one of the values defined in `UpdateStatus`.

  `request`

    EnumSymbol – The requested status of the update. This must be one of the values defined in `UpdateRequest` or `None`.

  `severity`

    EnumSymbol – The update’s severity. This must be one of the values defined in `UpdateSeverity`.

  `suggest`

    EnumSymbol – Suggested action a user should take after applying the update. This must be one of the values defined in `UpdateSuggestion`.

  `locked`

    bool – Indicates whether or not the update is locked and un-editable. This is usually set by the masher because the update is going through a state transition.

  `pushed`

    bool – Indicates whether or not the update has been pushed to its requested repository.

  `critpath`

    bool – Indicates whether or not the update is for a “critical path” `Package`. Critical path packages are packages that are required for basic functionality. For example, the kernel `RpmPackage` is a critical path package.

  `close_bugs`

    bool – Indicates whether the Bugzilla bugs that this update is related to should be closed automatically when the update is pushed to stable.

  `date_submitted`

    DateTime – The date that the update was created.

  `date_modified`

    DateTime – The date the update was last modified or `None`.

  `date_approved`

    DateTime – The date the update was approved or `None`.

  `date_pushed`

    DateTime – The date the update was pushed or `None`.

  `date_testing`

    DateTime – The date the update was placed into the testing repository or `None`.

  `date_stable`

    DateTime – The date the update was placed into the stable repository or `None`.

  `alias`

    unicode – The update alias (e.g. FEDORA-EPEL-2009-12345).

  `old_updateid`

    unicode – The legacy update ID which has been deprecated.

  `release_id`

    int – A foreign key to the releases `id`.

  `release`

    Release – The `Release` object this update relates to via the `release_id`.

  `comments`

    sqlalchemy.orm.collections.InstrumentedList – A list of the `Comment` objects for this update.

  `builds`

    sqlalchemy.orm.collections.InstrumentedList – A list of `Build` objects contained in this update.

  `bugs`

    sqlalchemy.orm.collections.InstrumentedList – A list of `Bug` objects associated with this update.

  `cves`

    sqlalchemy.orm.collections.InstrumentedList – A list of `CVE` objects associated with this update.

  `user_id`

    int – A foreign key to the `User` that created this update.

  `test_gating_status`

    EnumSymbol – The test gating status of the update. This must be one of the values defined in `TestGatingStatus` or `None`. None indicates that Greenwave integration was not enabled when the update was created.

  `greenwave_summary_string`

    unicode – A short summary of the outcome from Greenwave (e.g. 2 of 32 required tests failed).

  `compose`

    Compose – The `Compose` that this update is currently being mashed in. The update is locked if this is defined.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `__json__`(request=None, anonymize=False)

    Return a JSON representation of this update.

    Parameters: | request (pyramid.util.Request or None) – The current web request, or None. Passed on to `BodhiBase.__json__()`. anonymize (bool) – Whether to anonymize the results. Passed on to `BodhiBase.__json__()`.
    Returns: | A JSON representation of this update.
    Return type: | basestring

  `__str__`()

    Return a string representation of this update.

    Returns: | A string representation of the update.
    Return type: | basestring

  `abs_url`(request=None)

    Return the absolute URL to this update.

    Parameters: | request (pyramid.util.Request or None) – The current web request. Unused.

  `add_tag`(tag)

    Add the given koji tag to all `Builds` in this update.

    Parameters: | tag (basestring) – The tag to be added to the builds.

  `assign_alias`()

    Return a randomly-suffixed update ID.

    This function used to construct update IDs in a monotonic sequence, but we ran into race conditions so we do it randomly now.

  `beautify_title`(amp=False, nvr=False)

    Will shorten the title according to its length.

    This is used mostly in subject of a update notification email and displaying the title in html. If there are 3 or more builds per title the title be:

    > “package1, package, 2 and XXX more”

    If the “amp” parameter is specified it will replace the and with and &amp; html entity

    If the “nvr” parameter is specified it will include name, version and release information in package labels.

  `builds_json`

    Return a JSON representation of this update’s associated builds.

    Returns: | A JSON list of the `Builds` associated with this update.
    Return type: | basestring

  `check_karma_thresholds`(db, agent)

    Check if we have reached either karma threshold, and adjust state as necessary.

    This method will call `set_request()` if necessary. If the update is locked, it will ignore karma thresholds and raise an Exception.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session. agent (basestring) – The username of the user who has provided karma.
    Raises: | `LockedUpdateException` – If the update is locked.

  `check_requirements`(session, settings)

    Check that an update meets its self-prescribed policy to be pushed.

    Parameters: | session (sqlalchemy.orm.session.Session) – A database session. Unused. settings (bodhi.server.config.BodhiConfig) – Bodhi’s settings.
    Returns: | A tuple containing (result, reason) where result is a bool and reason is a str.
    Return type: | tuple

  `comment`(session, text, karma=0, author=None, anonymous=False, karma_critpath=0, bug_feedback=None, testcase_feedback=None, check_karma=True)

    Add a comment to this update.

    If the karma reaches the ‘stable_karma’ value, then request that this update be marked as stable. If it reaches the ‘unstable_karma’, it is unpushed.

  `comments_since_karma_reset`

    Generate the comments since the most recent karma reset event.

    Karma is reset when `Builds` are added or removed from an update.

    Returns: | `Comments` since the karma reset.
    Return type: | generator

  static `contains_critpath_component`(builds, release_name)

    Determine if there is a critpath component in the builds passed in.

    Parameters: | builds (list) – `Builds` to be considered. release_name (basestring) – The name of the release, such as “f25”.
    Returns: | `True` if the update contains a critical path package, `False` otherwise.
    Return type: | bool

    component

  `content_type`

    Return the ContentType associated with this update.

    If the update has no `Builds`, this evaluates to `None`.

    Returns: | The content type of this update or `None`.
    Return type: | ContentType or None

  `critpath_approved`

    Return whether or not this critpath update has been approved.

    Returns: | True if this update meets critpath testing requirements, False otherwise.
    Return type: | bool

  `date_locked`

    Return the time that this update became locked.

    Returns: | The time this update became locked, or None if it is not locked.
    Return type: | datetime.datetime or None

  `days_in_testing`

    Return the number of days that this update has been in testing.

    Returns: | The number of days since this update’s date_testing if it is set, else 0.
    Return type: | int

  `days_to_stable`

    Return the number of days until an update can be pushed to stable.

    This method will return the number of days until an update can be pushed to stable, or 0. 0 is returned if the update meets testing requirements already, if it doesn’t have a “truthy” date_testing attribute, or if it’s been in testing for the release’s mandatory_days_in_testing or longer.

    Returns: | The number of dates until this update can be pushed to stable, or 0 if it cannot be determined.
    Return type: | int

  classmethod `edit`(request, data)

    Edit the update.

    Parameters: | request (pyramid.util.Request) – The current web request. data (dict) – A key-value mapping of what should be altered in this update.
    Returns: | A 2-tuple of the edited update and a list of dictionaries that describe caveats.
    Return type: | tuple
    Raises: | `LockedUpdateException` – If the update is locked.

  `full_test_cases`

    Return a list of all TestCases associated with all packages in this update.

    Returns: | A list of `TestCases`.
    Return type: | list

  `get_bug_karma`(bug)

    Return the karma for this update for the given bug.

    Parameters: | bug (Bug) – The bug we want the karma about.
    Returns: | A 2-tuple of integers. The first represents negative karma, the second represents positive karma.
    Return type: | tuple

  `get_bugstring`(show_titles=False)

    Return a space-delimited string of bug numbers for this update.

    Parameters: | show_titles (bool) – If True, include the bug titles in the output. If False, include only bug ids.
    Returns: | A space separated list of bugs associated with this update.
    Return type: | basestring

  `get_cvestring`()

    Return a space-delimited string of CVE ids for this update.

    Returns: | A space-separated list of CVE ids.
    Return type: | basestring

  `get_maintainers`()

    Return a list of maintainers who have commit access on the packages in this update.

    Returns: | A list of `Users` who have commit access to all of the packages that are contained within this update.
    Return type: | list

  `get_tags`()

    Return all koji tags for all builds on this update.

    Returns: | basestrings of the koji tags used in this update.
    Return type: | list

  `get_testcase_karma`(testcase)

    Return the karma for this update for the given TestCase.

    Parameters: | testcase (TestCase) – The TestCase we want the karma about.
    Returns: | A 2-tuple of integers. The first represents negative karma, the second represents positive karma.
    Return type: | tuple

  `get_title`(delim=' ', limit=None, after_limit='\xe2\x80\xa6')

    Return a title for the update based on the `Builds` it is associated with.

    Parameters: | delim (basestring) – The delimeter used to separate the builds. Defaults to ‘ ‘. limit (int or None) – If provided, limit the number of builds included to the given number. If `None` (the default), no limit is used. after_limit (basestring) – If a limit is set, use this string after the limit is reached. Defaults to ‘…’.
    Returns: | A title for this update.
    Return type: | basestring

  `get_url`()

    Return the relative URL to this update.

    Returns: | A URL.
    Return type: | basestring

  `greenwave_subject`

    Form and return the proper Greenwave API subject field for this Update.

    Returns: | A list of dictionaries that are appropriate to be passed to the Greenwave API subject field for a decision about this Update.
    Return type: | list

  `greenwave_subject_json`

    Form and return the proper Greenwave API subject field for this Update as JSON.

    Returns: | A JSON list of objects that are appropriate to be passed to the Greenwave API subject field for a decision about this Update.
    Return type: | basestring

  `karma`

    Calculate and return the karma for the Update.

    Returns: | The Update’s current karma.
    Return type: | int

  `last_modified`

    Return the last time this update was edited or created.

    This gets used specifically by taskotron/resultsdb queries so we only query for test runs that occur after the last time this update (in its current form) was in play.

    Returns: | The most recent time of modification or creation.
    Return type: | datetime.datetime
    Raises: | `ValueError` – If the update has no timestamps set, which should not be possible.

  `mandatory_days_in_testing`

    Calculate and return how many days an update should be in testing before becoming stable.

    Returns: | The number of mandatory days in testing.
    Return type: | int

  `meets_testing_requirements`

    Return whether or not this update meets its release’s testing requirements.

    If this update’s release does not have a mandatory testing requirement, then simply return True.

    Returns: | True if the update meets testing requirements, False otherwise.
    Return type: | bool

  `met_testing_requirements`

    Return True if the update has already been found to meet requirements in the past.

    Return whether or not this update has already met the testing requirements and bodhi has commented on the update that the requirements have been met. This is used to determine whether bodhi should add the comment about the Update’s eligibility to be pushed, as we only want Bodhi to add the comment once.

    If this release does not have a mandatory testing requirement, then simply return True.

    Returns: | See description above for what the bool might mean.
    Return type: | bool

  `modify_bugs`()

    Comment on and close this update’s bugs as necessary.

    This typically gets called by the Masher at the end.

  classmethod `new`(request, data)

    Create a new update.

    Parameters: | request (pyramid.util.Request) – The current web request. data (dict) – A key-value mapping of the new update’s attributes.
    Returns: | A 2-tuple of the edited update and a list of dictionaries that describe caveats.
    Return type: | tuple

  `num_admin_approvals`

    Return the number of Releng/QA approvals of this update.

    Returns: | The number of admin approvals found in the comments of this update.
    Return type: | int

  `obsolete`(db, newer=None)

    Obsolete this update.

    Even though unpushing/obsoletion is an “instant” action, changes in the repository will not propagate until the next mash takes place.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session. newer (Update or None) – If given, the update that has obsoleted this one. Defaults to `None`.

  `obsolete_if_unstable`(db)

    Obsolete the update if it reached the negative karma threshold while pending.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session.

  `obsolete_older_updates`(db)

    Obsolete any older pending/testing updates.

    If a build is associated with multiple updates, make sure that all updates are safe to obsolete, or else just skip it.

  `product_version`

    Return a string of the product version that this update’s release is associated with.

    The product version is a string, such as “fedora-26”, and is used when querying Greenwave for test gating decisions.

    Returns: | The product version associated with this Update’s Release.
    Return type: | basestring

  `remove_tag`(tag, koji=None)

    Remove the given koji tag from all builds in this update.

    Parameters: | tag (basestring) – The tag to remove from the `Builds` in this update. koji (koji.ClientSession or None) – A koji client to use to perform the action. If None (the default), this method will use `buildsys.get_session()` to get one and multicall will be used.
    Returns: | If a koji client was provided, `None` is returned. Else, a list of tasks from `koji.multiCall()` are returned.
    Return type: | list or None

  `requested_tag`

    Return the tag the update has requested.

    Returns: | The Koji tag that corresponds to the update’s current request, or None if the method is unable to do so.
    Return type: | basestring or None

  `requirements_json`

    Return a JSON representation of this update’s requirements.

    Returns: | A JSON representation of this update’s requirements.
    Return type: | basestring

  `revoke`()

    Remove pending request for this update.

    Raises: | `BodhiException` – If the update doesn’t have a request set, or if it is not in an expected status.

  `send_update_notice`()

    Send e-mail notices about this update.

  `set_request`(db, action, username)

    Set the update’s request to the given action.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session. action (UpdateRequest or basestring) – The desired request. May be expressed as an UpdateRequest instance, or as a string describing the desired request. username (basestring) – The username of the user making the request.
    Raises: | `BodhiException` – Two circumstances can raise this `Exception`: If the user tries to push a critical path update directly from pending to stable. If the update doesn’t meet testing requirements. `LockedUpdateException` – If the update is locked.

  `signed`

    Return whether the update is considered signed or not.

    This will return `True` if all `Builds` associated with this update are signed, or if the associated `Release` does not have a `pending_signing_tag` defined. Otherwise, it will return `False`.

    Returns: | `True` if the update is signed, `False` otherwise.
    Return type: | bool

  `status_comment`(db)

    Add a comment to this update about a change in status.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session.

  `test_cases`

    Return a list of all TestCase names associated with all packages in this update.

    Returns: | A list of basestrings naming the `TestCases` associated with this update.
    Return type: | list

  `test_gating_passed`

    Returns a boolean representing if this update has passed the test gating.

    Returns: | Returns True if the Update’s test_gating_status property is None, ignored, or passed. Otherwise it returns False.
    Return type: | bool

  `unpush`(db)

    Move this update back to its dist-fX-updates-candidate tag.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session.
    Raises: | `BodhiException` – If the update isn’t in testing.

  `untag`(db)

    Untag all of the `Builds` in this update.

    Parameters: | db (sqlalchemy.orm.session.Session) – A database session.

  `update_bugs`(bug_ids, session)

    Make the update’s bugs consistent with the given list of bug ids.

    Create any new bugs, and remove any missing ones. Destroy removed bugs that are no longer referenced anymore. If any associated bug is found to be a security bug, alter the update to be a security update.

    Parameters: | bug_ids (list) – A list of basestrings of bug ids to associate with this update. session (sqlalchemy.orm.session.Session) – A database session.
    Returns: | `Bugs` that are newly associated with the update.
    Return type: | list

  `update_cves`(cves, session)

    Create any new CVES, and remove any missing ones.

    This method cannot possibly work:
      https://github.com/fedora-infra/bodhi/issues/1998#issuecomment-344332011

    Parameters: | cves (list) – A list of basestrings of CVE identifiers. session (sqlalchemy.orm.session.Session) – A database session.

  `url`(request=None)

    Return the absolute URL to this update.

    Parameters: | request (pyramid.util.Request or None) – The current web request. Unused.

  `validate_builds`(key, build)

    Validate builds being appended to ensure they are all the same type.

    Parameters: | key (str) – The field’s key, which is un-used in this validator. build (Build) – The build object which was appended to the list of builds.
    Raises: | `ValueError` – If the build being appended is not the same type as the existing builds.

  `validate_release`(key, release)

    Make sure the release is the same content type as this update.

    Parameters: | key (str) – The field’s key, which is un-used in this validator. release (Release) – The release object which is being associated with this update.
    Raises: | `ValueError` – If the release being associated is not the same content type as the update.

  `waive_test_results`(username, comment=None)

    Attempt to waive test results for this update.

    Parameters: | username (basestring) – The name of the user who is waiving the test results. comment (basestring) – A comment from the user describing their decision.
    Raises: | `LockedUpdateException` – If the Update is locked. `BodhiException` – If test gating is not enabled in this Bodhi instance, or if the tests have passed.

class `bodhi.server.models.` `UpdateRequest`

  Bases: `bodhi.server.models.DeclEnum`

  An enum used to specify an update requesting to change states.

  `testing`

    EnumSymbol – The update is requested to change to testing.

  `batched`

    EnumSymbol – The update is requested to be pushed to stable during the next batch push.

  `obsolete`

    EnumSymbol – The update has been obsoleted by another update.

  `unpush`

    EnumSymbol – The update no longer needs to be released.

  `revoke`

    EnumSymbol – The unpushed update will no longer be mashed in any repository.

  `stable`

    EnumSymbol – The update is ready to be pushed to the stable repository.

class `bodhi.server.models.` `UpdateSeverity`

  Bases: `bodhi.server.models.DeclEnum`

  An enum used to specify the severity of the update.

  `unspecified`

    EnumSymbol – The packager has not specified a severity.

  `urgent`

    EnumSymbol – The update is urgent, and will skip the batched state automatically.

  `high`

    EnumSymbol – The update is high severity.

  `medium`

    EnumSymbol – The update is medium severity.

  `low`

    EnumSymbol – The update is low severity.

class `bodhi.server.models.` `UpdateStatus`

  Bases: `bodhi.server.models.DeclEnum`

  An enum used to describe the current state of an update.

  `pending`

    EnumSymbol – The update is not in any repository.

  `testing`

    EnumSymbol – The update is in the testing repository.

  `stable`

    EnumSymbol – The update is in the stable repository.

  `unpushed`

    EnumSymbol – The update had been in a testing repository, but has been removed.

  `obsolete`

    EnumSymbol – The update has been obsoleted by another update.

  `processing`

    EnumSymbol – Unused.

class `bodhi.server.models.` `UpdateSuggestion`

  Bases: `bodhi.server.models.DeclEnum`

  An enum used to tell the user whether they need to reboot or logout after applying an update.

  `unspecified`

    EnumSymbol – No action is needed.

  `reboot`

    EnumSymbol – The user should reboot after applying the update.

  `logout`

    EnumSymbol – The user should logout after applying the update.

class `bodhi.server.models.` `UpdateType`

  Bases: `bodhi.server.models.DeclEnum`

  An enum used to classify the type of the update.

  `bugfix`

    EnumSymbol – The update fixes bugs only.

  `security`

    EnumSymbol – The update addresses security issues.

  `newpackage`

    EnumSymbol – The update introduces new packages to the release.

  `enhancement`

    EnumSymbol – The update introduces new features.

class `bodhi.server.models.` `User`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  A Bodhi user.

  `name`

    unicode – The username.

  `email`

    unicode – An e-mail address for the user.

  `show_popups`

    bool – If True, the web interface will display fedmsg popups to the user. Defaults to True.

  `comments`

    sqlalchemy.orm.dynamic.AppenderQuery – An iterable of `Comments` the user has written.

  `updates`

    sqlalchemy.orm.dynamic.AppenderQuery – An iterable of `Updates` the user has created.

  `groups`

    sqlalchemy.orm.collections.InstrumentedList – An iterable of `Groups` the user is a member of.

  `__init__`(**kwargs)

    A simple constructor that allows initialization from kwargs.

    Sets attributes on the constructed instance using the names and values in `kwargs`.

    Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

  `avatar`(request)

    Return a URL for the User’s avatar, or None if request is falsey.

    Parameters: | request (pyramid.util.Request) – The current web request.
    Returns: | A URL for the User’s avatar, or None if request is falsey.
    Return type: | basestring or None

  `openid`(request)

    Return an openid identity URL.

    Parameters: | request (pyramid.util.Request) – The current web request.
    Returns: | The openid identity URL for the User object.
    Return type: | basestring