from __future__ import absolute_import
# Standard modules
-import sys
import os
import datetime
import logging
import logging.config
import re
-import traceback
import textwrap
import pwd
-import copy
import glob
import stat
import pipes
import yaml
# Own modules
-from .global_version import __version__ as __global_version__
-
-from .errors import FunctionNotImplementedError, PpAppError
-
-from .common import pp, terminal_can_colors, to_bytes, to_bool, to_str
-
-from .cfg_app import PpCfgAppError
+from .common import pp, to_str
from .homes_admin import PpHomesAdminError, PpHomesAdminApp
-__version__ = '0.6.1'
+__version__ = '0.6.2'
LOG = logging.getLogger(__name__)
UTC = datetime.timezone.utc
self.arg_parser.add_argument(
'--status-file',
metavar='FILE', dest='status_file',
- help=("The YAML file containing the statistics of the current week "
+ help=(
+ "The YAML file containing the statistics of the current week "
"(default: {!r}).").format(self.statusfile)
)
if self.verbose > 3:
LOG.debug("Checking config section {!r} ...".format(section_name))
- if section_name.lower() not in ('quota-check', 'quota_check', 'quotacheck') :
+ if section_name.lower() not in ('quota-check', 'quota_check', 'quotacheck'):
continue
section = self.cfg[section_name]
quota = self.quota_kb / 1024
try:
quota = int(v)
- except (ValueError, TypeError) as e:
+ except (ValueError, TypeError):
msg = "Found invalid quota MB {!r} in configuration.".format(v)
LOG.error(msg)
else:
quota = self.quota_kb
try:
quota = int(v)
- except (ValueError, TypeError) as e:
+ except (ValueError, TypeError):
msg = "Found invalid quota KB {!r} in configuration.".format(v)
LOG.error(msg)
else:
LOG.info("Reading all necessary data from 'getent passwd' ...")
- upper_dir = os.pardir + os.sep
entries = pwd.getpwall()
for entry in entries:
else:
- body += ("No home directory found with a recursive size "
- "greater or equal than {:.f} MB.").format(
- self.quota_kb / 1024)
+ body += (
+ "No home directory found with a recursive size "
+ "greater or equal than {:.f} MB.").format(self.quota_kb / 1024)
body += "\n\nCheers\n\n" + self.mail_from + '\n'
total_dirs = {}
for check_date in self.status_data['checks'].keys():
check = self.status_data['checks'][check_date]
- if not 'data' in check or not check['data'].keys():
+ if 'data' not in check or not check['data'].keys():
continue
# Consolidating data ...
for home in check['data'].keys():