From: Nikos Skalkotos Date: Thu, 19 Dec 2013 08:41:54 +0000 (+0200) Subject: Fix windows filesystem shrink X-Git-Tag: 0.6~1^2~7 X-Git-Url: https://code.grnet.gr/git/snf-image-creator/commitdiff_plain/0f0137fc157f898ebc253250d577ca162f512935 Fix windows filesystem shrink Make it work with Windows Server 2012 R2. The format of shrink querymax command has changed. --- diff --git a/image_creator/os_type/windows.py b/image_creator/os_type/windows.py index ddf6059..7c4c127 100644 --- a/image_creator/os_type/windows.py +++ b/image_creator/os_type/windows.py @@ -49,6 +49,7 @@ import random import string import subprocess import struct +import re # For more info see: http://technet.microsoft.com/en-us/library/jj612867.aspx KMS_CLIENT_SETUP_KEYS = { @@ -255,9 +256,14 @@ class Windows(OSBase): # The maximum number of reclaimable bytes is: xxxx MB # if line.find('reclaimable') >= 0: - querymax = line.split(':')[1].split()[0].strip() - assert querymax.isdigit(), \ - "Number of reclaimable bytes not a number" + answer = line.split(':')[1].strip() + m = re.search('(\d+) MB', answer) + if m: + querymax = m.group(1) + else: + FatalError( + "Unexpected output for `shrink querymax' command: %s" % + line) if querymax is None: FatalError("Error in shrinking! "