codecov[bot]: # [Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865?src=pr&el=h1) Report
> Merging [#1865](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865?src=pr&el=desc) into [develop](https://codecov.io/gh/Azure/WALinuxAgent/commit/92b652e031dd01027113702df7ee93c816bfd1aa&el=desc) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865/graphs/tree.svg?width=650&height=150&src=pr&token=ae90E2KYCw)](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865?src=pr&el=tree)

```diff
@@           Coverage Diff            @@
##           develop    #1865   +/-   ##
========================================
  Coverage    69.45%   69.45%           
========================================
  Files           82       82           
  Lines        11469    11469           
  Branches      1619     1619           
========================================
  Hits          7966     7966           
  Misses        3166     3166           
  Partials       337      337           
```


| [Impacted Files](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [azurelinuxagent/common/osutil/ubuntu.py](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865/diff?src=pr&el=tree#diff-YXp1cmVsaW51eGFnZW50L2NvbW1vbi9vc3V0aWwvdWJ1bnR1LnB5) | `68.42% <ø> (ø)` | |
| [azurelinuxagent/common/osutil/factory.py](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865/diff?src=pr&el=tree#diff-YXp1cmVsaW51eGFnZW50L2NvbW1vbi9vc3V0aWwvZmFjdG9yeS5weQ==) | `97.29% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865?src=pr&el=footer). Last update [92b652e...8203a16](https://codecov.io/gh/Azure/WALinuxAgent/pull/1865?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py
index 56515ede..5baa9ebb 100644
--- a/azurelinuxagent/common/osutil/factory.py
+++ b/azurelinuxagent/common/osutil/factory.py
@@ -65,7 +65,9 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
             return Ubuntu14OSUtil()
         elif Version(distro_version) in [Version('16.04'), Version('16.10'), Version('17.04')]:
             return Ubuntu16OSUtil()
-        elif Version(distro_version) in [Version('18.04')]:
+        elif Version(distro_version) in [Version('18.04'), Version('18.10'),
+                                         Version('19.04'), Version('19.10'),
+                                         Version('20.04')]:
             return Ubuntu18OSUtil()
         elif distro_full_name == "Snappy Ubuntu Core":
             return UbuntuSnappyOSUtil()
diff --git a/azurelinuxagent/common/osutil/ubuntu.py b/azurelinuxagent/common/osutil/ubuntu.py
index 9d2dd786..99a8f89d 100644
--- a/azurelinuxagent/common/osutil/ubuntu.py
+++ b/azurelinuxagent/common/osutil/ubuntu.py
@@ -89,7 +89,7 @@ class Ubuntu16OSUtil(Ubuntu14OSUtil):
 
 class Ubuntu18OSUtil(Ubuntu16OSUtil):
     """
-    Ubuntu 18.04
+    Ubuntu 18.04, 18.10, 19.04, 19.10, 20.04
     """
     def __init__(self):
         super(Ubuntu18OSUtil, self).__init__()

[BUG] 'WARNING Dhcp client is not running' on Ubuntu 19.10
## Description

On Ubuntu 19.10

**WALinuxAgent** keeps reporting that the DHCP client is not running:
```
WARNING ExtHandler Dhcp client is not running.
WARNING ExtHandler Dhcp client is not running.
WARNING ExtHandler Dhcp client is not running.
```

However *systemd-networkd* is handling DHCP:

```
systemd-networkd[652]: eth0: DHCPv4 address 10.0.0.4/24 via 10.0.0.1
```

You probably need to add an exception and check for `systemd-networkd` like you did for Ubuntu 18:

https://github.com/Azure/WALinuxAgent/blob/e3ecde432c0fd6968bdb6d2774e316a61b3289d2/azurelinuxagent/common/osutil/ubuntu.py#L90-L93


## Version

```
# grep VERSION= /etc/os-release
VERSION="19.10 (Eoan Ermine)"

# waagent --version
/usr/sbin/waagent:27: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
WALinuxAgent-2.2.40 running on ubuntu 19.10
Python: 3.7.5
Goal state agent: 2.2.42
```

Note that the `DeprecationWarning` seen above has already been reported (https://github.com/Azure/WALinuxAgent/issues/1473)
diff --git a/tests/common/osutil/test_factory.py b/tests/common/osutil/test_factory.py
index adc099d5..aa7daebc 100644
--- a/tests/common/osutil/test_factory.py
+++ b/tests/common/osutil/test_factory.py
@@ -83,12 +83,19 @@ class TestOsUtilFactory(AgentTestCase):
         self.assertEquals(ret.get_service_name(), "walinuxagent")
 
         ret = _get_osutil(distro_name="ubuntu",
-                          distro_code_name="",
+                          distro_code_name="bionic",
                           distro_version="18.04",
                           distro_full_name="")
         self.assertTrue(type(ret) == Ubuntu18OSUtil)
         self.assertEquals(ret.get_service_name(), "walinuxagent")
 
+        ret = _get_osutil(distro_name="ubuntu",
+                          distro_code_name="focal",
+                          distro_version="20.04",
+                          distro_full_name="")
+        self.assertTrue(type(ret) == Ubuntu18OSUtil)
+        self.assertEquals(ret.get_service_name(), "walinuxagent")
+
         ret = _get_osutil(distro_name="ubuntu",
                           distro_code_name="",
                           distro_version="10.04",

pip install -e .
parse_log_pytest
requirements.txt
codecov coverage flake8 mock nose nose-timer pytest
apt-get update apt-get install -y gcc
3.8
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
codecov==2.1.13
coverage==7.6.1
distro==1.9.0
exceptiongroup==1.2.2
flake8==7.1.2
idna==3.10
iniconfig==2.1.0
mccabe==0.7.0
mock==5.2.0
nose==1.3.7
nose-timer==1.0.1
packaging==24.2
pluggy==1.5.0
pyasn1==0.6.1
pycodestyle==2.12.1
pyflakes==3.2.0
pytest==8.3.5
requests==2.32.3
tomli==2.2.1
urllib3==2.2.3
-e git+https://github.com/Azure/WALinuxAgent.git@ed5cb578f3ee4e765f7211919a1ffebb504e0c24#egg=WALinuxAgent

name: WALinuxAgent
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=24.2=py38h06a4308_0
  - python=3.8.20=he870216_0
  - readline=8.2=h5eee18b_0
  - setuptools=75.1.0=py38h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.44.0=py38h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - codecov==2.1.13
      - coverage==7.6.1
      - distro==1.9.0
      - exceptiongroup==1.2.2
      - flake8==7.1.2
      - idna==3.10
      - iniconfig==2.1.0
      - mccabe==0.7.0
      - mock==5.2.0
      - nose==1.3.7
      - nose-timer==1.0.1
      - packaging==24.2
      - pluggy==1.5.0
      - pyasn1==0.6.1
      - pycodestyle==2.12.1
      - pyflakes==3.2.0
      - pytest==8.3.5
      - requests==2.32.3
      - tomli==2.2.1
      - urllib3==2.2.3
prefix: /opt/conda/envs/WALinuxAgent

tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_ubuntu
tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_alpine tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_arch tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_bigip tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_clear_linux tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_coreos tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_debian tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_default tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_euleros tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_freebsd tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_gaia tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_iosxe tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_kali tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_openbsd tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_openwrt tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_redhat tests/common/osutil/test_factory.py::TestOsUtilFactory::test_get_osutil_it_should_return_suse
azurelinuxagent/common/osutil/ubuntu.py azurelinuxagent/common/osutil/factory.py
azurelinuxagent/common/osutil/ubuntu.py azurelinuxagent/common/osutil/factory.py