diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-07-14 14:45:02 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-07-14 14:45:02 -0400 |
commit | d86e75313524298e52469d4e55fa945ec731e938 (patch) | |
tree | e3589e63c89dacfecd8a384147f50537bb888c82 /tests/unittests/helpers.py | |
parent | 74e4dff3774075b4e471df0258c8584feeb352bb (diff) | |
parent | 8191489d547d36f1c5a63a8fe4de02ea8d3d7da2 (diff) | |
download | vyos-cloud-init-d86e75313524298e52469d4e55fa945ec731e938.tar.gz vyos-cloud-init-d86e75313524298e52469d4e55fa945ec731e938.zip |
improvements to eni rendering
Some improvements here, and some bug fixes.
- bring curtin revno 394's to support post-up for interface aliases.
- sort attributes per interface for nicer order and consistent rendering
- use arrays for each 'section' rather than content += . This allows
better separation of the sections and also will perform better as long
strings with += are slow.
- improve how 'lo' is handled. If a network state that was being rendered
had an entry for 'lo', then the rendered ENI would have 2 'lo'
sections.
- no longer skip 'lo' sections when loading an ENI in parse_deb_config
- fix inet value for subnets, don't add interface attributes to alias
(LP: #1588547)
Also add some tests of reading yaml and rendering ENI.
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r-- | tests/unittests/helpers.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index 8d46a8bf..972245df 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -264,6 +264,18 @@ def populate_dir(path, files): fp.close() +def dir2dict(startdir, prefix=None): + flist = {} + if prefix is None: + prefix = startdir + for root, dirs, files in os.walk(startdir): + for fname in files: + fpath = os.path.join(root, fname) + key = fpath[len(prefix):] + flist[key] = util.load_file(fpath) + return flist + + try: skipIf = unittest.skipIf except AttributeError: |