diff --git a/cloudbaseinit/metadata/services/osconfigdrive/windows.py b/cloudbaseinit/metadata/services/osconfigdrive/windows.py index 4a5c968e..995e757d 100644 --- a/cloudbaseinit/metadata/services/osconfigdrive/windows.py +++ b/cloudbaseinit/metadata/services/osconfigdrive/windows.py @@ -58,7 +58,7 @@ class WindowsConfigDriveManager(base.BaseConfigDriveManager): def _meta_data_file_exists(self, drive, metadata_file): if self._osutils._has_cdfs(drive): LOG.debug("Drive %s has cdfs. Respecting upper-case " - "file names when looking for meta-data." % drive) + "file names when looking for meta-data." % drive) metadata_file = self._to_cdfs_filename(metadata_file) if os.path.exists(os.path.join(drive, metadata_file)): @@ -80,8 +80,8 @@ class WindowsConfigDriveManager(base.BaseConfigDriveManager): LOG.info('Metadata file could not be found on %s', drive) else: LOG.info("Looking for a Config Drive with label '%s' on '%s'. " - "Found mismatching label '%s'.", - required_drive_label, drive, label) + "Found mismatching label '%s'.", + required_drive_label, drive, label) return False def _get_iso_file_size(self, device): @@ -173,7 +173,7 @@ class WindowsConfigDriveManager(base.BaseConfigDriveManager): shutil.move( os.path.join(self.target_path, file), os.path.join(self.target_path, - self._from_cdfs_filename(file))) + self._from_cdfs_filename(file))) return True return False @@ -221,7 +221,7 @@ class WindowsConfigDriveManager(base.BaseConfigDriveManager): return get_config_drive(drive_label, metadata_file) else: LOG.info("Irrelevant type %(type)s in %(location)s " - "location; skip", {"type": cd_type, "location": cd_location}) + "location; skip", {"type": cd_type, "location": cd_location}) except Exception as exc: LOG.warning("Config type %(type)s not found in %(loc)s " "location; Error: '%(err)r'", @@ -237,9 +237,9 @@ class WindowsConfigDriveManager(base.BaseConfigDriveManager): for cd_type, cd_location in itertools.product(searched_types, searched_locations): LOG.info('Looking for Config Drive %(type)s in %(location)s ' - 'with expected label %(drive_label)s', - {"type": cd_type, "location": cd_location, - "drive_label": drive_label}) + 'with expected label %(drive_label)s', + {"type": cd_type, "location": cd_location, + "drive_label": drive_label}) if self._get_config_drive_files(drive_label, metadata_file, cd_type, cd_location): return True diff --git a/cloudbaseinit/osutils/windows.py b/cloudbaseinit/osutils/windows.py index 5d7b85f9..36226cf3 100644 --- a/cloudbaseinit/osutils/windows.py +++ b/cloudbaseinit/osutils/windows.py @@ -1482,21 +1482,21 @@ class WindowsUtils(base.BaseOSUtils): def _has_cdfs(self, drive): (out, err, exit_code) = self.execute_powershell_command("wmic " - "logicaldisk get deviceid,filesystem") + "logicaldisk get deviceid,filesystem") LOG.info("Checking if drive %s has CDFS filesystem" % drive) - if code == 0: - lines = out.decode('ascii').replace('\r\r','').splitlines()[1:] + if exit_code == 0: + lines = out.decode('ascii').replace('\r\r', '').splitlines()[1:] for line in lines: drive_fs = line.split() - LOG.info("Found candidate %s with %s" - % (drive_fs[0], drive_fs[1])) + LOG.info("Found candidate %s with %s" + % (drive_fs[0], drive_fs[1])) - if (drive.startswith(drive_fs[0].upper()) and - drive_fs[1].upper() == "CDFS"): + if (drive.startswith(drive_fs[0].upper()) and + drive_fs[1].upper() == "CDFS"): return True else: raise exception.WindowsCloudbaseInitException( - "Could not determine file system of drive %s" % drive) + "Could not determine file system of drive %s" % drive) return False def get_physical_disks(self):