summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorzdc <zdc@users.noreply.github.com>2021-02-13 23:26:26 +0200
committerGitHub <noreply@github.com>2021-02-13 23:26:26 +0200
commit32b8b9ef8fd40d7d9e5a03ce37493eec220a9b54 (patch)
tree8f58fc22e84fd998e0184a6f894e2ac6f8c59118 /cloudinit
parentd695c78d291d192cc711659f89524395b3bd1d6f (diff)
parentb481bfb90b96c70d5d7c988b111058137b1ca60e (diff)
downloadvyos-cloud-init-32b8b9ef8fd40d7d9e5a03ce37493eec220a9b54.tar.gz
vyos-cloud-init-32b8b9ef8fd40d7d9e5a03ce37493eec220a9b54.zip
Merge pull request #31 from zdc/T3309-crux
dhclient: T3309: Removed dhclient from datasources
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/debian.py4
-rw-r--r--cloudinit/distros/ubuntu.py15
-rw-r--r--cloudinit/sources/DataSourceAzure.py6
-rw-r--r--cloudinit/sources/DataSourceEc2.py8
-rw-r--r--cloudinit/sources/DataSourceGCE.py8
5 files changed, 17 insertions, 24 deletions
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index d517fb88..0ad93ffe 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -36,14 +36,14 @@ ENI_HEADER = """# This file is generated from information provided by
# network: {config: disabled}
"""
-NETWORK_CONF_FN = "/etc/network/interfaces.d/50-cloud-init.cfg"
+NETWORK_CONF_FN = "/etc/network/interfaces.d/50-cloud-init"
LOCALE_CONF_FN = "/etc/default/locale"
class Distro(distros.Distro):
hostname_conf_fn = "/etc/hostname"
network_conf_fn = {
- "eni": "/etc/network/interfaces.d/50-cloud-init.cfg",
+ "eni": "/etc/network/interfaces.d/50-cloud-init",
"netplan": "/etc/netplan/50-cloud-init.yaml"
}
renderer_configs = {
diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py
index 68154104..e5fcbc58 100644
--- a/cloudinit/distros/ubuntu.py
+++ b/cloudinit/distros/ubuntu.py
@@ -21,6 +21,21 @@ LOG = logging.getLogger(__name__)
class Distro(debian.Distro):
+ def __init__(self, name, cfg, paths):
+ super(Distro, self).__init__(name, cfg, paths)
+ # Ubuntu specific network cfg locations
+ self.network_conf_fn = {
+ "eni": "/etc/network/interfaces.d/50-cloud-init.cfg",
+ "netplan": "/etc/netplan/50-cloud-init.yaml"
+ }
+ self.renderer_configs = {
+ "eni": {"eni_path": self.network_conf_fn["eni"],
+ "eni_header": debian.ENI_HEADER},
+ "netplan": {"netplan_path": self.network_conf_fn["netplan"],
+ "netplan_header": debian.ENI_HEADER,
+ "postcmds": True}
+ }
+
@property
def preferred_ntp_clients(self):
"""The preferred ntp client is dependent on the version."""
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index a06e6e1f..e076d5dc 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -13,7 +13,6 @@ import os
import os.path
import re
from time import time
-from subprocess import call
from xml.dom import minidom
import xml.etree.ElementTree as ET
@@ -269,11 +268,6 @@ class DataSourceAzure(sources.DataSource):
dsname = 'Azure'
_negotiated = False
_metadata_imds = sources.UNSET
- process_name = 'dhclient'
-
- tmpps = os.popen("ps -Af").read()
- if process_name not in tmpps[:]:
- call(['/sbin/dhclient', DEFAULT_PRIMARY_NIC])
def __init__(self, sys_cfg, distro, paths):
sources.DataSource.__init__(self, sys_cfg, distro, paths)
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index b49a08db..9ccf2cdc 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -10,7 +10,6 @@
import os
import time
-from subprocess import call
from cloudinit import ec2_utils as ec2
from cloudinit import log as logging
@@ -27,7 +26,6 @@ SKIP_METADATA_URL_CODES = frozenset([uhelp.NOT_FOUND])
STRICT_ID_PATH = ("datasource", "Ec2", "strict_id")
STRICT_ID_DEFAULT = "warn"
-DEFAULT_PRIMARY_NIC = 'eth0'
class CloudNames(object):
@@ -45,12 +43,6 @@ class CloudNames(object):
class DataSourceEc2(sources.DataSource):
dsname = 'Ec2'
- process_name = 'dhclient'
-
- tmpps = os.popen("ps -Af").read()
- if process_name not in tmpps[:]:
- call(['/sbin/dhclient', DEFAULT_PRIMARY_NIC])
-
# Default metadata urls that will be used if none are provided
# They will be checked for 'resolveability' and some of the
# following may be discarded if they do not resolve
diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
index f72d9836..d8162623 100644
--- a/cloudinit/sources/DataSourceGCE.py
+++ b/cloudinit/sources/DataSourceGCE.py
@@ -2,10 +2,8 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-import os
import datetime
import json
-from subprocess import call
from base64 import b64decode
@@ -20,7 +18,6 @@ LOG = logging.getLogger(__name__)
MD_V1_URL = 'http://metadata.google.internal/computeMetadata/v1/'
BUILTIN_DS_CONFIG = {'metadata_url': MD_V1_URL}
REQUIRED_FIELDS = ('instance-id', 'availability-zone', 'local-hostname')
-DEFAULT_PRIMARY_NIC = 'eth0'
class GoogleMetadataFetcher(object):
@@ -53,11 +50,6 @@ class GoogleMetadataFetcher(object):
class DataSourceGCE(sources.DataSource):
dsname = 'GCE'
- process_name = 'dhclient'
-
- tmpps = os.popen("ps -Af").read()
- if process_name not in tmpps[:]:
- call(['/sbin/dhclient', DEFAULT_PRIMARY_NIC])
def __init__(self, sys_cfg, distro, paths):
sources.DataSource.__init__(self, sys_cfg, distro, paths)