'Yields (path, value) tuples for metadata elements.'

def metadata_for_config_drive(self):

    for version in (VERSIONS + ['latest']):
        if (version in CONF.api.config_drive_skip_versions.split('    ')):
            continue
        data = self.get_ec2_metadata(version)
        if ('user-data' in data):
            filepath = os.path.join('ec2', version, 'user-data')
            (yield (filepath, data['user-data']))
            del data['user-data']
        try:
            del data['public-keys']['0']['_name']
        except KeyError:
            pass
        filepath = os.path.join('ec2', version, 'meta-data.json')
        (yield (filepath, jsonutils.dump_as_bytes(data['meta-data'])))
    ALL_OPENSTACK_VERSIONS = (OPENSTACK_VERSIONS + ['latest'])
    for version in ALL_OPENSTACK_VERSIONS:
        path = ('openstack/%s/%s' % (version, MD_JSON_NAME))
        (yield (path, self.lookup(path)))
        path = ('openstack/%s/%s' % (version, UD_NAME))
        if (self.userdata_raw is not None):
            (yield (path, self.lookup(path)))
        if self._check_version(HAVANA, version, ALL_OPENSTACK_VERSIONS):
            path = ('openstack/%s/%s' % (version, VD_JSON_NAME))
            (yield (path, self.lookup(path)))
        if self._check_version(LIBERTY, version, ALL_OPENSTACK_VERSIONS):
            path = ('openstack/%s/%s' % (version, NW_JSON_NAME))
            (yield (path, self.lookup(path)))
        if self._check_version(NEWTON_TWO, version, ALL_OPENSTACK_VERSIONS):
            path = ('openstack/%s/%s' % (version, VD2_JSON_NAME))
            (yield (path, self.lookup(path)))
    for (cid, content) in self.content.items():
        (yield (('%s/%s/%s' % ('openstack', CONTENT_DIR, cid)), content))
