When the configuration item 'http_proxy' is set, no proxy is used to download boot images.

Bug #1081229 reported by Raphaël Badin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Raphaël Badin

Bug Description

Even when a configuration item 'http_proxy' is set to a valid proxy, the downloading of the boot images is done without taking into account this setting.

Adding logging in /usr/share/pyshared/provisioningserver/tasks.py:import_boot_images, I can confirm that the env is setup all right (here is the result of str(env) just before check_call is calls in tasks.py: http://paste.ubuntu.com/1372967/). Something seems to go wrong after that.

Related branches

Revision history for this message
Raphaël Badin (rvb) wrote :

I think the problem comes from the fact that we're running the script using 'sudo' and it does not preserve the env variable by default:

If I setup a bogus http_proxy/https_proxy:

ubuntu@server:~$ export https_proxy="http://tesasdsad.com:54656"
ubuntu@server:~$ export http_proxy="http://tesasdsad.com:54656"

Running 'sudo /usr/sbin/maas-import-pxe-files ' completely ignores the http_proxy/https_proxy:

ubuntu@server:~$ sudo /usr/sbin/maas-import-pxe-files
Downloading to temporary location /tmp/tmp.GqdxRN2zP9.
/tmp/tmp.GqdxRN2zP9 ~
2012-11-21 08:16:35 URL:http://archive.ubuntu.com/ubuntu//dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64//linux [4965840/4965840] -> "linux" [1]
2012-11-21 08:16:36 URL:http://archive.ubuntu.com/ubuntu//dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64//initrd.gz [17446386/17446386] -> "initrd.gz" [1]
2012-11-21 08:16:36 URL:http://archive.ubuntu.com/ubuntu//dists/quantal/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64//linux [5130968/5130968] -> "linux" [1]

Unless I run 'sudo' with -E:

ubuntu@server:~$ sudo -E /usr/sbin/maas-import-pxe-files
Downloading to temporary location /tmp/tmp.SubyXtYVEG.
/tmp/tmp.SubyXtYVEG ~
wget: unable to resolve host address `tesasdsad.com'

From sudo's man:
       -E The -E (preserve environment) option indicates to the
                   security policy that the user wishes to preserve their
                   existing environment variables. The security policy may
                   return an error if the -E option is specified and the user
                   does not have permission to preserve the environment.

Raphaël Badin (rvb)
Changed in maas:
assignee: nobody → Raphaël Badin (rvb)
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.