-
Notifications
You must be signed in to change notification settings - Fork 5
/
counter.py
60 lines (44 loc) · 1.61 KB
/
counter.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import argparse
def _create_parser():
parser = argparse.ArgumentParser(description='Welcome to Universal Systems Manager'
'Bios Token Change')
parser.add_argument('--verbose',
help='Turn on verbose logging',
action='store_true')
parser.add_argument('-i', '--idrac',
help='iDRAC IP of the Host'
)
parser.add_argument('-n', '--nfs',
help='NFS server IP address',
default=None)
parser.add_argument('-s', '--share',
help='NFS Share folder'
)
parser.add_argument('-c', '--config',
help='XML File to be imported'
)
parser.add_argument('-d', '--counter',
help='IP files to be updated'
)
return parser
def main():
parser = _create_parser()
args = parser.parse_args()
nfs_server = args.nfs
idrac = args.idrac
nfs_share = args.share
config = args.config
os.system("docker build -t ajeetraina/counter . ")
if(args.counter):
counter = int(args.counter)
for ip in range(0,counter+1):
print ("Iteration %s"%ip)
command = "docker run -d --name=%s_server ajeetraina/counter python ping.py &"%(ip)
print command
os.system(command)
if (args.idrac):
os.system(
"docker run -d --name=%s_server ajeetraina/counter python ping.py &"%(idrac))
if __name__ == '__main__':
main()