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

drop bionic support #27

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ The charm can be deployed using `Juju`:
juju deploy apt-mirror
```

The charm can handle arbitrary set of upstream DEB sources via setting `mirror-list`. Example below shows a bundle with this charm configured to mirror multiple Ubuntu series (Bionic and Focal) in a single repository and expose this repository via NGINX. Additionally PPAs and external repositories can be mirrored.
The charm can handle arbitrary set of upstream DEB sources via setting `mirror-list`. Example below shows a bundle with this charm configured to mirror multiple Ubuntu series (Focal and Jammy) in a single repository and expose this repository via NGINX. Additionally PPAs and external repositories can be mirrored.
```
series: bionic
series: jammy
machines:
'0':
series: bionic
series: jammy
services:
nginx:
charm: nginx
Expand All @@ -34,14 +34,14 @@ services:
num_units: 1
options:
mirror-list: |-
deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu jammy-security main restricted universe multiverse
to:
- '0'
relations:
Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
options:
mirror-list:
default: |-
deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
description: A list of repositories to mirror.
type: string
base-path:
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# remain compatible with bionic
ops < 2.0
ops
jinja2
26 changes: 13 additions & 13 deletions tests/functional/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async def test_bad_mirror_list_options(
url = "ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu"
mirror_list = """\
deb https://{0} focal main
deb https://{0} bionic main\
deb https://{0} jammy main\
""".format(
url
)
Expand Down Expand Up @@ -237,7 +237,7 @@ async def test_client_access(
url = "ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu"
mirror_list = """\
deb https://{0} focal main
deb https://{0} bionic main\
deb https://{0} jammy main\
""".format(
url
)
Expand All @@ -261,7 +261,7 @@ async def test_client_access(
# Note these can be changed if you changed the test url and mirror_list
test_apts = """\
deb http://{0}/apt-mirror/{1} focal main
deb http://{0}/apt-mirror/{1} bionic main\
deb http://{0}/apt-mirror/{1} jammy main\
""".format(
nginx_public_ip, url
)
Expand Down Expand Up @@ -290,16 +290,16 @@ async def test_unreferenced_packages_config_changed(

# Start with 2 mirror lists.
mirror_list = """\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main
deb http://ppa.launchpad.net/landscape/19.10/ubuntu bionic main\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main
deb http://ppa.launchpad.net/landscape/21.10/ubuntu focal main\
"""
await apt_mirror_app.set_config({"mirror-list": mirror_list})
await ops_test.model.wait_for_idle(apps=["apt-mirror"])
await apt_mirror_unit.run_action("synchronize")

# End up with 1 mirror lists.
mirror_list = """\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main
"""
await apt_mirror_app.set_config({"mirror-list": mirror_list})
await ops_test.model.wait_for_idle(apps=["apt-mirror"])
Expand Down Expand Up @@ -328,7 +328,7 @@ async def test_unreferenced_packages_config_changed_snapshoted(
# Start with 2 mirror lists.
mirror_list = """\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main
deb http://ppa.launchpad.net/landscape/19.10/ubuntu bionic main\
deb http://ppa.launchpad.net/landscape/19.10/ubuntu focal main\
"""
await apt_mirror_app.set_config({"mirror-list": mirror_list})
await ops_test.model.wait_for_idle(apps=["apt-mirror"])
Expand Down Expand Up @@ -417,15 +417,15 @@ async def test_outdated_packages_distro_changed(

# Start with a test mirror
mirror_list = """\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu bionic main
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main
"""
await apt_mirror_app.set_config({"mirror-list": mirror_list})
await ops_test.model.wait_for_idle(apps=["apt-mirror"])
await apt_mirror_unit.run_action("synchronize")

# Upgrade the distro to focal
# Upgrade the distro to Jammy
mirror_list = """\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main
"""
await apt_mirror_app.set_config({"mirror-list": mirror_list})
await ops_test.model.wait_for_idle(apps=["apt-mirror"])
Expand All @@ -437,17 +437,17 @@ async def test_outdated_packages_distro_changed(
count = int(results.get("count"))
assert count == 0

# Let's switch back to bionic and create a snapshot before switching to
# Let's switch back to Focal and create a snapshot before switching to
# focal.
agileshaw marked this conversation as resolved.
Show resolved Hide resolved
mirror_list = """\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu bionic main
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main
"""
await apt_mirror_app.set_config({"mirror-list": mirror_list})
await ops_test.model.wait_for_idle(apps=["apt-mirror"])
await apt_mirror_unit.run_action("synchronize")
await helper.run_action_wait(apt_mirror_unit, "create-snapshot")
mirror_list = """\
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main
deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main
"""
await apt_mirror_app.set_config({"mirror-list": mirror_list})
await ops_test.model.wait_for_idle(apps=["apt-mirror"])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_cron_schedule_remove(self, mock_open_call, os_path_exists, os_unlink):
@patch("charm.open", new_callable=mock_open)
def test_apt_mirror_list(self, mocked_open):
url = "http://archive.ubuntu.com/ubuntu"
opts = "bionic main restricted universe multiverse"
opts = "jammy main restricted universe multiverse"
self.harness.update_config({"mirror-list": "deb {} {}".format(url, opts)})
mocked_open.assert_called_with(Path("/etc/apt/mirror.list"), "wb")
mocked_open().write.assert_called_once_with(
Expand Down
Loading