diff options
author | Sankar Tanguturi <stanguturi@vmware.com> | 2017-09-07 22:16:16 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2017-09-07 22:21:30 -0600 |
commit | a1dfdda2a2ae20fe026881980ddf7d16110f06e2 (patch) | |
tree | a3bf7afdee7015622d658c0a05b8ce38f499fe6c /cloudinit/sources/helpers/vmware/imc/guestcust_util.py | |
parent | 922c3c5c1a86f2d58e95a328e72b49a3bb234ca8 (diff) | |
download | vyos-cloud-init-a1dfdda2a2ae20fe026881980ddf7d16110f06e2.tar.gz vyos-cloud-init-a1dfdda2a2ae20fe026881980ddf7d16110f06e2.zip |
vmware customization: return network config format
For customizing the machines hosted on 'VMWare' hypervisor, the datasource
should return the 'network config' data in 'curtin' format.
This branch also fixes /etc/network/interfaces replacing the line
"source /etc/network/interfaces.d/*.cfg" which is incorrectly removed
when VMWare's Perl Customization Engine writes /etc/network/interfaces.
Modify the code to read the customization configuration and return the
converted data.
Added few tests.
LP: #1675063
Diffstat (limited to 'cloudinit/sources/helpers/vmware/imc/guestcust_util.py')
-rw-r--r-- | cloudinit/sources/helpers/vmware/imc/guestcust_util.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/sources/helpers/vmware/imc/guestcust_util.py b/cloudinit/sources/helpers/vmware/imc/guestcust_util.py index 1ab6bd41..44075255 100644 --- a/cloudinit/sources/helpers/vmware/imc/guestcust_util.py +++ b/cloudinit/sources/helpers/vmware/imc/guestcust_util.py @@ -59,14 +59,16 @@ def set_customization_status(custstate, custerror, errormessage=None): return (out, err) -# This will read the file nics.txt in the specified directory -# and return the content -def get_nics_to_enable(dirpath): - if not dirpath: +def get_nics_to_enable(nicsfilepath): + """Reads the NICS from the specified file path and returns the content + + @param nicsfilepath: Absolute file path to the NICS.txt file. + """ + + if not nicsfilepath: return None NICS_SIZE = 1024 - nicsfilepath = os.path.join(dirpath, "nics.txt") if not os.path.exists(nicsfilepath): return None |