Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -S option when calling add-apt-repository for a line starting with deb #771

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions charmhelpers/fetch/ubuntu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
import time

from charmhelpers import deprecate
from charmhelpers.core.host import get_distrib_codename, get_system_env
from charmhelpers.core.host import (
CompareHostReleases,
get_distrib_codename,
get_system_env,
)


from charmhelpers.core.hookenv import (
log,
Expand Down Expand Up @@ -760,9 +765,16 @@ def _add_apt_repository(spec):
:param spec: the parameter to pass to add_apt_repository
:type spec: str
"""
series = get_distrib_codename()
if '{series}' in spec:
series = get_distrib_codename()
spec = spec.replace('{series}', series)
cmd = ['add-apt-repository', '--yes']
if (spec.strip().startswith('deb')
and CompareHostReleases(series) >= 'jammy'):
# if starts with deb, just add the source.list as per lp:2017014, only
# in jammy or newer
cmd.append('-S')
cmd.append(spec)
_run_with_retries(['add-apt-repository', '--yes', spec],
cmd_env=env_proxy_settings(['https', 'http', 'no_proxy'])
)
verterok marked this conversation as resolved.
Show resolved Hide resolved
Expand Down