forked from grantdobbe/endrun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cell_create.py
executable file
·44 lines (32 loc) · 1.22 KB
/
cell_create.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# cell_create.py
#
# Copyright 2014 Grant Dobbe <[email protected]>
#
import os, endrun, time, sys
def main():
if len(sys.argv) != 3:
# grab the user's home directory
path = os.path.expanduser("~") + "/endrun-deploy"
# fetch our intial config data
number = int(raw_input("Enter the number of nodes to create (default is 8): ") or 8 )
prefix = raw_input("What naming prefix should we use for nodes? (default is node): ") or "node"
start = time.time()
# generate the keys
endrun.generateKeys(number, path, prefix)
# create the repo
endrun.repoInit(number, path, prefix)
# create a directory for each node following the convention prefixX-deploy with the appropriate info
endrun.nodeInit(number, path, prefix)
end = time.time()
# figure out how long it took
difference = end - start
# tell the user we're done
print "Node configuration complete. " + str(number) + " nodes created in " + str(difference) + " seconds."
print "Output can be found in " + path + "."
print "Copy these files prior to generating another Endrun cell."
return 0
if __name__ == '__main__':
main()