demo/web-load-balancer/user_data/dump_user_data.py
raw| 1 | #!/usr/bin/env python |
| 2 | import base64 |
| 3 | import os |
| 4 | import os.path |
| 5 | |
| 6 | # Get the file directory |
| 7 | fdir = os.path.dirname(os.path.realpath(__file__)) |
| 8 | |
| 9 | # Get the shell scripts |
| 10 | shell_scripts = [f for f in os.listdir(fdir) if f.endswith(".sh")] |
| 11 | |
| 12 | # Read each and dump as base64 |
| 13 | for sh in shell_scripts: |
| 14 | raw = open(os.path.join(fdir,sh)).read() |
| 15 | enc = base64.b64encode(raw) |
| 16 | print "Base64 for %s:" % sh |
| 17 | print enc |
| 18 | |
| 19 |