<s> """<STR_LIT>""" <EOL> from grr . lib import artifact <EOL> from grr . lib import flow <EOL> from grr . lib import parsers <EOL> from grr . lib . rdfvalues import client as rdf_client <EOL> from grr . lib . rdfvalues import paths as rdf_paths <EOL> from grr . lib . rdfvalues import protodict as rdf_protodict <EOL> class SystemRootSystemDriveFallbackFlow ( artifact . ArtifactFallbackCollector ) : <EOL> """<STR_LIT>""" <EOL> artifacts = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> @ flow . StateHandler ( next_state = "<STR_LIT>" ) <EOL> def Start ( self ) : <EOL> self . state . Register ( "<STR_LIT:success>" , False ) <EOL> system_drive_opts = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> for drive in system_drive_opts : <EOL> pathspec = rdf_paths . PathSpec ( path = drive , <EOL> pathtype = rdf_paths . PathSpec . PathType . OS ) <EOL> self . CallClient ( "<STR_LIT>" , pathspec = pathspec , <EOL> next_state = "<STR_LIT>" ) <EOL> @ flow . StateHandler ( ) <EOL> def ProcessFileStats ( self , responses ) : <EOL> """<STR_LIT>""" <EOL> if not responses . success : <EOL> return <EOL> system_root_paths = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> for response in responses : <EOL> if response . pathspec . path [ <NUM_LIT:4> : ] in system_root_paths : <EOL> systemdrive = response . pathspec . path [ <NUM_LIT:1> : <NUM_LIT:3> ] <EOL> systemroot = "<STR_LIT>" % ( systemdrive , response . pathspec . path [ <NUM_LIT:4> : ] ) <EOL> data = rdf_protodict . DataBlob ( ) . SetValue ( systemroot ) <EOL> self . SendReply ( rdf_client . StatEntry ( registry_data = data ) ) <EOL> self . state . success = True <EOL> break <EOL> @ flow . StateHandler ( ) <EOL> def End ( self , responses ) : <EOL> if not self . state . success : <EOL> raise flow . FlowError ( "<STR_LIT>" ) <EOL> super ( SystemRootSystemDriveFallbackFlow , self ) . End ( ) </s>
