<s> from jnpr . junos . exception import ConnectNotMasterError <EOL> def facts_chassis ( junos , facts ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> rsp = junos . rpc . get_chassis_inventory ( ) <EOL> if rsp . tag == '<STR_LIT:error>' : <EOL> raise RuntimeError ( ) <EOL> except : <EOL> facts [ '<STR_LIT>' ] = False <EOL> facts [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> facts [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return <EOL> if rsp . tag == '<STR_LIT>' : <EOL> raise ConnectNotMasterError ( junos ) <EOL> if rsp . tag == '<STR_LIT>' : <EOL> facts [ '<STR_LIT>' ] = True <EOL> facts [ '<STR_LIT>' ] = True <EOL> x_ch = rsp . xpath ( '<STR_LIT>' ) [ <NUM_LIT:0> ] . find ( '<STR_LIT>' ) <EOL> else : <EOL> facts [ '<STR_LIT>' ] = False <EOL> x_ch = rsp . find ( '<STR_LIT>' ) <EOL> facts [ '<STR_LIT>' ] = x_ch . findtext ( '<STR_LIT:description>' ) <EOL> try : <EOL> facts [ '<STR_LIT>' ] = x_ch . find ( '<STR_LIT>' ) . text <EOL> except : <EOL> facts [ '<STR_LIT>' ] = x_ch . xpath ( <EOL> '<STR_LIT>' ) [ <NUM_LIT:0> ] . text </s>
