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

Annotation of /ea/credentials.py

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : agomez 18 #
2 :     # BonFIRE Virtual Clusters on Federated Clouds Demonstration Kit
3 :     #
4 :     # Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012
5 :     #
6 :     # License Apache Software
7 :     #
8 :     # The research leading to these results has received funding from
9 :     # the European Community's Seventh Framework Programme (FP7/2007-2013)
10 :     # under agreement number 257386
11 :     #
12 :     # This software is provided with ABSOLUTELY NO WARRANTY
13 :     #
14 :    
15 :     import os
16 :     def getpass(file):
17 :     filepath=os.path.expanduser(file)
18 :     password=None
19 :     try:
20 :     f=open(filepath,'r')
21 :     for line in f.readlines():
22 :     if line.find('password') == 0 :
23 :     password=line.split()[1]
24 :     except IOError:
25 :     print 'ERROR: You must include your credentials in ' + file
26 :     exit()
27 :     if password == None:
28 :     print 'ERROR: You must include your password in ' + file
29 :     exit()
30 :    
31 :     return password
32 :    
33 :     def getuser(file):
34 :     user=None
35 :     filepath=os.path.expanduser(file)
36 :     try:
37 :     f=open(filepath,'r')
38 :     for line in f.readlines():
39 :     if line.find('user') == 0 :
40 :     user=line.split()[1]
41 :     except IOError:
42 :     print 'ERROR: You must include your credentials in ' + file
43 :     exit()
44 :     if user == None:
45 :     print 'ERROR: You must include your username in ' + file
46 :     exit()
47 :    
48 :     return user

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

Powered By FusionForge