|
|
|
@ -17,7 +17,7 @@ ap.add_argument("--nginx", type=argparse.FileType("w"), default="users.nginx.con
|
|
|
|
|
ap.add_argument("--md", type=argparse.FileType("w"), default="users.md")
|
|
|
|
|
ap.add_argument("--port", type=int, default=9060)
|
|
|
|
|
ap.add_argument("--addusers", action="store_true", default=False)
|
|
|
|
|
ap.add_argument("--servername", type=str, default="sandbox)
|
|
|
|
|
ap.add_argument("--servername", type=str, default="sandbox")
|
|
|
|
|
args = ap.parse_args()
|
|
|
|
|
|
|
|
|
|
passwords = args.passwords.read().strip().splitlines()
|
|
|
|
@ -25,7 +25,8 @@ passwords = [w.lower() for w in passwords]
|
|
|
|
|
template_env = Environment(loader=FileSystemLoader(args.templates))
|
|
|
|
|
curport = args.port
|
|
|
|
|
usernames = args.from_file.read().strip().splitlines()
|
|
|
|
|
|
|
|
|
|
servername = args.servername.read().strip()
|
|
|
|
|
|
|
|
|
|
nbconfig = template_env.get_template("jupyter_notebook_config.py")
|
|
|
|
|
csvout = writer(args.csv)
|
|
|
|
|
csvout.writerow("username port password".split())
|
|
|
|
@ -39,6 +40,7 @@ for username in usernames:
|
|
|
|
|
userdata['password'] = password
|
|
|
|
|
userdata['password_sha1'] = passwd(password)
|
|
|
|
|
userdata['port'] = curport
|
|
|
|
|
userdata['servername'] = servername
|
|
|
|
|
users.append(userdata)
|
|
|
|
|
csvout.writerow((userdata['username'], userdata['port'], userdata['password']))
|
|
|
|
|
curport += 1
|
|
|
|
|