def get(self):
if not self.dev.connected:
logger.error("{0}: Firewall timed out or incorrect device credentials.".format(self.firewall_config['name']))
return {'error' : 'Could not connect to device.'}, 504
else:
logger.info("{0}: Connected successfully.".format(self.firewall_config['name']))
rpc = etree.tostring(self.dev.rpc.get_commit_information(), encoding='unicode')
soup = BS(rpc,'xml')
entries = list()
logger.debug("soup: {0}".format(str(soup)))
for entry in soup.find('commit-information').children:
if type(entry) != Tag:
continue
entries.append({'user' : entry.user.text, 'sequence' : entry.find('sequence-number').text, 'date' : entry.find('date-time').text, 'comment' : entry.log.text if entry.log else None})
return {'len' : len(entries), 'commit' : entries}
评论列表
文章目录