<s> import time <EOL> import sys <EOL> from psphere . client import Client <EOL> from psphere . managedobjects import VirtualMachine <EOL> scatter_secs = <NUM_LIT:8> <EOL> nodes = sys . argv [ <NUM_LIT:1> : ] <EOL> client = Client ( ) <EOL> print ( "<STR_LIT>" % len ( nodes ) ) <EOL> print ( "<STR_LIT>" % <EOL> ( scatter_secs , scatter_secs * len ( nodes ) ) ) <EOL> for node in nodes : <EOL> try : <EOL> vm = VirtualMachine . get ( client , name = node , properties = [ "<STR_LIT:name>" , "<STR_LIT>" ] ) <EOL> except ObjectNotFoundError : <EOL> print ( "<STR_LIT>" % node ) <EOL> pass <EOL> print ( "<STR_LIT>" % vm . name ) <EOL> if vm . runtime . powerState == "<STR_LIT>" : <EOL> print ( "<STR_LIT>" % vm . name ) <EOL> continue <EOL> task = vm . PowerOnVM_Task ( ) <EOL> time . sleep ( scatter_secs ) </s>
