fixed size bug

This commit is contained in:
Daniel 2019-10-16 20:51:25 +02:00
parent e79b3e6dfb
commit 447ccccb30
4 changed files with 9 additions and 14 deletions

View file

@ -9,7 +9,7 @@ app.config.from_object(config)
db = SQLAlchemy(app)
csrf = CSRFProtect()
csrf.init_app(app)
app_version = app.config["version"]
app_version = app.config["VERSION"]
import dirkules.models
import dirkules.samba.models

View file

@ -5,7 +5,7 @@ from logging.config import dictConfig
from apscheduler.jobstores.base import ConflictingIdError
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
version = "1.0.1"
VERSION = "1.0.1"
baseDir = os.path.abspath(os.path.dirname(__file__))
staticDir = os.path.join(baseDir, 'static')

View file

@ -66,10 +66,10 @@ def part_for_disk(device):
# lsblk /dev/sdd -b -o NAME,LABEL,FSTYPE,SIZE,UUID,MOUNTPOINT
parts = []
part_dict = list()
keys = ['name', 'label', 'fs', 'size', 'uuid', 'mount']
keys = ['size', 'name', 'label', 'fs', 'uuid', 'mount']
device = "/dev/" + device
lsblk = subprocess.Popen(
["sudo lsblk " + device + " -l -b -o NAME,LABEL,FSTYPE,SIZE,UUID,MOUNTPOINT"],
["sudo lsblk " + device + " -l -b -o SIZE,NAME,LABEL,FSTYPE,UUID,MOUNTPOINT"],
stdout=subprocess.PIPE,
shell=True,
universal_newlines=True)
@ -83,20 +83,15 @@ def part_for_disk(device):
del parts[1]
element_length = list()
counter = 0
last_letter = 0
pre_value = " "
for char in parts[0]:
if char != " " and pre_value == " ":
element_length.append(counter)
if len(element_length) == 0:
element_length.append(0)
else:
element_length.append(counter)
counter += 1
pre_value = char
# size ist rechtsbuendig. Extra Behandlung
# TODO: Besser machen
if char == "S" and parts[0][last_letter] == "E":
del element_length[-1]
element_length.append((last_letter + 2))
if char != " ":
last_letter = counter - 1
element_length.append(len(parts[0]))
del parts[0]
for part in parts:

View file

@ -1,4 +1,4 @@
from dirkules.config import staticDir, version
from dirkules.config import staticDir, VERSION
from dirkules import db