Skip to content

Commit

Permalink
last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atighineanu committed Apr 17, 2019
1 parent f71d6d7 commit 21f9ee1
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions templ.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
from string import Template

ipbind = '192.168.100.27'
node1 = 'beta'
node2 = 'gamma'
ipnode1 = 'xxxx'
ipnode2 = 'yyyy'
##ipbind = '192.168.100.27'
##node1 = 'beta'
##node2 = 'gamma'
##ipnode1 = 'xxxx'
##ipnode2 = 'yyyy'

def HaprxyTemplHandler(haproxytempl, ipbind, node1, node2, ipnode1, ipnode2) :
def HaprxyTemplHandler(haproxytempl, ipbind, IPs, nodes) :
readingtemplate = open( haproxytempl )
realsrc = Template(readingtemplate.read())

##variabila = ['unspe', 'doispe', 'treispe', 'paispe']
##d = {'variabila':'\n'.join(variabila)}
d = {'ipbind':ipbind, 'node1' :node1, 'node2' :node2, 'ipnode1' :ipnode1, 'ipnode2' :ipnode2}
##d = {'variabila':'\n'.join(variabila)} // pentru liste cu fiecare element din rand nou
d = {'ipbind':ipbind,
'node1' :nodes[0], 'node2' :nodes[1], 'node3' :nodes[2],
'ipnode1' :IPs[0], 'ipnode2' :IPs[1], 'ipnode3' :IPs[2]}

return realsrc.substitute(d)



def ApacheTemplHandler(apachetempl, node):
def ApacheTemplHandler(apachetempl, node, ip):
readingtemplate = open( apachetempl )
realsrc = Template(readingtemplate.read())

##variabila = ['unspe', 'doispe', 'treispe', 'paispe']
##d = {'variabila':'\n'.join(variabila)}
d = {'node':node }
d = {'node':node, 'ip':ip}
return realsrc.substitute(d)

###HaprxyTemplHandler('template.txt', '192.168.100.27', 'beta' , 'gamma', 'xxxx', 'yyyy')
Expand Down

0 comments on commit 21f9ee1

Please sign in to comment.