#!/usr/bin/env python # CCS Computer Science # Secret Password # # Douglas Thrift # # $Id$ import admin import common import os if __name__ == '__main__': parser = admin.parser() parser.add_option('-f', '--force', action = 'store_true', help = 'prompt for a new secret even if one already exists') if parser.parse_args()[0].force or not os.path.exists(admin.SECRET): try: password = common.new_password() os.umask(0077) with open(admin.SECRET, 'wb') as secret: secret.write(password) except (common.PasswordError, IOError), error: admin.error(error) except (EOFError, KeyboardInterrupt): admin.eof() # vim: noexpandtab tabstop=4