Example #1
0
    def _get_data(self):
        seed_ret = {}
        if util.read_optional_seed(seed_ret, base=(self.seed_dir + "/")):
            self.userdata_raw = seed_ret['user-data']
            self.metadata = seed_ret['meta-data']
            LOG.debug("Using seeded ec2 data from %s", self.seed_dir)
            self._cloud_platform = Platforms.SEEDED
            return True

        strict_mode, _sleep = read_strict_mode(
            util.get_cfg_by_path(self.sys_cfg, STRICT_ID_PATH,
                                 STRICT_ID_DEFAULT), ("warn", None))

        LOG.debug("strict_mode: %s, cloud_platform=%s",
                  strict_mode, self.cloud_platform)
        if strict_mode == "true" and self.cloud_platform == Platforms.UNKNOWN:
            return False
        elif self.cloud_platform == Platforms.NO_EC2_METADATA:
            return False

        if self.perform_dhcp_setup:  # Setup networking in init-local stage.
            if util.is_FreeBSD():
                LOG.debug("FreeBSD doesn't support running dhclient with -sf")
                return False
            try:
                with EphemeralDHCPv4(self.fallback_interface):
                    return util.log_time(
                        logfunc=LOG.debug, msg='Crawl of metadata service',
                        func=self._crawl_metadata)
            except NoDHCPLeaseError:
                return False
        else:
            return self._crawl_metadata()
Example #2
0
    def get_data(self):
        seed_ret = {}
        if util.read_optional_seed(seed_ret, base=(self.seed_dir + "/")):
            self.userdata_raw = seed_ret['user-data']
            self.metadata = seed_ret['meta-data']
            LOG.debug("Using seeded ec2 data from %s", self.seed_dir)
            self._cloud_platform = Platforms.SEEDED
            return True

        strict_mode, _sleep = read_strict_mode(
            util.get_cfg_by_path(self.sys_cfg, STRICT_ID_PATH,
                                 STRICT_ID_DEFAULT), ("warn", None))

        LOG.debug("strict_mode: %s, cloud_platform=%s", strict_mode,
                  self.cloud_platform)
        if strict_mode == "true" and self.cloud_platform == Platforms.UNKNOWN:
            return False

        try:
            if not self.wait_for_metadata_service():
                return False
            start_time = time.time()
            self.userdata_raw = \
                ec2.get_instance_userdata(self.api_ver, self.metadata_address)
            self.metadata = ec2.get_instance_metadata(self.api_ver,
                                                      self.metadata_address)
            LOG.debug("Crawl of metadata service took %.3f seconds",
                      time.time() - start_time)
            return True
        except Exception:
            util.logexc(LOG, "Failed reading from metadata address %s",
                        self.metadata_address)
            return False
    def get_data(self):
        defaults = { 
            "local-hostname" : "ubuntuhost",
            "instance-id" : "nocloud"
        }

        found = [ ]
        md = { }
        ud = ""

        try:
            # parse the kernel command line, getting data passed in
            if parse_cmdline_data(self.cmdline_id, md):
                found.append("cmdline")
        except:
            util.logexc(cloudinit.log,util.WARN)
            return False

        # check to see if the seeddir has data.
        seedret={ }
        if util.read_optional_seed(seedret,base=self.seeddir + "/"):
            md = util.mergedict(md,seedret['meta-data'])
            ud = seedret['user-data']
            found.append(self.seeddir)
            cloudinit.log.debug("using seeded cache data in %s" % self.seeddir)

        # there was no indication on kernel cmdline or data
        # in the seeddir suggesting this handler should be used.
        if len(found) == 0:
            return False

        # the special argument "seedfrom" indicates we should
        # attempt to seed the userdata / metadata from its value
        if "seedfrom" in md:
            seedfrom = md["seedfrom"]
            seedfound = False
            for proto in self.supported_seed_starts:
                if seedfrom.startswith(proto):
                    seedfound=proto
                    break
            if not seedfound:
                cloudinit.log.debug("seed from %s not supported by %s" %
                    (seedfrom, self.__class__))
                return False

            # this could throw errors, but the user told us to do it
            # so if errors are raised, let them raise
            (md_seed,ud) = util.read_seeded(seedfrom)
            cloudinit.log.debug("using seeded cache data from %s" % seedfrom)

            # values in the command line override those from the seed
            md = util.mergedict(md,md_seed)
            found.append(seedfrom)

        md = util.mergedict(md,defaults)
        self.seed = ",".join(found)
        self.metadata = md;
        self.userdata_raw = ud
        return True
Example #4
0
    def get_data(self):
        defaults = {"local-hostname": "ubuntuhost", "instance-id": "nocloud"}

        found = []
        md = {}
        ud = ""

        try:
            # parse the kernel command line, getting data passed in
            if parse_cmdline_data(self.cmdline_id, md):
                found.append("cmdline")
        except:
            util.logexc(cloudinit.log, util.WARN)
            return False

        # check to see if the seeddir has data.
        seedret = {}
        if util.read_optional_seed(seedret, base=self.seeddir + "/"):
            md = util.mergedict(md, seedret['meta-data'])
            ud = seedret['user-data']
            found.append(self.seeddir)
            cloudinit.log.debug("using seeded cache data in %s" % self.seeddir)

        # there was no indication on kernel cmdline or data
        # in the seeddir suggesting this handler should be used.
        if len(found) == 0:
            return False

        # the special argument "seedfrom" indicates we should
        # attempt to seed the userdata / metadata from its value
        if "seedfrom" in md:
            seedfrom = md["seedfrom"]
            seedfound = False
            for proto in self.supported_seed_starts:
                if seedfrom.startswith(proto):
                    seedfound = proto
                    break
            if not seedfound:
                cloudinit.log.debug("seed from %s not supported by %s" %
                                    (seedfrom, self.__class__))
                return False

            # this could throw errors, but the user told us to do it
            # so if errors are raised, let them raise
            (md_seed, ud) = util.read_seeded(seedfrom)
            cloudinit.log.debug("using seeded cache data from %s" % seedfrom)

            # values in the command line override those from the seed
            md = util.mergedict(md, md_seed)
            found.append(seedfrom)

        md = util.mergedict(md, defaults)
        self.seed = ",".join(found)
        self.metadata = md
        self.userdata_raw = ud
        return True
Example #5
0
 def _get_data(self):
     seed_ret = {}
     if util.read_optional_seed(seed_ret, base=(self.seed_dir + "/")):
         self.userdata_raw = seed_ret["user-data"]
         self.metadata = seed_ret["meta-data"]
         LOG.debug("Using seeded cloudstack data from: %s", self.seed_dir)
         return True
     try:
         if not self.wait_for_metadata_service():
             return False
         start_time = time.time()
         self.userdata_raw = ec2.get_instance_userdata(
             self.api_ver, self.metadata_address)
         self.metadata = ec2.get_instance_metadata(self.api_ver,
                                                   self.metadata_address)
         LOG.debug(
             "Crawl of metadata service took %s seconds",
             int(time.time() - start_time),
         )
         password_client = CloudStackPasswordServerClient(self.vr_addr)
         try:
             set_password = password_client.get_password()
         except Exception:
             util.logexc(
                 LOG,
                 "Failed to fetch password from virtual router %s",
                 self.vr_addr,
             )
         else:
             if set_password:
                 self.cfg = {
                     "ssh_pwauth": True,
                     "password": set_password,
                     "chpasswd": {
                         "expire": False,
                     },
                 }
         return True
     except Exception:
         util.logexc(
             LOG,
             "Failed fetching from metadata service %s",
             self.metadata_address,
         )
         return False
    def get_data(self):
        seedret={ }
        if util.read_optional_seed(seedret,base=self.cachedir + "/"):
            self.userdata_raw = seedret['user-data']
            self.metadata = seedret['meta-data']
            cloudinit.log.debug("using seeded ec2 data in %s" % self.cachedir)
            return True

        try:
            if not self.wait_for_metadata_service():
                return False
            instance_userdata = boto_utils.get_instance_userdata(self.api_ver)
            self.userdata_raw = self._base64_detect_and_decode(instance_userdata)
            self.metadata = boto_utils.get_instance_metadata(self.api_ver)
            return True
        except Exception as e:
            print e
            return False
Example #7
0
    def _get_data(self):
        seed_ret = {}
        if util.read_optional_seed(seed_ret, base=(self.seed_dir + "/")):
            self.userdata_raw = seed_ret['user-data']
            self.metadata = seed_ret['meta-data']
            LOG.debug("Using seeded ec2 data from %s", self.seed_dir)
            self._cloud_platform = Platforms.SEEDED
            return True

        strict_mode, _sleep = read_strict_mode(
            util.get_cfg_by_path(self.sys_cfg, STRICT_ID_PATH,
                                 STRICT_ID_DEFAULT), ("warn", None))

        LOG.debug("strict_mode: %s, cloud_platform=%s", strict_mode,
                  self.cloud_platform)
        if strict_mode == "true" and self.cloud_platform == Platforms.UNKNOWN:
            return False
        elif self.cloud_platform == Platforms.NO_EC2_METADATA:
            return False

        if self.get_network_metadata:  # Setup networking in init-local stage.
            if util.is_FreeBSD():
                LOG.debug("FreeBSD doesn't support running dhclient with -sf")
                return False
            dhcp_leases = dhcp.maybe_perform_dhcp_discovery(
                self.fallback_interface)
            if not dhcp_leases:
                # DataSourceEc2Local failed in init-local stage. DataSourceEc2
                # will still run in init-network stage.
                return False
            dhcp_opts = dhcp_leases[-1]
            net_params = {
                'interface': dhcp_opts.get('interface'),
                'ip': dhcp_opts.get('fixed-address'),
                'prefix_or_mask': dhcp_opts.get('subnet-mask'),
                'broadcast': dhcp_opts.get('broadcast-address'),
                'router': dhcp_opts.get('routers')
            }
            with net.EphemeralIPv4Network(**net_params):
                return util.log_time(logfunc=LOG.debug,
                                     msg='Crawl of metadata service',
                                     func=self._crawl_metadata)
        else:
            return self._crawl_metadata()
Example #8
0
    def get_data(self):
        seedret = {}
        if util.read_optional_seed(seedret, base=self.cachedir + "/"):
            self.userdata_raw = seedret['user-data']
            self.metadata = seedret['meta-data']
            cloudinit.log.debug("using seeded ec2 data in %s" % self.cachedir)
            return True

        try:
            if not self.wait_for_metadata_service():
                return False
            instance_userdata = boto_utils.get_instance_userdata(self.api_ver)
            self.userdata_raw = self._base64_detect_and_decode(
                instance_userdata)
            self.metadata = boto_utils.get_instance_metadata(self.api_ver)
            return True
        except Exception as e:
            print e
            return False
Example #9
0
    def get_data(self):
        seedret = {}
        if util.read_optional_seed(seedret, base=self.seeddir + "/"):
            self.userdata_raw = seedret["user-data"]
            self.metadata = seedret["meta-data"]
            log.debug("using seeded ec2 data in %s" % self.seeddir)
            return True

        try:
            if not self.wait_for_metadata_service():
                return False
            start = time.time()
            self.userdata_raw = boto_utils.get_instance_userdata(self.api_ver, None, self.metadata_address)
            self.metadata = boto_utils.get_instance_metadata(self.api_ver, self.metadata_address)
            log.debug("crawl of metadata service took %ds" % (time.time() - start))
            return True
        except Exception as e:
            print e
            return False
    def get_data(self):
        seedret = {}
        if util.read_optional_seed(seedret, base=self.seeddir + "/"):
            self.userdata_raw = seedret['user-data']
            self.metadata = seedret['meta-data']
            log.debug("using seeded cs data in %s" % self.seeddir)
            return True

        try:
            start = time.time()
            self.userdata_raw = boto_utils.get_instance_userdata(self.api_ver,
                None, self.metadata_address)
            self.metadata = boto_utils.get_instance_metadata(self.api_ver,
                self.metadata_address)
            log.debug("crawl of metadata service took %ds" %
                (time.time() - start))
            return True
        except Exception as e:
            log.exception(e)
            return False
Example #11
0
    def get_data(self):
        seedret = {}
        if util.read_optional_seed(seedret, base=self.seeddir + "/"):
            self.userdata_raw = seedret['user-data']
            self.metadata = seedret['meta-data']
            log.debug("using seeded cs data in %s" % self.seeddir)
            return True

        try:
            start = time.time()
            self.userdata_raw = boto_utils.get_instance_userdata(
                self.api_ver, None, self.metadata_address)
            self.metadata = boto_utils.get_instance_metadata(
                self.api_ver, self.metadata_address)
            log.debug("crawl of metadata service took %ds" %
                      (time.time() - start))
            return True
        except Exception as e:
            log.exception(e)
            return False
 def get_data(self):
     seed_ret = {}
     if util.read_optional_seed(seed_ret, base=(self.seed_dir + "/")):
         self.userdata_raw = seed_ret['user-data']
         self.metadata = seed_ret['meta-data']
         LOG.debug("Using seeded cloudstack data from: %s", self.seed_dir)
         return True
     try:
         if not self.wait_for_metadata_service():
             return False
         start_time = time.time()
         self.userdata_raw = ec2.get_instance_userdata(self.api_ver,
             self.metadata_address)
         self.metadata = ec2.get_instance_metadata(self.api_ver,
                                                   self.metadata_address)
         LOG.debug("Crawl of metadata service took %s seconds",
                   int(time.time() - start_time))
         return True
     except Exception:
         util.logexc(LOG, 'Failed fetching from metadata service %s',
                     self.metadata_address)
         return False
 def get_data(self):
     seed_ret = {}
     if util.read_optional_seed(seed_ret, base=(self.seed_dir + "/")):
         self.userdata_raw = seed_ret['user-data']
         self.metadata = seed_ret['meta-data']
         LOG.debug("Using seeded cloudstack data from: %s", self.seed_dir)
         return True
     try:
         if not self.wait_for_metadata_service():
             return False
         start_time = time.time()
         self.userdata_raw = ec2.get_instance_userdata(
             self.api_ver, self.metadata_address)
         self.metadata = ec2.get_instance_metadata(self.api_ver,
                                                   self.metadata_address)
         LOG.debug("Crawl of metadata service took %s seconds",
                   int(time.time() - start_time))
         return True
     except Exception:
         util.logexc(LOG, 'Failed fetching from metadata service %s',
                     self.metadata_address)
         return False
 def get_data(self):
     seed_ret = {}
     if util.read_optional_seed(seed_ret, base=(self.seed_dir + "/")):
         self.userdata_raw = seed_ret['user-data']
         self.metadata = seed_ret['meta-data']
         LOG.debug("Using seeded cloudstack data from: %s", self.seed_dir)
         return True
     try:
         if not self.wait_for_metadata_service():
             return False
         start_time = time.time()
         self.userdata_raw = ec2.get_instance_userdata(
             self.api_ver, self.metadata_address)
         self.metadata = ec2.get_instance_metadata(self.api_ver,
                                                   self.metadata_address)
         LOG.debug("Crawl of metadata service took %s seconds",
                   int(time.time() - start_time))
         password_client = CloudStackPasswordServerClient(self.vr_addr)
         try:
             set_password = password_client.get_password()
         except Exception:
             util.logexc(LOG,
                         'Failed to fetch password from virtual router %s',
                         self.vr_addr)
         else:
             if set_password:
                 self.cfg = {
                     'ssh_pwauth': True,
                     'password': set_password,
                     'chpasswd': {
                         'expire': False,
                     },
                 }
         return True
     except Exception:
         util.logexc(LOG, 'Failed fetching from metadata service %s',
                     self.metadata_address)
         return False
Example #15
0
    def get_data(self):
        defaults = {
            "instance-id": "nocloud",
            "dsmode": self.dsmode,
        }

        found = []
        md = {}
        ud = ""

        try:
            # Parse the kernel command line, getting data passed in
            if parse_cmdline_data(self.cmdline_id, md):
                found.append("cmdline")
        except:
            util.logexc(LOG, "Unable to parse command line data")
            return False

        # Check to see if the seed dir has data.
        seedret = {}
        if util.read_optional_seed(seedret, base=self.seed_dir + "/"):
            md = util.mergemanydict([md, seedret['meta-data']])
            ud = seedret['user-data']
            found.append(self.seed_dir)
            LOG.debug("Using seeded cache data from %s", self.seed_dir)

        # If the datasource config had a 'seedfrom' entry, then that takes
        # precedence over a 'seedfrom' that was found in a filesystem
        # but not over external media
        if 'seedfrom' in self.ds_cfg and self.ds_cfg['seedfrom']:
            found.append("ds_config")
            md["seedfrom"] = self.ds_cfg['seedfrom']

        # if ds_cfg has 'user-data' and 'meta-data'
        if 'user-data' in self.ds_cfg and 'meta-data' in self.ds_cfg:
            if self.ds_cfg['user-data']:
                ud = self.ds_cfg['user-data']
            if self.ds_cfg['meta-data'] is not False:
                md = util.mergemanydict([md, self.ds_cfg['meta-data']])
            if 'ds_config' not in found:
                found.append("ds_config")

        label = self.ds_cfg.get('fs_label', "cidata")
        if label is not None:
            # Query optical drive to get it in blkid cache for 2.6 kernels
            util.find_devs_with(path="/dev/sr0")
            util.find_devs_with(path="/dev/sr1")

            fslist = util.find_devs_with("TYPE=vfat")
            fslist.extend(util.find_devs_with("TYPE=iso9660"))

            label_list = util.find_devs_with("LABEL=%s" % label)
            devlist = list(set(fslist) & set(label_list))
            devlist.sort(reverse=True)

            for dev in devlist:
                try:
                    LOG.debug("Attempting to use data from %s", dev)

                    (newmd, newud) = util.mount_cb(dev, util.read_seeded)
                    md = util.mergemanydict([newmd, md])
                    ud = newud

                    # For seed from a device, the default mode is 'net'.
                    # that is more likely to be what is desired.  If they want
                    # dsmode of local, then they must specify that.
                    if 'dsmode' not in md:
                        md['dsmode'] = "net"

                    LOG.debug("Using data from %s", dev)
                    found.append(dev)
                    break
                except OSError as e:
                    if e.errno != errno.ENOENT:
                        raise
                except util.MountFailedError:
                    util.logexc(LOG, "Failed to mount %s when looking for "
                                "data", dev)

        # There was no indication on kernel cmdline or data
        # in the seeddir suggesting this handler should be used.
        if len(found) == 0:
            return False

        seeded_interfaces = None

        # The special argument "seedfrom" indicates we should
        # attempt to seed the userdata / metadata from its value
        # its primarily value is in allowing the user to type less
        # on the command line, ie: ds=nocloud;s=http://bit.ly/abcdefg
        if "seedfrom" in md:
            seedfrom = md["seedfrom"]
            seedfound = False
            for proto in self.supported_seed_starts:
                if seedfrom.startswith(proto):
                    seedfound = proto
                    break
            if not seedfound:
                LOG.debug("Seed from %s not supported by %s", seedfrom, self)
                return False

            if 'network-interfaces' in md:
                seeded_interfaces = self.dsmode

            # This could throw errors, but the user told us to do it
            # so if errors are raised, let them raise
            (md_seed, ud) = util.read_seeded(seedfrom, timeout=None)
            LOG.debug("Using seeded cache data from %s", seedfrom)

            # Values in the command line override those from the seed
            md = util.mergemanydict([md, md_seed])
            found.append(seedfrom)

        # Now that we have exhausted any other places merge in the defaults
        md = util.mergemanydict([md, defaults])

        # Update the network-interfaces if metadata had 'network-interfaces'
        # entry and this is the local datasource, or 'seedfrom' was used
        # and the source of the seed was self.dsmode
        # ('local' for NoCloud, 'net' for NoCloudNet')
        if ('network-interfaces' in md
                and (self.dsmode in ("local", seeded_interfaces))):
            LOG.debug("Updating network interfaces from %s", self)
            self.distro.apply_network(md['network-interfaces'])

        if md['dsmode'] == self.dsmode:
            self.seed = ",".join(found)
            self.metadata = md
            self.userdata_raw = ud
            return True

        LOG.debug("%s: not claiming datasource, dsmode=%s", self, md['dsmode'])
        return False
    def get_data(self):
        defaults = {
            "instance-id": "nocloud",
            "dsmode": self.dsmode,
        }

        found = []
        md = {}
        ud = ""

        try:
            # Parse the kernel command line, getting data passed in
            if parse_cmdline_data(self.cmdline_id, md):
                found.append("cmdline")
        except:
            util.logexc(LOG, "Unable to parse command line data")
            return False

        # Check to see if the seed dir has data.
        seedret = {}
        if util.read_optional_seed(seedret, base=self.seed_dir + "/"):
            md = util.mergemanydict([md, seedret['meta-data']])
            ud = seedret['user-data']
            found.append(self.seed_dir)
            LOG.debug("Using seeded cache data from %s", self.seed_dir)

        # If the datasource config had a 'seedfrom' entry, then that takes
        # precedence over a 'seedfrom' that was found in a filesystem
        # but not over external media
        if 'seedfrom' in self.ds_cfg and self.ds_cfg['seedfrom']:
            found.append("ds_config")
            md["seedfrom"] = self.ds_cfg['seedfrom']

        # if ds_cfg has 'user-data' and 'meta-data'
        if 'user-data' in self.ds_cfg and 'meta-data' in self.ds_cfg:
            if self.ds_cfg['user-data']:
                ud = self.ds_cfg['user-data']
            if self.ds_cfg['meta-data'] is not False:
                md = util.mergemanydict([md, self.ds_cfg['meta-data']])
            if 'ds_config' not in found:
                found.append("ds_config")

        label = self.ds_cfg.get('fs_label', "cidata")
        if label is not None:
            # Query optical drive to get it in blkid cache for 2.6 kernels
            util.find_devs_with(path="/dev/sr0")
            util.find_devs_with(path="/dev/sr1")

            fslist = util.find_devs_with("TYPE=vfat")
            fslist.extend(util.find_devs_with("TYPE=iso9660"))

            label_list = util.find_devs_with("LABEL=%s" % label)
            devlist = list(set(fslist) & set(label_list))
            devlist.sort(reverse=True)

            for dev in devlist:
                try:
                    LOG.debug("Attempting to use data from %s", dev)

                    (newmd, newud) = util.mount_cb(dev, util.read_seeded)
                    md = util.mergemanydict([newmd, md])
                    ud = newud

                    # For seed from a device, the default mode is 'net'.
                    # that is more likely to be what is desired.  If they want
                    # dsmode of local, then they must specify that.
                    if 'dsmode' not in md:
                        md['dsmode'] = "net"

                    LOG.debug("Using data from %s", dev)
                    found.append(dev)
                    break
                except OSError as e:
                    if e.errno != errno.ENOENT:
                        raise
                except util.MountFailedError:
                    util.logexc(LOG, "Failed to mount %s when looking for "
                                "data", dev)

        # There was no indication on kernel cmdline or data
        # in the seeddir suggesting this handler should be used.
        if len(found) == 0:
            return False

        seeded_interfaces = None

        # The special argument "seedfrom" indicates we should
        # attempt to seed the userdata / metadata from its value
        # its primarily value is in allowing the user to type less
        # on the command line, ie: ds=nocloud;s=http://bit.ly/abcdefg
        if "seedfrom" in md:
            seedfrom = md["seedfrom"]
            seedfound = False
            for proto in self.supported_seed_starts:
                if seedfrom.startswith(proto):
                    seedfound = proto
                    break
            if not seedfound:
                LOG.debug("Seed from %s not supported by %s", seedfrom, self)
                return False

            if 'network-interfaces' in md:
                seeded_interfaces = self.dsmode

            # This could throw errors, but the user told us to do it
            # so if errors are raised, let them raise
            (md_seed, ud) = util.read_seeded(seedfrom, timeout=None)
            LOG.debug("Using seeded cache data from %s", seedfrom)

            # Values in the command line override those from the seed
            md = util.mergemanydict([md, md_seed])
            found.append(seedfrom)

        # Now that we have exhausted any other places merge in the defaults
        md = util.mergemanydict([md, defaults])

        # Update the network-interfaces if metadata had 'network-interfaces'
        # entry and this is the local datasource, or 'seedfrom' was used
        # and the source of the seed was self.dsmode
        # ('local' for NoCloud, 'net' for NoCloudNet')
        if ('network-interfaces' in md and
            (self.dsmode in ("local", seeded_interfaces))):
            LOG.debug("Updating network interfaces from %s", self)
            self.distro.apply_network(md['network-interfaces'])

        if md['dsmode'] == self.dsmode:
            self.seed = ",".join(found)
            self.metadata = md
            self.userdata_raw = ud
            return True

        LOG.debug("%s: not claiming datasource, dsmode=%s", self, md['dsmode'])
        return False
    def get_data(self):
        defaults = {
            "instance-id": "nocloud", "dsmode": self.dsmode
        }

        found = []
        md = {}
        ud = ""

        try:
            # parse the kernel command line, getting data passed in
            if parse_cmdline_data(self.cmdline_id, md):
                found.append("cmdline")
        except:
            util.logexc(log)
            return False

        # check to see if the seeddir has data.
        seedret = {}
        if util.read_optional_seed(seedret, base=self.seeddir + "/"):
            md = util.mergedict(md, seedret['meta-data'])
            ud = seedret['user-data']
            found.append(self.seeddir)
            log.debug("using seeded cache data in %s" % self.seeddir)

        # if the datasource config had a 'seedfrom' entry, then that takes
        # precedence over a 'seedfrom' that was found in a filesystem
        # but not over external medi
        if 'seedfrom' in self.ds_cfg and self.ds_cfg['seedfrom']:
            found.append("ds_config")
            md["seedfrom"] = self.ds_cfg['seedfrom']

        fslist = util.find_devs_with("TYPE=vfat")
        fslist.extend(util.find_devs_with("TYPE=iso9660"))

        label_list = util.find_devs_with("LABEL=cidata")
        devlist = list(set(fslist) & set(label_list))
        devlist.sort(reverse=True)

        for dev in devlist:
            try:
                (newmd, newud) = util.mount_callback_umount(dev,
                    util.read_seeded)
                md = util.mergedict(newmd, md)
                ud = newud

                # for seed from a device, the default mode is 'net'.
                # that is more likely to be what is desired.
                # If they want dsmode of local, then they must
                # specify that.
                if 'dsmode' not in md:
                    md['dsmode'] = "net"

                log.debug("using data from %s" % dev)
                found.append(dev)
                break
            except OSError, e:
                if e.errno != errno.ENOENT:
                    raise
            except util.mountFailedError:
                log.warn("Failed to mount %s when looking for seed" % dev)