#1017 Avoid repeating default context with literal text
Merged 7 months ago by mprahl. Opened 7 months ago by cqi.
cqi/fm-orchestrator default-context  into  master

@@ -40,6 +40,8 @@ 

  from sqlalchemy.orm import lazyload

  from sqlalchemy import func, and_

  

+ DEFAULT_MODULE_CONTEXT = '00000000'

+ 

  

  # Just like koji.BUILD_STATES, except our own codes for modules.

  BUILD_STATES = {

@@ -173,7 +175,7 @@ 

      ref_build_context = db.Column(db.String)

      build_context = db.Column(db.String)

      runtime_context = db.Column(db.String)

-     context = db.Column(db.String, server_default='00000000')

+     context = db.Column(db.String, server_default=DEFAULT_MODULE_CONTEXT)

      state = db.Column(db.Integer, nullable=False)

      state_reason = db.Column(db.String)

      modulemd = db.Column(db.String, nullable=False)

@@ -139,7 +139,7 @@ 

                  queried_mmd = mmd

                  nsvc = ':'.join([

                      mmd.get_name(), mmd.get_stream(), str(mmd.get_version()),

-                     mmd.get_context() or '00000000'])

+                     mmd.get_context() or models.DEFAULT_MODULE_CONTEXT])

              else:

                  build = models.ModuleBuild.get_build_from_nsvc(

                      session, name, stream, version, context)

@@ -245,7 +245,7 @@ 

                  continue

  

              if "context" not in details:

-                 details["context"] = "00000000"

+                 details["context"] = models.DEFAULT_MODULE_CONTEXT

              modules = self._get_modules(

                  name, details['stream'], details['version'],

                  details['context'], strict=True)

@@ -264,7 +264,7 @@ 

               log messages collected during import (list)

      :rtype: tuple

      """

-     mmd.set_context("00000000")

+     mmd.set_context(models.DEFAULT_MODULE_CONTEXT)

      name = mmd.get_name()

      stream = mmd.get_stream()

      version = str(mmd.get_version())