pep8 and pylint fixes

This commit is contained in:
Scott Moser 2013-10-04 18:29:12 -04:00
parent 8f25cdf17f
commit 23654ada99
2 changed files with 8 additions and 4 deletions

View File

@ -484,12 +484,13 @@ def get_partition_mbr_layout(size, layout):
def purge_disk_ptable(device):
# wipe the first and last megabyte of a disk (or file)
# gpt stores partition table both at front and at end.
null = '\0' # pylint: disable=W1401
start_len = 1024 * 1024
end_len = 1024 * 1024
with open(device, "rb+") as fp:
fp.write('\0' * (start_len))
fp.write(null * (start_len))
fp.seek(-end_len, os.SEEK_END)
fp.write('\0' * end_len)
fp.write(null * end_len)
fp.flush()
read_parttbl(device)

View File

@ -20,6 +20,7 @@
from string import whitespace # pylint: disable=W0402
import logging
import os.path
import re
@ -32,6 +33,8 @@ SHORTNAME = re.compile(SHORTNAME_FILTER)
WS = re.compile("[%s]+" % (whitespace))
FSTAB_PATH = "/etc/fstab"
LOG = logging.getLogger(__name__)
def is_mdname(name):
# return true if this is a metadata service name
@ -146,7 +149,7 @@ def handle(_name, cfg, cloud, log, _args):
if cfgmnt_has:
log.debug(("Not including %s, already"
" previously included"), startname)
" previously included"), start)
continue
cfgmnt.append(defmnt)
@ -230,7 +233,7 @@ def devnode_for_dev_part(device, partition):
return None
sys_long_path = sys_path + "/" + short_name
if partition is not None:
partition = str(partition)