#496 Always set a value for Mock Configuration Directory
Opened 2 years ago by thebeanogamer. Modified 2 years ago
thebeanogamer/FedoraReview mockconfigpath  into  master

file modified
+4 -2
@@ -167,12 +167,14 @@ 

          if Settings.mock_config:

              config = Settings.mock_config

          if Settings.configdir:

-             mockbuild.constants.MOCKCONFDIR = Settings.configdir

+             config_path = Settings.configdir

+         else:

+             config_path = "/etc/mock"

  

          # we need disable trace from mock.util to avoid a lot of spurious

          # messages which are send to stdout

          logging.getLogger("trace").propagate = 0

-         config_opts = mockbuild.config.simple_load_config(config)

+         config_opts = mockbuild.config.simple_load_config(config, config_path)

          # tmpfs plugin needs to be disabled, otherwise the chroot will be wiped after the build

          # and we are going to work there

          config_opts["plugin_conf"]["tmpfs_enable"] = False

If you don't explicitly set one, Mock assumes it should look in ../etc. This causes things like venvs to explode. See mockbuild/constant.py#10.

You could also fix this problem by setting a default in the constructor for Settings, but doing it here seems safer.

Metadata