Modified the output of remctl listuser to use YAML
authorPaul Weaver <pweaver@mit.edu>
Tue, 20 Oct 2009 01:39:05 +0000 (21:39 -0400)
committerPaul Weaver <pweaver@mit.edu>
Tue, 20 Oct 2009 01:39:05 +0000 (21:39 -0400)
svn path=/trunk/packages/invirt-remote/; revision=2509

server/usr/sbin/invirt-remote-listuser

index a43412f..dec6da7 100755 (executable)
@@ -19,10 +19,16 @@ def main(argv):
 
     database.connect()
     machines = Machine.query().join('acl').filter_by(user=username)
-    output = "Machine Name \t\t Owner \t\t contact \n\r"
+    output = {}
     for m in machines:
-        output +=  m.name + "\t" + m.owner +"\t" +  m.contact + "\n\r"
+        
+        data = {}
+        data['owner']=m.owner
+        data['contact'] = m.contact
+        output[m.name] = data
+
     print output
+    print yaml.dump(output, Dumper=yaml.CSafeDumper, default_flow_style=False)
     return 0
 if __name__ == '__main__':
     sys.exit(main(sys.argv))