Skip to content

Commit

Permalink
Use Distro object that was passed to datasource init
Browse files Browse the repository at this point in the history
  • Loading branch information
phsm committed Dec 28, 2023
1 parent 9eb7c54 commit 395fdb7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cloudinit/sources/DataSourceCloudStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from socket import gaierror, getaddrinfo, inet_ntoa
from struct import pack

from cloudinit import sources, stages, subp
from cloudinit import sources, subp
from cloudinit import url_helper as uhelp
from cloudinit import util
from cloudinit.net import dhcp
Expand Down Expand Up @@ -83,6 +83,7 @@ class DataSourceCloudStack(sources.DataSource):

def __init__(self, sys_cfg, distro, paths):
sources.DataSource.__init__(self, sys_cfg, distro, paths)
self.distro = distro
self.seed_dir = os.path.join(paths.seed_dir, "cs")
# Cloudstack has its metadata/userdata URLs located at
# http://<virtual-router-ip>/latest/
Expand Down Expand Up @@ -283,10 +284,9 @@ def get_vr_address():
return latest_address

# Try dhcp lease files next...
distro = stages.Init(reporter=True).distro # detect OS distro
lease_file = dhcp.IscDhclient.get_latest_lease(
distro.dhclient_lease_directory,
distro.dhclient_lease_file_regex
self.distro.dhclient_lease_directory,
self.distro.dhclient_lease_file_regex
)
if not lease_file:
LOG.debug("No lease file found, using default gateway")
Expand Down

0 comments on commit 395fdb7

Please sign in to comment.