~dpb/cloud-init/fix-landscape-init-example

« back to all changes in this revision

Viewing changes to tests/unittests/helpers.py

  • Committer: Scott Moser
  • Date: 2014-01-29 19:32:51 UTC
  • mfrom: (933.2.6 trunk.dsvdata)
  • Revision ID: smoser@ubuntu.com-20140129193251-9lmtvaeedj5jmdl1
DataSourceNoCloud: support reading vendor-data 

Here we add the ability to read vendor-data from a file named
vendor-data at the same location as the user-data and meta-data files.

At the moment, vendor-data is not read at all from 'seedfrom'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
 
188
188
 
189
189
def populate_dir(path, files):
190
 
    os.makedirs(path)
 
190
    if not os.path.exists(path):
 
191
        os.makedirs(path)
191
192
    for (name, content) in files.iteritems():
192
193
        with open(os.path.join(path, name), "w") as fp:
193
194
            fp.write(content)