#273 Disable `logging` in `odcs-mock-runroot init` and allow extra mount points.
Merged 4 years ago by jkaluza. Opened 4 years ago by jkaluza.
jkaluza/odcs mock-runroot  into  master

file modified
+6 -1
@@ -402,7 +402,12 @@ 

                  "default_queue": "pungi_composes",

              },

              'desc': 'Configuration for custom celery router.'

-         }

+         },

+         'runroot_extra_mounts': {

+             'type': list,

+             'default': [],

+             'desc': 'Extra mountpoint directories for odcs-mock-runroot.'

+         },

      }

  

      def __init__(self, conf_section_obj):

@@ -48,6 +48,7 @@ 

  import os

  import uuid

  import tempfile

+ import logging

  

  from odcs.server import conf

  from odcs.server.backend import create_koji_session
@@ -129,6 +130,11 @@ 

      # Generate the runroot_key.

      runroot_key = str(uuid.uuid1())

  

+     # Disable logging completely for the rest of execution, because the only

+     # thing we must print is the runroot_key and the general logging to stdout

+     # would confuse Pungi when calling this method.

+     logging.disable(logging.CRITICAL)

+ 

      # Get the latest Koji repo associated with the tag.

      koji_module = koji.get_profile_module(conf.koji_profile)

      koji_session = create_koji_session()
@@ -196,7 +202,7 @@ 

  

      try:

          # Mount the conf.targetdir in the Mock chroot.

-         do_mounts(rootdir, [conf.target_dir])

+         do_mounts(rootdir, [conf.target_dir] + conf.runroot_extra_mounts)

  

          # Wrap the runroot command in /bin/sh, because that's how Koji does

          # that and we need to stay compatible with this way...
@@ -208,7 +214,7 @@ 

          execute_mock(runroot_key, args, False)

      finally:

          # In the end of run, umount the conf.targetdir.

-         undo_mounts(rootdir, [conf.target_dir])

+         undo_mounts(rootdir, [conf.target_dir] + conf.runroot_extra_mounts)

  

  

  def mock_runroot_main(argv=None):

The extra mount-points are needed to also mount /mnt/koji in the Mock
environment.

Pull-Request has been merged by jkaluza

4 years ago