Module lvol fails when decimal point is a colon

This commit is contained in:
Tomasz Lesniewski 2013-09-24 15:06:18 +02:00
parent eca73d3c82
commit 75ca71bf2c

View file

@ -71,13 +71,16 @@ EXAMPLES = '''
- lvol: vg=firefly lv=test state=absent - lvol: vg=firefly lv=test state=absent
''' '''
import re
decimal_point = pattern = re.compile(r"(\.|,)")
def parse_lvs(data): def parse_lvs(data):
lvs = [] lvs = []
for line in data.splitlines(): for line in data.splitlines():
parts = line.strip().split(';') parts = line.strip().split(';')
lvs.append({ lvs.append({
'name': parts[0], 'name': parts[0],
'size': int(parts[1].split('.')[0]), 'size': int(decimal_point.split(parts[1])[0]),
}) })
return lvs return lvs