def populate_path_tree(path_tree, listing_url, server_url, token): """Populates a QTreeWidget with the paths from the listing server. Args: path_tree (QtGui.QTreeWidget): The path tree widget to populate. listing_url (str): URL of the listing server that will return the available secrets we can query. server_url (str): URL of the vault server to connect to. token (str): Authentication token for vault server. """ try: listings = vault.get_listings(listing_url) mounts = vault.get_mounts(server_url, token) except Exception, e: return traceback.format_exc()
def populate_paths(self): parent = self.parent() try: listings = vault.get_listings(parent.listing_url) except Exception as e: error_text = "ERROR: Could not populate the paths viewer.\n" error_text += traceback.format_exc() self.parent().error_dialog.textEdit.setText(error_text) self.parent().error_dialog.show() return e if not listings: return "No listings found" for key in listings: if listings[key]: self.pathBox.addItems(['secret/' + key])
def refresh_objects(self): """Refreshes the objects viewer table. """ path_tree = self.pathTreeWidget if not path_tree.currentItem(): return self.selected_path = [str(path_tree.currentItem().text(0))] self.path_tree_parents(path_tree.currentItem()) # Get all the items in this path from our listings dictionary try: self.listings = vault.get_listings(self.listing_url) except Exception, e: error_text = "ERROR: Could not update the secrets viewer.\n" error_text += traceback.format_exc() self.error_dialog.textEdit.setText(error_text) self.error_dialog.show() return e