<s> """<STR_LIT>""" <EOL> import atexit <EOL> from pyVim import connect <EOL> from pyVmomi import vmodl <EOL> from pyVmomi import vim <EOL> from tools import cli <EOL> from tools import vm <EOL> def parse_service_instance ( service_instance ) : <EOL> """<STR_LIT>""" <EOL> content = service_instance . RetrieveContent ( ) <EOL> object_view = content . viewManager . CreateContainerView ( content . rootFolder , <EOL> [ ] , True ) <EOL> for obj in object_view . view : <EOL> print obj <EOL> if isinstance ( obj , vim . VirtualMachine ) : <EOL> vm . print_vm_info ( obj ) <EOL> object_view . Destroy ( ) <EOL> return <EOL> def main ( ) : <EOL> """<STR_LIT>""" <EOL> args = cli . get_args ( ) <EOL> try : <EOL> service_instance = connect . SmartConnect ( host = args . host , <EOL> user = args . user , <EOL> pwd = args . password , <EOL> port = int ( args . port ) ) <EOL> if not service_instance : <EOL> print ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return - <NUM_LIT:1> <EOL> atexit . register ( connect . Disconnect , service_instance ) <EOL> parse_service_instance ( service_instance ) <EOL> except vmodl . MethodFault , e : <EOL> print "<STR_LIT>" + e . msg <EOL> return - <NUM_LIT:1> <EOL> return <NUM_LIT:0> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
