From dab1aa69b8e99d841ba90c42c30796e68242bbe2 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 22 Oct 2018 14:56:52 +0200 Subject: Get ip address on azure --- cloudinit/sources/DataSourceAzure.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index 0ee622e2..b66da647 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -12,6 +12,7 @@ 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 @@ -257,6 +258,11 @@ class DataSourceAzure(sources.DataSource): dsname = 'Azure' _negotiated = False + 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) -- cgit v1.2.3