Commit 5b282b11 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

playbook: convert vm-bootstrap scripts to python3

Also make vm-bootstrap role depends on python3
parent c454260c
#!/usr/bin/python
#!/usr/bin/python3
import os
import sys
......@@ -6,7 +6,7 @@ import sys
if __name__ == "__main__":
if len(sys.argv) < 4:
print "Use: %s FILE1 FILE2 DEST_FILE" % sys.argv[0]
print("Use: %s FILE1 FILE2 DEST_FILE" % sys.argv[0])
exit(1)
file1 = sys.argv[1]
......
#!/usr/bin/python
#!/usr/bin/python3
import sys
print sys.argv[1:]
print(sys.argv[1:])
host_content = open('/etc/hosts', 'r').read()
hpath = sys.argv[1]
......@@ -13,7 +13,7 @@ for content in open(hpath, 'r').readlines():
if content:
items = content.strip().split(' ')
entry = "%s %s.%s %s" % (items[1], items[0], domain, items[0])
print entry
print(entry)
if not entry in host_content:
lines_entry += entry + "\n"
......
#!/usr/bin/python
#!/usr/bin/python3
import os
import sys
......@@ -24,9 +24,9 @@ def ping_cluster(hpath):
if __name__ == "__main__":
if len(sys.argv) < 3:
print "Use: %s TYPE [HOST LIST] OR [HOST-FILE]" % sys.argv[0]
print "ex: %s host google.com slapos.org; %s cluster /tmp/hosts" % (
sys.argv[0], sys.argv[0])
print("Use: %s TYPE [HOST LIST] OR [HOST-FILE]" % sys.argv[0])
print("ex: %s host google.com slapos.org; %s cluster /tmp/hosts" % (
sys.argv[0], sys.argv[0]))
exit(1)
if sys.argv[1] == 'host':
check_ping(sys.argv[2:])
......
---
dependencies:
- { role: package, package_name: python3, package_state: present }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment