git://git.onelab.eu
/
infrastructure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dccaa87
)
add no_password option
author
Baris Metin
<Talip-Baris.Metin@sophia.inria.fr>
Wed, 9 Jun 2010 13:52:19 +0000
(15:52 +0200)
committer
Baris Metin
<Talip-Baris.Metin@sophia.inria.fr>
Wed, 9 Jun 2010 13:52:19 +0000
(15:52 +0200)
scripts/export-omf.py
patch
|
blob
|
history
diff --git
a/scripts/export-omf.py
b/scripts/export-omf.py
index
e3a0586
..
1f0517b
100755
(executable)
--- a/
scripts/export-omf.py
+++ b/
scripts/export-omf.py
@@
-20,8
+20,10
@@
def getPersons(filter={}):
class OmfUserBase:
class OmfUserBase:
- def __init__ (self,filename):
- self.filename = filename
+ def __init__ (self, options, filename):
+ self.filename=filename
+ self.options=options
+
def save_person (self, file, person, sites_by_id, pubkeys_by_id):
# do not expose people without a key
def save_person (self, file, person, sites_by_id, pubkeys_by_id):
# do not expose people without a key
@@
-36,7
+38,8
@@
class OmfUserBase:
print >>file, "site=%s"%sites_by_id[site_id]['name']
if 'pi' in person['roles']:
print >>file, "pi=yes"
print >>file, "site=%s"%sites_by_id[site_id]['name']
if 'pi' in person['roles']:
print >>file, "pi=yes"
- print >>file, "password=%s"%person['password']
+ if not self.options.no_password:
+ print >>file, "password=%s"%person['password']
for key_id in person['key_ids']:
print >>file, "ssh=%s"%pubkeys_by_id[key_id]
for key_id in person['key_ids']:
print >>file, "ssh=%s"%pubkeys_by_id[key_id]
@@
-61,8
+64,17
@@
class OmfUserBase:
def main ():
def main ():
- output=sys.argv[1]
- userbase=OmfUserBase(output)
+ parser = OptionParser (usage="%prog [options] OUTPUT_FILE")
+ parser.add_option ("-n","--no-password", action="store_true",
+ dest="no_password", default=False, help="Don't include encrypted passwords")
+ options,args = parser.parse_args()
+
+ try:
+ output = args[0]
+ except IndexError:
+ parser.error("no output file")
+
+ userbase=OmfUserBase(options, output)
userbase.save()
if __name__ == '__main__':
userbase.save()
if __name__ == '__main__':