From 9889395195692e8ae5b3dd309b8cfa71bbea0149 Mon Sep 17 00:00:00 2001 From: Cyrille Pontvieux Date: Sat, 16 Feb 2013 20:26:29 +0100 Subject: [PATCH] Corrections in the password strength method, to not mix updating the interface and getting info at the same time. --- src/salix-live-installer.glade | 4 --- src/salix-live-installer.py | 44 ++++++++++++++----------- src/salix_livetools_library/disk.py | 16 +++++---- src/salix_livetools_library/execute.py | 10 +++--- src/salix_livetools_library/freesize.py | 12 ++++--- src/salix_livetools_library/fs.py | 18 ++++++---- src/salix_livetools_library/fstab.py | 2 +- src/salix_livetools_library/kernel.py | 4 +-- src/salix_livetools_library/keyboard.py | 8 ++--- src/salix_livetools_library/language.py | 8 ++--- src/salix_livetools_library/salt.py | 18 +++++----- src/salix_livetools_library/timezone.py | 10 +++--- src/salix_livetools_library/user.py | 6 ++-- 13 files changed, 85 insertions(+), 75 deletions(-) diff --git a/src/salix-live-installer.glade b/src/salix-live-installer.glade index 719da0f..a4df867 100644 --- a/src/salix-live-installer.glade +++ b/src/salix-live-installer.glade @@ -3367,8 +3367,6 @@ If you already have all the needed partitions, please click on the button 'Do no True True False - - False @@ -3603,8 +3601,6 @@ If you already have all the needed partitions, please click on the button 'Do no True True False - - False diff --git a/src/salix-live-installer.py b/src/salix-live-installer.py index 97fb64e..33c886a 100755 --- a/src/salix-live-installer.py +++ b/src/salix-live-installer.py @@ -193,7 +193,7 @@ def __init__(self, is_test = False, is_test_clone = False): self.LinuxNewMountColumn = builder.get_object("linux_newmount_column") self.WinPartColumn = builder.get_object("win_part_column") self.WinSizeColumn = builder.get_object("win_size_column") - self.WinOldSysColumn = builder.get_object("win_oldsys_column") + self.WinOldSysColumn = builder.get_object("win_oldsys_column") self.WinNewMountColumn = builder.get_object("win_newmount_column") # Initialize the contextual help box self.context_intro = _("Contextual help.") @@ -204,7 +204,7 @@ def __init__(self, is_test = False, is_test_clone = False): # Connect signals self.add_custom_signals() builder.connect_signals(self) - + # General contextual help def on_leave_notify_event(self, widget, data=None): self.ContextLabel.set_text(self.context_intro) @@ -222,7 +222,7 @@ def on_install_button_enter_notify_event(self, widget, data=None): def on_launch_eventbox_enter_notify_event(self, widget, data=None): self.ContextLabel.set_text(_("Launch Salix installation. This button will not be active until \ all settings are configured correctly.")) - + # Time contextual help def on_time_tab_enter_notify_event(self, widget, data=None): self.ContextLabel.set_text(_("Access the time settings.")) @@ -1125,37 +1125,42 @@ def on_clone_login_undo_clicked(self, widget, data=None): self.users_settings_liveclone() def get_password_strength(self, pwd): """ - Return a number from 0 to 4 to indicate the strength of the password. + Returns tuple containing: + - a number from 0 to 4 to indicate the strength of the password. + - a contextual message. """ if not pwd: score = 0 + context_msg = '' else: score = 1 - self.ContextLabel.set_markup(_("Password strength:\nLess than 5 characters")) - if len(pwd) >= 5: + min_chars = 5 + context_msg = _("Less than {min} characters").format(min = min_chars) + if len(pwd) >= min_chars: score += 1 - contextLabelText = _("Password strength:\n") + context_msg = '' if re.search(r'[A-Z]', pwd): score += 0.5 else: - contextLabelText += _("No upper case letter...\n") + context_msg += "\n" + _("No upper case letter...") if re.search(r'[1-9]', pwd): score += 0.5 else: - contextLabelText += _("No number...\n") + context_msg += "\n" + _("No number...") if re.search(r'[-_.,;:!?"\']', pwd): score += 0.5 else: - contextLabelText += _("No punctuation...\n") + context_msg += "\n" + _("No punctuation...") if re.search(r'[][(){}/\<>$%*#@^]', pwd): score += 0.5 else: - contextLabelText += _("No symbol...\n") + context_msg += "\n" + _("No symbol...") score = int(math.floor(score)) - self.ContextLabel.set_markup(_(contextLabelText)) - return score + if score == 4: + context_msg = _("Satisfactory!") + return (score, context_msg) def set_progressbar_strength(self, pwd, draw_widget): - strength = self.get_password_strength(pwd) + strength, context_msg = self.get_password_strength(pwd) gc = draw_widget.window.new_gc() bg_color = draw_widget.get_colormap().alloc_color("#FFFFFF") border_color = draw_widget.get_colormap().alloc_color("#000000") @@ -1167,17 +1172,18 @@ def set_progressbar_strength(self, pwd, draw_widget): progress_color = draw_widget.get_colormap().alloc_color("#CCCC00") elif strength == 4: progress_color = draw_widget.get_colormap().alloc_color("#00FF00") - self.ContextLabel.set_markup(_("Password strength:\n\nSatisfactory!")) gc.set_foreground(bg_color) draw_widget.window.draw_rectangle(gc, True, 0, 1, 80, 20) gc.set_foreground(progress_color) draw_widget.window.draw_rectangle(gc, True, 0, 1, 20 * strength, 20) gc.set_foreground(border_color) draw_widget.window.draw_rectangle(gc, False, 0, 1, 80, 20) + context_label_text = "" + _("Password strength:") + "\n" + self.ContextLabel.set_markup(context_label_text + context_msg) def on_user_pass1_entry_changed(self, widget, data=None): self.set_progressbar_strength(widget.get_text().strip(), self.UserPassStrength) - def on_user_visible_checkbutton_toggled(self, widget, data=None): + def on_user_visible_checkbutton_toggled(self, widget, data=None): self.UserPass1Entry.set_visibility(self.UserVisibleCheckButton.get_active()) self.UserPass2Entry.set_visibility(self.UserVisibleCheckButton.get_active()) def check_login(self, login): @@ -1293,7 +1299,7 @@ def on_install_button_clicked(self, widget, data=None): # Info window skeleton: def info_dialog(message, parent = None): """ - Display an information message. + Displays an information message. """ dialog = gtk.MessageDialog(parent = parent, type = gtk.MESSAGE_INFO, buttons = gtk.BUTTONS_OK, flags = gtk.DIALOG_MODAL) @@ -1305,7 +1311,7 @@ def info_dialog(message, parent = None): # Error window skeleton: def error_dialog(message, parent = None): """ - Display an error message. + Displays an error message. """ dialog = gtk.MessageDialog(parent = parent, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_CLOSE, flags = gtk.DIALOG_MODAL) dialog.set_markup(message) @@ -1314,7 +1320,7 @@ def error_dialog(message, parent = None): dialog.destroy() # Launch the application -if __name__ == '__main__': +if __name__ == '__main__': # If no root privilege, displays error message and exit is_test = (len(sys.argv) > 1 and sys.argv[1] == '--test') if is_test: diff --git a/src/salix_livetools_library/disk.py b/src/salix_livetools_library/disk.py index 638c395..37e7c19 100644 --- a/src/salix_livetools_library/disk.py +++ b/src/salix_livetools_library/disk.py @@ -22,7 +22,7 @@ def getDisks(): """ - Return the disks devices (without /dev/) connected to the computer. + Returns the disks devices (without /dev/) connected to the computer. RAID and LVM are not supported yet. """ ret = [] @@ -33,10 +33,12 @@ def getDisks(): def getDiskInfo(diskDevice): """ - Return a dictionary with the following disk device's info: - model name, size in bytes, human readable size and whether it is removable or not. + Returns a dictionary with the following disk device's info: + - model: model name + - size: size in bytes + - sizeHuman: human readable size + - removable: whether it is removable or not diskDevice should no be prefixed with '/dev/' - dictionary key: model, size, sizeHuman, removable """ if S_ISBLK(os.stat('/dev/{0}'.format(diskDevice)).st_mode): modelName = open('/sys/block/{0}/device/model'.format(diskDevice), 'r').read().strip() @@ -53,7 +55,7 @@ def getDiskInfo(diskDevice): def getPartitions(diskDevice, skipExtended = True, skipSwap = True): """ - Return partitions matching exclusion filters. + Returns partitions matching exclusion filters. """ if S_ISBLK(os.stat('/dev/{0}'.format(diskDevice)).st_mode): parts = [p.replace('/sys/block/{0}/'.format(diskDevice), '') for p in glob.glob('/sys/block/{0}/{0}*'.format(diskDevice))] @@ -68,7 +70,7 @@ def getPartitions(diskDevice, skipExtended = True, skipSwap = True): def getSwapPartitions(): """ - Return partition devices with Linux Swap type. + Returns partition devices with Linux Swap type. """ ret = [] for diskDevice in getDisks(): @@ -78,7 +80,7 @@ def getSwapPartitions(): def getPartitionInfo(partitionDevice): """ - Return a dictionary with the partition information: + Returns a dictionary with the partition information: - fstype - label - size diff --git a/src/salix_livetools_library/execute.py b/src/salix_livetools_library/execute.py index 3f8333c..479f2bf 100644 --- a/src/salix_livetools_library/execute.py +++ b/src/salix_livetools_library/execute.py @@ -14,23 +14,23 @@ def execCall(cmd, shell = True, env = {'LANG' : 'en_US'}): """ - Execute a command and return the exit code. + Executes a command and return the exit code. The command is executed by default in a /bin/sh shell with en_US locale. The output of the command is not read. With some commands, it may hang if the output is not read when run in a shell. - For this type of command, it is preferable to use execGetOutput even the return value is not read or to use shell = False. + For this type of command, it is preferable to use execGetOutput even the return value is not read, or to use shell = False. """ return subprocess.call(cmd, shell = shell, env = env) def execCheck(cmd, shell = True, env = {'LANG' : 'en_US'}): """ - Execute a command and return 0 if OK or a subprocess.CalledProcessorError exception in case of error. + Executes a command and return 0 if Ok or a subprocess.CalledProcessorError exception in case of error. The command is executed by default in a /bin/sh shell with en_US locale. """ return subprocess.check_call(cmd, shell = shell, env = env) def execGetOutput(cmd, withError = False, shell = True, env = {'LANG' : 'en_US'}): """ - Execute a command and return its output in a list, line by line. + Executes a command and return its output in a list, line by line. In case of error, it returns a subprocess.CalledProcessorError exception. The command is executed by default in a /bin/sh shell with en_US locale. """ @@ -62,7 +62,7 @@ def execGetOutput(cmd, withError = False, shell = True, env = {'LANG' : 'en_US'} def checkRoot(): """ - Raise an Exception if you run this code without root permissions + Raises an Exception if you run this code without root permissions """ if os.getuid() != 0: raise Exception('You need root permissions.') diff --git a/src/salix_livetools_library/freesize.py b/src/salix_livetools_library/freesize.py index 137a25a..de1a592 100644 --- a/src/salix_livetools_library/freesize.py +++ b/src/salix_livetools_library/freesize.py @@ -15,7 +15,7 @@ def _getMountPoint(device): """ - Find the mount point of 'device' or None if not mounted + Finds the mount point of 'device' or None if not mounted Copied from 'mounting' module to break circular dependencies """ mountpoint = None @@ -29,7 +29,9 @@ def _getMountPoint(device): return mountpoint def getHumanSize(size): - """Return the human readable format of the size in bytes""" + """ + Returns the human readable format of the size in bytes + """ units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] unit = 0 sizeHuman = float(size) @@ -40,7 +42,7 @@ def getHumanSize(size): def getSizes(path): """ - Compute the different sizes of the fileystem denoted by path (either a device or a file in filesystem). + Computes the different sizes of the fileystem denoted by path (either a device or a file in filesystem). Return the following sizes (in a dictionary): - size (total size) - free (total free size) @@ -83,10 +85,10 @@ def getSizes(path): def getUsedSize(path, blocksize = None): """ - Return the size of the space used by files and folders under 'path'. + Returns the size of the space used by files and folders under 'path'. If 'blocksize' is specified, mimic the space that will be used if the blocksize of the underlying filesystem where the one specified. This could be useful if used to transfer files from one directory to another when the target filesystem use another blocksize. - Return a tuple with (size, sizeHuman) + Returns a tuple with (size, sizeHuman) """ cmd = ['du', '-c', '-s'] if blocksize: diff --git a/src/salix_livetools_library/fs.py b/src/salix_livetools_library/fs.py index a05a363..e95319f 100644 --- a/src/salix_livetools_library/fs.py +++ b/src/salix_livetools_library/fs.py @@ -18,10 +18,10 @@ def getFsType(partitionDevice): """ - Return the file system type for that partition. + Returns the file system type for that partition. 'partitionDevice' should no be prefixed with '/dev/' if it's a block device. It can be a full path if the partition is contained in a file. - Return 'Extended' if the partition is an extended partition and has no filesystem. + Returns 'Extended' if the partition is an extended partition and has no filesystem. """ if os.path.exists('/dev/{0}'.format(partitionDevice)) and S_ISBLK(os.stat('/dev/{0}'.format(partitionDevice)).st_mode): path = '/dev/{0}'.format(partitionDevice) @@ -45,7 +45,7 @@ def getFsType(partitionDevice): def getFsLabel(partitionDevice): """ - Return the label for that partition (if any). + Returns the label for that partition (if any). 'partitionDevice' should no be prefixed with '/dev/' if it is a block device. It can be a full path if the partition is contained in a file. """ @@ -69,11 +69,11 @@ def getFsLabel(partitionDevice): def makeFs(partitionDevice, fsType, label=None, force=False, options=None): """ - Create a filesystem on the device. + Creates a filesystem on the device. 'partitionDevice' should no be prefixed with '/dev/' if it is a block device. 'fsType' could be ext2, ext3, ext4, xfs, reiserfs, jfs, btrfs, ntfs, fat16, fat32, swap Use 'force=True' if you want to force the creation of the filesystem and if 'partitionDevice' is a full path to a file (not a block device). - Use 'options' to force options on the creation process (use a list) + Use 'options' to force these options on the creation process (use a list) """ if force and os.path.exists(partitionDevice): path = partitionDevice @@ -104,7 +104,9 @@ def makeFs(partitionDevice, fsType, label=None, force=False, options=None): return None # should not append def _makeExtFs(path, version, label, options, force): - """ExtX block size: 4k per default in /etc/mke2fs.conf""" + """ + ExtX block size: 4k per default in /etc/mke2fs.conf + """ cmd = ['/sbin/mkfs.ext{0:d}'.format(version)] if not options: options = [] @@ -120,7 +122,9 @@ def _makeExtFs(path, version, label, options, force): return execCall(cmd, shell = False) def _makeXfs(path, label, options, force): - """http://blog.peacon.co.uk/wiki/Creating_and_Tuning_XFS_Partitions""" + """ + http://blog.peacon.co.uk/wiki/Creating_and_Tuning_XFS_Partitions + """ cmd = ['/sbin/mkfs.xfs'] if not options: options = ['-f'] # -f is neccessary to have this or you cannot create XFS on a non-empty partition or disk diff --git a/src/salix_livetools_library/fstab.py b/src/salix_livetools_library/fstab.py index 5b44c61..c1e671a 100644 --- a/src/salix_livetools_library/fstab.py +++ b/src/salix_livetools_library/fstab.py @@ -11,7 +11,7 @@ def createFsTab(fstabMountPoint): """ - Generate an empty /etc/fstab file + Generates an empty /etc/fstab file """ try: os.mkdir('{0}/etc'.format(fstabMountPoint)) diff --git a/src/salix_livetools_library/kernel.py b/src/salix_livetools_library/kernel.py index a88d984..7b528cf 100644 --- a/src/salix_livetools_library/kernel.py +++ b/src/salix_livetools_library/kernel.py @@ -10,7 +10,7 @@ def hasKernelParam(param): """ - Define if the kernel parameter param has been defined on the kernel command line or not + Defines if the kernel parameter param has been defined on the kernel command line or not """ if os.path.exists('/proc/cmdline'): cmdline = open('/proc/cmdline', 'r').read().split() @@ -21,7 +21,7 @@ def hasKernelParam(param): def getKernelParamValue(param): """ - Return the value of the kernel parameter, None if this param has no value and False if this param does not exist. + Returns the value of the kernel parameter, None if this param has no value and False if this param does not exist. """ if os.path.exists('/proc/cmdline'): cmdline = open('/proc/cmdline', 'r').read().split() diff --git a/src/salix_livetools_library/keyboard.py b/src/salix_livetools_library/keyboard.py index dc37d37..4bcb4b2 100644 --- a/src/salix_livetools_library/keyboard.py +++ b/src/salix_livetools_library/keyboard.py @@ -26,7 +26,7 @@ def findCurrentKeymap(mountPoint = None): - /etc/rc.d/rc.keymap, or - in the 'keyb=' kernel parameter The detected keymap is then checked against the first column of one of the files: {0} - Return None if not found + Returns None if not found """.format(' '.join(_keymapsLocation)) if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -62,7 +62,7 @@ def findCurrentKeymap(mountPoint = None): def listAvailableKeymaps(mountPoint = None): """ - Return a list of couple (keymap, keyboardType). + Returns a list of couple (keymap, keyboardType). 'keymap' is a Console keymap as found in /usr/share/kbd/ 'keyboardType' is either 'azerty', 'qwerty', 'qwertz', etc and is there only for information The keymaps are extracted from one of the files: {0} @@ -96,7 +96,7 @@ def listAvailableKeymaps(mountPoint = None): def isNumLockEnabledByDefault(mountPoint = None): """ - Return True if the num lock is enabled by default. + Returns True if the num lock is enabled by default. To do this, the execute bit of /etc/rc.d/rc.numlock is checked. """ if mountPoint and not os.path.isdir(mountPoint): @@ -107,7 +107,7 @@ def isNumLockEnabledByDefault(mountPoint = None): def isIbusEnabledByDefault(mountPoint = None): """ - Return True if the IBus is enabled by default. + Returns True if the IBus is enabled by default. To do this, the execute bit of /usr/bin/ibus-daemon and /etc/profile.d/ibus.sh are checked. """ if mountPoint and not os.path.isdir(mountPoint): diff --git a/src/salix_livetools_library/language.py b/src/salix_livetools_library/language.py index c0f9d53..7780b18 100644 --- a/src/salix_livetools_library/language.py +++ b/src/salix_livetools_library/language.py @@ -18,7 +18,7 @@ def listAvailableLocales(mountPoint = None): """ - Return a list of couples (name, title) for available utf8 locales on the system under 'mountPoint'. + Returns a list of couples (name, title) for available utf8 locales on the system under 'mountPoint'. """ if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -33,14 +33,14 @@ def listAvailableLocales(mountPoint = None): def getCurrentLocale(): """ - Return the current used locale in the current environment. + Returns the current used locale in the current environment. """ lang, enc = locale.getdefaultlocale() return "{0}.{1}".format(lang, enc.lower()) def getDefaultLocale(mountPoint = None): """ - Return the default locale as defined in /etc/profile.d/lang.c?sh + Returns the default locale as defined in /etc/profile.d/lang.c?sh """ if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -60,7 +60,7 @@ def getDefaultLocale(mountPoint = None): def setDefaultLocale(locale, mountPoint = None): """ - Set the default locale in the /etc/profile.d/lang.c?sh file + Set the default locale in the /etc/profile.d/lang.c?sh file """ checkRoot() if mountPoint and not os.path.isdir(mountPoint): diff --git a/src/salix_livetools_library/salt.py b/src/salix_livetools_library/salt.py index a73ea6d..317a7c7 100644 --- a/src/salix_livetools_library/salt.py +++ b/src/salix_livetools_library/salt.py @@ -21,14 +21,14 @@ def getSaLTVersion(): """ - Return the SaLT version if run in a SaLT Live environment + Returns the SaLT version if run in a SaLT Live environment """ _checkLive() return open('/mnt/salt/salt-version', 'r').read().strip() def isSaLTVersionAtLeast(version): """ - Return True if the SaLT version is at least 'version'. + Returns True if the SaLT version is at least 'version'. """ v = getSaLTVersion() def vercmp(v1, v2): @@ -42,7 +42,7 @@ def _makelist(v): def isSaLTLiveEnv(): """ - Return True if it is executed in a SaLT Live environment, False otherwise + Returns True if it is executed in a SaLT Live environment, False otherwise """ return os.path.isfile('/mnt/salt/salt-version') and os.path.isfile('/mnt/salt/tmp/distro_infos') @@ -52,7 +52,7 @@ def _checkLive(): def isSaLTLiveCloneEnv(): """ - Return True if it is executed in a SaLT LiveClone environment, False otherwise + Returns True if it is executed in a SaLT LiveClone environment, False otherwise """ if not isSaLTLiveEnv(): return False @@ -62,7 +62,7 @@ def isSaLTLiveCloneEnv(): def getSaLTLiveMountPoint(): """ - Return the SaLT source mount point path. It could be the mount point of the optical drive or the USB stick for example. + Returns the SaLT source mount point path. It could be the mount point of the optical drive or the USB stick for example. """ _checkLive() try: @@ -75,7 +75,7 @@ def getSaLTLiveMountPoint(): def getSaLTRootDir(): """ - Return the SaLT ROOT_DIR, which is the directory containing SaLT modules. + Returns the SaLT ROOT_DIR, which is the directory containing SaLT modules. This is not the full path but a relative path to BASEDIR. """ _checkLive() @@ -88,7 +88,7 @@ def getSaLTRootDir(): def getSaLTIdentFile(): """ - Return the SaLT IDENT_FILE, which is the file located at the root of a filesystem containing some SaLT information for this Live session. + Returns the SaLT IDENT_FILE, which is the file located at the root of a filesystem containing some SaLT information for this Live session. This is not the full path but a relative path to the mount point. """ _checkLive() @@ -101,7 +101,7 @@ def getSaLTIdentFile(): def getSaLTBaseDir(): """ - Return the SaLT BASEDIR, which is the directory containing all files for this Live session. + Returns the SaLT BASEDIR, which is the directory containing all files for this Live session. This is not a full path but a relative path to the mount point. """ _checkLive() @@ -119,7 +119,7 @@ def getSaLTBaseDir(): def listSaLTModules(): """ - Return the list of SaLT modules for this Live session. + Returns the list of SaLT modules for this Live session. """ _checkLive() moduledir = '{0}/{1}/{2}/modules'.format(getSaLTLiveMountPoint(), getSaLTBaseDir(), getSaLTRootDir()) diff --git a/src/salix_livetools_library/timezone.py b/src/salix_livetools_library/timezone.py index fbda56c..ba0e03d 100644 --- a/src/salix_livetools_library/timezone.py +++ b/src/salix_livetools_library/timezone.py @@ -19,7 +19,7 @@ def listTimeZones(mountPoint = None): """ - Return a dictionary of time zones, by continent. + Returns a dictionary of time zones, by continent. """ if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -32,7 +32,7 @@ def listTimeZones(mountPoint = None): def listTZContinents(mountPoint = None): """ - Return a sorted list of continents for time zones. + Returns a sorted list of continents for time zones. """ if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -42,7 +42,7 @@ def listTZContinents(mountPoint = None): def listTZCities(continent, mountPoint = None): """ - Return a sorted list of cities for a specific continent's time zone. + Returns a sorted list of cities for a specific continent's time zone. """ if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -55,7 +55,7 @@ def listTZCities(continent, mountPoint = None): def getDefaultTimeZone(mountPoint = None): """ - Return the default time zone, by reading the /etc/localtime-copied-from symlink. + Returns the default time zone, by reading the /etc/localtime-copied-from symlink. """ if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -85,7 +85,7 @@ def setDefaultTimeZone(timezone, mountPoint = None): def isNTPEnabledByDefault(mountPoint = None): """ - Return True if the NTP service is enabled by default. + ReturnsTrue if the NTP service is enabled by default. To do this, the execute bit of /etc/rc.d/rc.ntpd is checked. """ if mountPoint and not os.path.isdir(mountPoint): diff --git a/src/salix_livetools_library/user.py b/src/salix_livetools_library/user.py index 3b360b9..068db00 100644 --- a/src/salix_livetools_library/user.py +++ b/src/salix_livetools_library/user.py @@ -20,7 +20,7 @@ def listRegularSystemUsers(mountPoint = None): """ - Return a sorted list of regular users, i.e. users with id ≥ 1000. + Returns a sorted list of regular users, i.e. users with id ≥ 1000. """ if mountPoint and not os.path.isdir(mountPoint): raise IOError("'{0}' does not exist or is not a directory.".format(mountPoint)) @@ -46,7 +46,7 @@ def createSystemUser(user, group = '', groups = [ 'scanner', 'video' ], password = None, shell = '/bin/bash', mountPoint = None): """ - Create a user 'user' in the system under the 'mountPoint'. + Creates a user 'user' in the system under the 'mountPoint'. If the 'group' is specified, and is different than __default__, it will be used. If the 'group' is '' then the default group will be used. If the 'group' is None then a group of the same name of the user will be created for the new user to be part of. @@ -115,7 +115,7 @@ def checkPasswordSystemUser(user, password, mountPoint = None): def deleteSystemUser(user, mountPoint = None): """ - Remove the specified 'user' from the system under the 'mountPoint'. + Removes the specified 'user' from the system under the 'mountPoint'. """ checkRoot() if mountPoint and not os.path.isdir(mountPoint):