~harlowja/cloud-init/vd-helper-layer

« back to all changes in this revision

Viewing changes to cloudinit/sources/helpers/openstack.py

  • Committer: Joshua Harlow
  • Date: 2014-03-02 01:17:02 UTC
  • Revision ID: harlowja@gmail.com-20140302011702-uxfm642lj29uk1fj
Do the vendor data namespace in the openstack helper

Since both the config drive datasource and the openstack
datasource expose the vendor data attribute make sure that
we do the namespacing in the underlying helper layer instead
of the datasource layer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
        If not a valid location, raise a NonReadable exception.
197
197
        """
198
198
 
 
199
        def vendor_translator(data):
 
200
            # If vendordata includes 'cloud-init', then read that explicitly
 
201
            # for cloud-init (for namespacing).
 
202
            vd = util.load_json(data)
 
203
            if isinstance(vd, dict) and 'cloud-init' in vd:
 
204
                vd = vd['cloud-init']
 
205
            return vd
 
206
 
199
207
        def datafiles(version):
200
208
            files = {}
201
209
            files['metadata'] = (
214
222
            files['vendordata'] = (
215
223
                self._path_join("openstack", version, 'vendor_data.json'),
216
224
                False,
217
 
                util.load_json,
 
225
                vendor_translator,
218
226
            )
219
227
            return files
220
228