canonical / canonical/cloud-init

cloud-init does not take into consideration proxy when adding PPA's.

Open
#2,713 4 comments 0 reactions 0 assignees View on GitHub
incomplete launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

This bug was originally filed in Launchpad as [LP: #1618467](https://bugs.launchpad.net/cloud-init/+bug/1618467)

Launchpad details

affected_projects = ['maas']

assignee = None
assignee_name = None
date_closed = None
date_created = 2016-08-30T13:46:37.294947+00:00
date_fix_committed = 2017-11-10T18:12:30.655071+00:00
date_fix_released = 2017-11-10T18:12:30.655071+00:00
id = 1618467
importance = undecided
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1618467
milestone = None
owner = andreserl
owner_name = Andres Rodriguez
private = False
status = incomplete
submitter = andreserl
submitter_name = Andres Rodriguez
tags = []
duplicates = [1618466, 1696819]

_Launchpad user **Andres Rodriguez(andreserl)** wrote on 2016-08-30T13:46:37.294947+00:00_

In an environment behind a proxy, I've noticed that cloud-init fails to add a PPA because it fails to use the proxy to add such PPA. For example, in this environment we are adding a PPA APT source & defining the proxy for APT. See below:

2017-06-08 19:50:26,126 - cc_apt_configure.py[DEBUG]: apt config: convert V2 to V3 format for keys 'apt_proxy'
2017-06-08 19:50:26,126 - cc_apt_configure.py[DEBUG]: apt config: V1/2 and V3 format specified, preferring V3
2017-06-08 19:50:26,126 - cc_apt_configure.py[DEBUG]: debconf_selections was not set in config
2017-06-08 19:50:26,126 - cc_apt_configure.py[DEBUG]: handling apt config: {'sources': {'hardware_cert_3': {'source': 'ppa:hardware-certification/public'}}, 'proxy': 'http://10.90.90.1:8000/', 'preserve_sources_list': False, 'security': [{'uri': 'http://archive.ubuntu.com/ubuntu', 'arches': ['default']}], 'primary': [{'uri': 'http://archive.ubuntu.com/ubuntu', 'arches': ['default']}]}

However, this fails to add with the following:

2017-06-08 19:50:26,301 - util.py[DEBUG]: Running command ['add-apt-repository', 'ppa:hardware-certification/public'] with allowed return codes [0] (shell=False, capture=True)
2017-06-08 19:50:37,110 - cc_apt_configure.py[ERROR]: add-apt-repository failed.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 609, in add_apt_sources
util.subp(["add-apt-repository", source], target=target)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1814, in subp
cmd=args)
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['add-apt-repository', 'ppa:hardware-certification/public']
Exit code: 1
Reason: -
Stdout: Cannot add PPA: 'ppa:~hardware-certification/ubuntu/public'.
ERROR: '~hardware-certification' user or team does not exist.
Stderr: -

cloud-init should be using the provided proxy to attempt to add the PPA, provided that cloud-init is being told about a proxy that APT should use. In other words, since we are defining the proxy for APT, it makes sense we use the proxy to PPA add repositories as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.