Skip to content

Commit

Permalink
Merge branch 'release/1.11.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
lueschem committed Sep 23, 2022
2 parents ba1fa33 + b1ddd77 commit d530fd1
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 15 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Embedded Development Infrastructure - edi
=========================================

.. image:: https://github.com/lueschem/edi/actions/workflows/package-build.yml/badge.svg?branch=master
:target: https://github.com/lueschem/edi/actions/
:target: https://github.com/lueschem/edi/actions?query=branch%3Amaster


.. image:: https://github.com/lueschem/edi/actions/workflows/package-build.yml/badge.svg
:target: https://github.com/lueschem/edi/actions/
.. image:: https://github.com/lueschem/edi/actions/workflows/package-build.yml/badge.svg?branch=develop
:target: https://github.com/lueschem/edi/actions?query=branch%3Adevelop


.. image:: https://img.shields.io/badge/deb-packagecloud.io-844fec.svg
Expand Down
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
edi (1.11.3) jammy; urgency=medium

[ Matthias Lüscher ]
* Added workaround for https://github.com/lxc/lxd/issues/10396. Closes #77.
* Improved hyperlinks to GitHub results.

-- Matthias Lüscher (Launchpad) <m.luescher@datacomm.ch> Fri, 23 Sep 2022 11:28:54 +0200

edi (1.11.2) jammy; urgency=medium

[ Matthias Lüscher ]
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
# built documents.
#
# The short X.Y version.
version = '1.11.2'
release = '1.11.2'
version = '1.11.3'
release = '1.11.3'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
20 changes: 13 additions & 7 deletions edi/lib/lxchelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,20 @@ def is_container_running(name):

try:
parsed_result = yaml.safe_load(result.stdout)
if len(parsed_result) != 1:

if not parsed_result:
return False
else:
status = parsed_result[0].get("status", "")
if status == "Running":
return True
else:
return False

for item in parsed_result:
# workaround for https://github.com/lxc/lxd/issues/10396
if item.get("name", "") == name:
status = item.get("status", "")
if status == "Running":
return True
else:
return False

return False
except yaml.YAMLError as exc:
raise FatalError("Unable to parse lxc output ({}).".format(exc))

Expand Down
2 changes: 1 addition & 1 deletion edi/lib/versionhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# The do_release script will update this version!
# During launchpad debuild neither the git version nor the package version is available.
edi_fallback_version = '1.11.2'
edi_fallback_version = '1.11.3'


def get_edi_version():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
setup(
name='edi',

version='1.11.2',
version='1.11.3',

description='Embedded Development Infrastructure - edi',
long_description=long_description,
Expand Down
38 changes: 37 additions & 1 deletion tests/lib/test_lxchelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from edi.lib.helpers import FatalError
from edi.lib.lxchelpers import (get_server_image_compression_algorithm,
get_file_extension_from_image_compression_algorithm, lxc_exec,
get_lxd_version, LxdVersion, is_bridge_available, create_bridge)
get_lxd_version, LxdVersion, is_bridge_available, create_bridge,
is_container_running)
from edi.lib.shellhelpers import mockablerun, run
from tests.libtesting.helpers import get_command, get_sub_command
from tests.libtesting.contextmanagers.mocked_executable import mocked_executable, mocked_lxd_version_check
Expand All @@ -53,6 +54,41 @@ def fake_lxc_config_command(*popenargs, **kwargs):
assert result == 'bzip2'


lxc_info_json = """
[
{
"name": "debian-bullseye",
"status": "Stopped"
},
{
"name": "debian-buster",
"status": "Running"
}
]
"""


@pytest.mark.parametrize("container_name, lxc_output, expected_result", [
("debian-bullseye", lxc_info_json, False),
("debian-buster", lxc_info_json, True),
("debian", lxc_info_json, False),
("debian", "", False),
("debian", "[]", False),
])
def test_is_container_running(monkeypatch, container_name, lxc_output, expected_result):
with mocked_executable('lxc', '/here/is/no/lxc'):
with mocked_lxd_version_check():
def fake_lxc_info_command(*popenargs, **kwargs):
if get_command(popenargs).endswith('lxc') and get_sub_command(popenargs) == 'list':
return subprocess.CompletedProcess("fakerun", 0, stdout=lxc_output)
else:
return subprocess.run(*popenargs, **kwargs)

monkeypatch.setattr(mockablerun, 'run_mockable', fake_lxc_info_command)
result = is_container_running(container_name)
assert result == expected_result


@pytest.mark.parametrize("algorithm, expected_extension", [
("none", ".tar"),
("bzip2", ".tar.bz2"),
Expand Down

0 comments on commit d530fd1

Please sign in to comment.