Bug 766199 - Unable to set proxy for all roots
Summary: Unable to set proxy for all roots
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 16
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-10 22:42 UTC by Jan Kratochvil
Modified: 2012-02-24 23:41 UTC (History)
5 users (show)

Fixed In Version: mock-1.0.28-1.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-22 05:25:03 UTC
Type: ---


Attachments (Terms of Use)
simple patch to propagate proxy environment variable setting (552 bytes, patch)
2011-12-11 15:48 UTC, Clark Williams
no flags Details | Diff
Patch to setup http_proxy environment variable in chroot via config (1.83 KB, patch)
2012-01-02 16:25 UTC, Clark Williams
no flags Details | Diff
call chroot.doChroot to pass configured environment to chroot when running a rebuild (858 bytes, patch)
2012-01-04 21:05 UTC, Clark Williams
no flags Details | Diff

Description Jan Kratochvil 2011-12-10 22:42:23 UTC
Description of problem:
In fact I do not know how to set it.

Version-Release number of selected component (if applicable):
mock-1.1.18-1.fc16.noarch

How reproducible:
Always.

Steps to Reproduce:
mock -r fedora-16-x86_64 --init

Actual results:
Downloads happen directly from Internet.

Expected results:
Downloads happen via http://127.0.0.1:3128

Additional info:
http://fedoraproject.org/wiki/Extras/MockTricks#Using_Squid_to_Speed_Up_Mock_package_downloads
seems wrong to me wrt
echo export http_proxy=\"http://localhost:3128\" >> /home/build/.bash_profile
as there is no "build" user and it does not work for "root" user during --init.

export http_proxy=http://localhost:3128; mock ...
does not work as mock is `consolehelper' and it immediately clears whole environment.  Maybe one could set up /etc/pam.d/mock using pam_env.so somehow.

Putting to /etc/mock/site-defaults.cfg
config_opts['yum.conf'] = """
[main]
proxy=http://127.0.0.1:3128/
"""
also does not work, assuming config_opts['yum.conf'] gets overwritten by /etc/mock/specificconfig.cfg.

Comment 1 Clark Williams 2011-12-11 15:20:18 UTC
Jan, 

You're going to have to help me a bit with some Proxy 101. I understand that what we're trying to do here is redirect HTTP requests from going straight to a network interface/address/port tuple to go to  specified localhost port, presumably where a proxy (squid) is listening. That's about the extent of my proxy experience. 

Guessing that "build" from the receipe above, should actually be <your login> so that what you're doing is setting the environment variable http_proxy in the account that is also a member of the mock group. If the environment variable 'http-proxy' is the redirection mechanism, I'll bet it's been broken for a while. Consolehelper and the environment variable cleanup probably killed it. So, let me poke a bit at the configuration code. I believe what we need is:

1. make sure that http_proxy gets into the environment after the consolehelper startup (take the value from the config file)

and/or

2. ensure we configure the yum config file properly.

Comment 2 Clark Williams 2011-12-11 15:48:46 UTC
Created attachment 545339 [details]
simple patch to propagate proxy environment variable setting

Jan,

Please try adding this patch (since you already have a squid setup). If you can't I'll try it tomorrow.

Comment 3 Jan Kratochvil 2011-12-11 17:23:02 UTC
Thanks, just I do not see a change with this patch.  Tried in /etc/mock/site-defaults.cfg both:
config_opts['environment']['http_proxy'] = 'http://127.0.0.1:3128/'
and
config_opts['http_proxy'] = 'http://127.0.0.1:3128/'

and it always ends up:

A \_ mock -r fedora-16-x86_64 --init
B   \_ /usr/bin/python -tt /usr/sbin/mock -r fedora-16-x86_64 --init
C     \_ /usr/bin/python /usr/bin/yum --installroot /var/lib/mock/fedora-16-x86_64/root/ groupinstall buildsys-build

B:
DISPLAY=:0.0
LANG=en_US.UTF-8
SHELL=/bin/bash
TERM=xterm
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/root/bin
LOGNAME=root
USER=root
USERHELPER_UID=0
HOME=/root

C:
LANG=en_US.UTF-8
TERM=vt100
SHELL=/bin/bash
HOSTNAME=mock
HOME=/builddir
PATH=/usr/bin:/bin:/usr/sbin:/sbin
TMPDIR=/tmp

with no http_proxy anywhere (and still downloading without any proxy).

(In reply to comment #2)
> (since you already have a squid setup).

IMO if it just starts erroring out on ECONNREFUSED it is a win for you.

Comment 4 Clark Williams 2012-01-02 16:25:41 UTC
Created attachment 550269 [details]
Patch to setup http_proxy environment variable in chroot via config

I believe this patch sets up http_proxy properly. Uncomment the variable definition in site-defaults.cfg and it should setup http_proxy in the chroot (at least when I did it with --shell it was there and yum failed miserably when running in the chroot :).

Comment 5 Jan Kratochvil 2012-01-02 22:08:06 UTC
(In reply to comment #4)
> I believe this patch sets up http_proxy properly.

It does not for me.  It is the same patch as in Comment 2 and it does not work the same way I described in Comment 3:

I did:
  patch /usr/lib/python2.7/site-packages/mockbuild/backend.py </tmp/1
and put
  config_opts['http_proxy'] = 'http://localhost:3128'
to
  /etc/mock/site-defaults.cfg
and ran
  mock -r fedora-16-x86_64 --init
and got in netstat -p:
  tcp 0 0 host2.jan:47634 odysseus.ip6.fi.muni.c:http ESTABLISHED 24068/python
  tcp 0 0 host2.jan:44958 2610:28:3090:3001:dead:http ESTABLISHED 24068/python
while 24068 was:
  24053 \_ mock -r fedora-16-x86_64 --init
  24054     \_ /usr/bin/python -tt /usr/sbin/mock -r fedora-16-x86_64 --init
  24068         \_ /usr/bin/python /usr/bin/yum --installroot /var/lib/mock/fedora-16-x86_64/root/ groupinstall buildsys-build
and
  /var/log/squid/access.log
also remained completely empty.

> it should setup http_proxy in the chroot (at least when I did it with --shell
> it was there and yum failed miserably when running in the chroot :).

It may have effect for --shell but that is a second step.  I can easily workaround that part (in fact my .bashrc already probably workarounds that).

Proxy support for mock should IMO primarily mean to support proxy
for mock --init and mock --update.

Sure still thanks for the patch.

Comment 6 Clark Williams 2012-01-04 21:05:17 UTC
Created attachment 550762 [details]
call chroot.doChroot to pass configured environment to chroot when running a rebuild

Argghh, I forgot this patch, which actually passes the appropriate environment to the chroot when running a rebuild.

Comment 7 Jan Kratochvil 2012-01-04 21:51:32 UTC
I have used the Comment 6 patch for /usr/sbin/mock , together with the state of Comment 5, and I still see no proxy used on --init.  Does it work for you?

Comment 8 Fedora Update System 2012-01-13 20:18:44 UTC
mock-1.1.19-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.19-1.el6

Comment 9 Fedora Update System 2012-01-13 20:19:19 UTC
mock-1.1.19-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/mock-1.1.19-1.fc16

Comment 10 Fedora Update System 2012-01-13 20:19:51 UTC
mock-1.0.26-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.26-1.el5

Comment 11 Fedora Update System 2012-01-13 20:20:23 UTC
mock-1.1.19-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.19-1.fc15

Comment 12 Jan Kratochvil 2012-01-13 20:24:09 UTC
Why is this Bug MODIFIED and included in Bodhi when it still does not work?
This is not true:
 * add code to allow global proxy in chroot [BZ# 766199]

Comment 13 Fedora Update System 2012-01-14 19:30:05 UTC
mock-1.1.19-2.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.19-2.fc15

Comment 14 Fedora Update System 2012-01-14 19:30:43 UTC
mock-1.1.19-2.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.19-2.el6

Comment 15 Fedora Update System 2012-01-14 19:31:17 UTC
mock-1.0.26-2.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.26-2.el5

Comment 16 Fedora Update System 2012-01-14 19:31:52 UTC
mock-1.1.19-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/mock-1.1.19-2.fc16

Comment 17 Fedora Update System 2012-01-15 23:26:21 UTC
Package mock-1.1.19-2.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing mock-1.1.19-2.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-0134/mock-1.1.19-2.el6
then log in and leave karma (feedback).

Comment 18 Jan Kratochvil 2012-01-16 00:16:30 UTC
It works now, for --init, --update and even yum inside --shell.
It ignores $http_proxy but it follows config_opts['http_proxy'] in /etc/mock/site-defaults.cfg .
Thanks!

Comment 19 Fedora Update System 2012-01-16 02:20:05 UTC
Package mock-1.1.19-2.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mock-1.1.19-2.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-0536/mock-1.1.19-2.fc15
then log in and leave karma (feedback).

Comment 20 Fedora Update System 2012-01-22 05:25:03 UTC
mock-1.1.19-2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2012-02-01 16:45:39 UTC
mock-1.1.20-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.20-1.fc15

Comment 22 Fedora Update System 2012-02-01 16:46:34 UTC
mock-1.1.20-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.20-1.el6

Comment 23 Fedora Update System 2012-02-01 16:47:19 UTC
mock-1.1.20-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/mock-1.1.20-1.fc16

Comment 24 Fedora Update System 2012-02-01 16:48:08 UTC
mock-1.0.27-2.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.27-2.el5

Comment 25 Fedora Update System 2012-02-08 22:57:46 UTC
mock-1.1.20-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 26 Fedora Update System 2012-02-09 02:22:17 UTC
mock-1.1.21-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.21-1.fc15

Comment 27 Fedora Update System 2012-02-09 02:23:00 UTC
mock-1.1.21-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.21-1.el6

Comment 28 Fedora Update System 2012-02-09 02:23:45 UTC
mock-1.0.28-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.28-1.el5

Comment 29 Fedora Update System 2012-02-09 02:24:27 UTC
mock-1.1.21-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/mock-1.1.21-1.fc16

Comment 30 Fedora Update System 2012-02-15 23:56:24 UTC
mock-1.1.21-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 31 Fedora Update System 2012-02-19 02:00:38 UTC
mock-1.1.21-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 32 Fedora Update System 2012-02-24 23:37:44 UTC
mock-1.1.21-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 33 Fedora Update System 2012-02-24 23:41:13 UTC
mock-1.0.28-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.