diff --git a/cloudbaseinit/constant.py b/cloudbaseinit/constant.py index 3a7b772a..557f6bad 100644 --- a/cloudbaseinit/constant.py +++ b/cloudbaseinit/constant.py @@ -18,15 +18,15 @@ "iso", # "Raw" format containing ISO bytes. } CD_LOCATIONS = { - # Look into optical devices. Only an ISO format could be - # used here (vfat ignored). - "cdrom", - # Search through physical disks for raw ISO content or vfat filesystems - # containing configuration drive's content. - "hdd", # Search through partitions for raw ISO content or through volumes # containing configuration drive's content. "partition", + # Search through physical disks for raw ISO content or vfat filesystems + # containing configuration drive's content. + "hdd", + # Look into optical devices. Only an ISO format could be + # used here (vfat ignored). + "cdrom", } POLICY_IGNORE_ALL_FAILURES = "ignoreallfailures" diff --git a/cloudbaseinit/metadata/services/baseconfigdrive.py b/cloudbaseinit/metadata/services/baseconfigdrive.py index 0f8a6eb4..978980df 100644 --- a/cloudbaseinit/metadata/services/baseconfigdrive.py +++ b/cloudbaseinit/metadata/services/baseconfigdrive.py @@ -47,12 +47,12 @@ def _preprocess_options(self): self._searched_locations = set(CONF.config_drive.locations) # Deprecation backward compatibility. - if CONF.config_drive.raw_hdd: - self._searched_types.add("iso") - self._searched_locations.add("hdd") if CONF.config_drive.cdrom: self._searched_types.add("iso") self._searched_locations.add("cdrom") + if CONF.config_drive.raw_hdd: + self._searched_types.add("iso") + self._searched_locations.add("hdd") if CONF.config_drive.vfat: self._searched_types.add("vfat") self._searched_locations.add("hdd") @@ -64,6 +64,11 @@ def _preprocess_options(self): if self._searched_locations | CD_LOCATIONS != CD_LOCATIONS: raise exception.CloudbaseInitException( "Invalid Config Drive locations %s", self._searched_locations) + # Note(avladu): sort the order of the searched locations + # This is needed to be sure that the order is respected + # See: https://github.com/cloudbase/cloudbase-init/issues/200 + self._searched_types = set(sorted(self._searched_types)) + self._searched_locations = set(sorted(self._searched_locations)) def load(self): super(BaseConfigDriveService, self).load()