chsh.py (nss-pam-ldapd-0.9.11) | : | chsh.py (nss-pam-ldapd-0.9.12) | ||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
epilog='Report bugs to <%s>.' % constants.PACKAGE_BUGREPORT) | epilog='Report bugs to <%s>.' % constants.PACKAGE_BUGREPORT) | |||
parser.add_argument('-V', '--version', action=VersionAction) | parser.add_argument('-V', '--version', action=VersionAction) | |||
parser.add_argument('-s', '--shell', help='login shell for the user account') | parser.add_argument('-s', '--shell', help='login shell for the user account') | |||
parser.add_argument('-l', '--list-shells', action=ListShellsAction) | parser.add_argument('-l', '--list-shells', action=ListShellsAction) | |||
parser.add_argument('username', metavar='USER', nargs='?', | parser.add_argument('username', metavar='USER', nargs='?', | |||
help="the user who's shell to change") | help="the user who's shell to change") | |||
def ask_shell(oldshell): | def ask_shell(oldshell): | |||
"""Ask the user to provide a shell.""" | """Ask the user to provide a shell.""" | |||
# Provide Python 2 compatibility | # Provide Python 2 compatibility | |||
prompt = ' Login Shell [%s]: ' % oldshell | ||||
try: | try: | |||
input = raw_input | shell = raw_input(prompt) | |||
except NameError: | except NameError: | |||
pass | shell = input(prompt) | |||
shell = input(' Login Shell [%s]: ' % oldshell) | ||||
return shell or oldshell | return shell or oldshell | |||
def main(): | def main(): | |||
# parse arguments | # parse arguments | |||
args = parser.parse_args() | args = parser.parse_args() | |||
# check username part | # check username part | |||
user = users.User(args.username) | user = users.User(args.username) | |||
user.check() | user.check() | |||
# check the command line shell if one was provided (to fail early) | # check the command line shell if one was provided (to fail early) | |||
shell = args.shell | shell = args.shell | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |