maas-import-isos ignores http_proxy

Bug #991553 reported by Julian Edwards
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Jeroen T. Vermeulen

Bug Description

This makes it impossible to download the ISOs from a proxied LAN.

You can see that it fails by doing the following:

export http_proxy=http://example.com/
sudo maas-import-isos

And you get the output:
--2012-04-30 10:25:56-- http://archive.ubuntu.com/ubuntu/dists/precise-updates/main/installer-amd64/current/images/netboot/mini.iso
Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.92.151, 91.189.92.152, 91.189.92.153, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.92.151|:80... connected.
...

which means it ignored the proxy setting.

Since ultimately the script uses wget, this should really work.

Related branches

Changed in maas:
status: New → Triaged
importance: Undecided → High
Changed in maas:
assignee: nobody → Jeroen T. Vermeulen (jtv)
status: Triaged → In Progress
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The “sudo” would discard the setting you just exported. Does it behave as expected if you do it like this?

$ sudo env http_proxy=http://example.com/ maas-import isos

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Ahem. Typo. Correction:

$ sudo env http_proxy=http://example.com/ maas-import-isos

Revision history for this message
Scott Moser (smoser) wrote :

Jeroen is correct. sometime between 10.04 and 12.04 (i think) sudo started being more annoying about filtering environment variables. Note, though, you do no need the 'env' command, as sudo does it itself:

 sudo http_proxy=..... maas-import-isos

Additionally, you could actually just add:
  export http_proxy=http://example.com
to the /etc/maas/import_isos config file.

Revision history for this message
Shannon McFarland (shmcfarl) wrote :

Nice work guys!!! I actually just ran it as root and it worked instantly after doing an export. In the future I will probably pu tit in the import_isos file as Scott stated.

Thanks again!

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Jeroen, I suggest you update the documentation on how to set a proxy. There's no actual fix to code here.

Changed in maas:
status: In Progress → Fix Committed
Revision history for this message
drolfe (drolfe) wrote :

Use Sudo -E

From the sudo man page

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.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

I didn't use the -E option because it has more far-reaching consequences and so might do collateral damage. But the bit about the error is another reason not to do it.

Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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