git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
759a042
)
-k removes keys
author
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Thu, 18 Jun 2009 21:19:22 +0000
(21:19 +0000)
committer
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Thu, 18 Jun 2009 21:19:22 +0000
(21:19 +0000)
cmdline/getRecord.py
patch
|
blob
|
history
diff --git
a/cmdline/getRecord.py
b/cmdline/getRecord.py
index
3e4c068
..
e048742
100755
(executable)
--- a/
cmdline/getRecord.py
+++ b/
cmdline/getRecord.py
@@
-28,38
+28,42
@@
def create_parser():
parser.add_option("-d", "--debug", dest="DEBUG", action="store_true",
default=False, help = "record file path")
parser.add_option("-k", "--key", dest="withkey", action="store_true",
parser.add_option("-d", "--debug", dest="DEBUG", action="store_true",
default=False, help = "record file path")
parser.add_option("-k", "--key", dest="withkey", action="store_true",
- default=False, help = "print keys")
+ default=False, help = "print SSH keys and certificates")
+ parser.add_option("-p", "--plinfo", dest="plinfo", action="store_true",
+ default=False, help = "print PlanetLab specific internal fields")
return parser
return parser
+
def printRec(record, filters, options):
line = ""
if len(filters):
for filter in filters:
if options.DEBUG: print "Filtering on %s" %filter
def printRec(record, filters, options):
line = ""
if len(filters):
for filter in filters:
if options.DEBUG: print "Filtering on %s" %filter
- if options.withkey:
- line += "%s: " %filter
- line += "%s\n" % \
- printVal(record.dict["record"].get(filter, None))
- print line
+ line += "%s: %s\n" % (filter,
+ printVal(record.dict["record"].get(filter, None)))
+ print line
else:
# print the wole thing
for (key, value) in record.dict["record"].iteritems():
else:
# print the wole thing
for (key, value) in record.dict["record"].iteritems():
- if options.withkey:
- line += "%s: " % key
- line += "%s\n" % printVal(value)
+ if (not options.withkey and key in ('gid', 'keys')) or\
+ (not options.plinfo and key == 'pl_info'):
+ continue
+ line += "%s: %s\n" % (key, printVal(value))
print line
print line
+
# fix the iteratable values
def printVal(value):
line = ""
if type(value) in (tuple, list):
for i in value:
line += "%s " % i
# fix the iteratable values
def printVal(value):
line = ""
if type(value) in (tuple, list):
for i in value:
line += "%s " % i
- el
s
e:
+ el
if value != Non
e:
line += value
return line.rstrip("\n")
line += value
return line.rstrip("\n")
+
def main():
parser = create_parser();
(options, args) = parser.parse_args()
def main():
parser = create_parser();
(options, args) = parser.parse_args()