Log In | Get Help   
Home My Page Projects Code Snippets Project Openings BonFIRE VCOC Demonstration Kit
Summary Activity SCM Files Wiki
[bonfiredemokit] Annotation of /virt-cluster/vc/hostsfile.py
[bonfiredemokit] / virt-cluster / vc / hostsfile.py Repository:
ViewVC logotype

Annotation of /virt-cluster/vc/hostsfile.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download) (as text)

1 : agomez 1 def load(file_path):
2 :     hosts = {}
3 :     with open(file_path) as file:
4 :     for line in file:
5 :     line = line.strip()
6 :     if not line or line.startswith('#'):
7 :     continue
8 :     elements = line.split()
9 :     hosts[elements[0]] = elements[1:]
10 :     return hosts
11 :    
12 :     def store(file_path,hosts):
13 :     output = "\n".join([ " ".join(list(host)) for host in hosts ]) + "\n"
14 :     with open(file_path,'w') as file:
15 :     file.write(output)
16 :    
17 :     def append(file_path,ip,hostname):
18 :     with open(file_path,'a') as file:
19 :     file.write("\n%s %s\n" % (ip,hostname))

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge