apt_repository: Update PPA URL to point to HTTPS (#82599)

Fixes: #82463

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/82657/head
Abhijeet Kasurde 3 months ago committed by GitHub
parent b6a89bff6c
commit e78be30baa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,3 @@
---
bugfixes:
- apt_repository - update PPA URL to point to https URL (https://github.com/ansible/ansible/issues/82463).

@ -465,6 +465,7 @@ class UbuntuSourcesList(SourcesList):
# prefer api.launchpad.net over launchpad.net/api
# see: https://github.com/ansible/ansible/pull/81978#issuecomment-1767062178
LP_API = 'https://api.launchpad.net/1.0/~%s/+archive/%s'
PPA_URI = 'https://ppa.launchpadcontent.net'
def __init__(self, module):
self.module = module
@ -496,7 +497,7 @@ class UbuntuSourcesList(SourcesList):
except IndexError:
ppa_name = 'ppa'
line = 'deb http://ppa.launchpad.net/%s/%s/ubuntu %s main' % (ppa_owner, ppa_name, self.codename)
line = 'deb %s/%s/%s/ubuntu %s main' % (self.PPA_URI, ppa_owner, ppa_name, self.codename)
return line, ppa_owner, ppa_name
def _key_already_exists(self, key_fingerprint):

@ -3,7 +3,7 @@
- set_fact:
test_ppa_name: 'ppa:git-core/ppa'
test_ppa_filename: 'git-core'
test_ppa_spec: 'deb http://ppa.launchpad.net/git-core/ppa/ubuntu {{ansible_distribution_release}} main'
test_ppa_spec: 'deb https://ppa.launchpadcontent.net/git-core/ppa/ubuntu {{ansible_distribution_release}} main'
test_ppa_key: 'E1DF1F24' # http://keyserver.ubuntu.com:11371/pks/lookup?search=0xD06AAF4C11DAB86DF421421EFE6B20ECA7AD98A1&op=index
- name: show python version
@ -288,6 +288,47 @@
apt: pkg=local-apt-repository state=absent purge=yes
#
# TEST: PPA HTTPS URL
#
- name: Add PPA using HTTPS URL
apt_repository:
repo: 'ppa:deadsnakes'
filename: 'deadsnakes'
state: present
register: result
- name: Check if PPA using HTTPS URL is added
assert:
that:
- 'result.changed'
- 'result.state == "present"'
- 'result.repo == "ppa:deadsnakes"'
- name: 'examine source file'
stat:
path: '/etc/apt/sources.list.d/deadsnakes.list'
register: source_file
- name: 'assert source file exists'
assert:
that:
- 'source_file.stat.exists == True'
- name: Check if the PPA URL
shell: "grep 'https://ppa.launchpadcontent.net' /etc/apt/sources.list.d/deadsnakes.list"
register: r
- name: Test if PPA URL points to https URL
assert:
that:
- r.changed
- "'https://ppa.launchpadcontent.net' in r.stdout"
- name: Remove PPA file
file:
path: '/etc/apt/sources.list.d/deadsnakes.list'
state: absent
#
# TEARDOWN
#
- import_tasks: 'cleanup.yml'

Loading…
Cancel
Save