import sys sys.path.append('[omitted output]') from NaServer import * s = NaServer('[omitted output]', 1 , 20) s.set_server_type('FILER') s.set_transport_type('HTTPS') s.set_port(443) s.set_style('LOGIN') s.set_vserver('[omitted output]') s.set_admin_user('[omitted output]', '[omitted output]') volpath = '/vol/[omitted output]' api = NaElement('file-list-directory-iter') api.child_add_string('path',volpath) xi = NaElement('desired-attributes') api.child_add(xi) xi1 = NaElement('file-info') xi.child_add(xi1) xi1.child_add_string('name','<name>') xi1.child_add_string('file-type','<file-type>') xo = s.invoke_elem(api) if xo.results_status() == 'failed': print 'Error:\n' print xo.sprintf() sys.exit(1) print 'VMDK files on '+volpath+':\n' for file in xo.child_get('attributes-list').children_get(): if 'flat.vmdk' in file.child_get_string('name'): print file.child_get_string('name') |