Commit 15771b4b authored by Łukasz Nowak's avatar Łukasz Nowak

manager: Improve style

parent cc4671be
Pipeline #8709 passed with stage
in 0 seconds
...@@ -9,6 +9,7 @@ from slapos.manager import interface ...@@ -9,6 +9,7 @@ from slapos.manager import interface
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@implementer(interface.IManager) @implementer(interface.IManager)
class Manager(object): class Manager(object):
disk_device_filename = '.slapos-disk-permission' disk_device_filename = '.slapos-disk-permission'
...@@ -22,7 +23,8 @@ class Manager(object): ...@@ -22,7 +23,8 @@ class Manager(object):
if 'devperm' in config['manager']: if 'devperm' in config['manager']:
if 'allowed-disk-for-vm' in config['manager']['devperm']: if 'allowed-disk-for-vm' in config['manager']['devperm']:
self.allowed_disk_for_vm = [] self.allowed_disk_for_vm = []
for line in config['manager']['devperm']['allowed-disk-for-vm'].splitlines(): for line in config[
'manager']['devperm']['allowed-disk-for-vm'].splitlines():
line = line.strip() line = line.strip()
if line: if line:
self.allowed_disk_for_vm.append(line) self.allowed_disk_for_vm.append(line)
...@@ -71,7 +73,7 @@ class Manager(object): ...@@ -71,7 +73,7 @@ class Manager(object):
with open(disk_dev_path) as f: with open(disk_dev_path) as f:
try: try:
disk_list = json.load(f) disk_list = json.load(f)
except: except Exception:
logger.warning('Bad disk configuration file', exc_info=True) logger.warning('Bad disk configuration file', exc_info=True)
return return
...@@ -112,7 +114,7 @@ class Manager(object): ...@@ -112,7 +114,7 @@ class Manager(object):
continue continue
logger.warning("Transfer ownership of %s to %s" % (disk, pwd.getpwuid(uid).pw_name)) logger.warning("Transfer ownership of %s to %s" % (disk, pwd.getpwuid(uid).pw_name))
os.chown(disk, uid, grp.getgrnam("disk").gr_gid) os.chown(disk, uid, grp.getgrnam("disk").gr_gid)
def report(self, partition): def report(self, partition):
"""Method called at `slapos node report` phase. """Method called at `slapos node report` phase.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment