|
@@ -292,6 +292,19 @@ class BaseUtilsMixin:
|
|
|
for i in nodes:
|
|
|
self._db.removenodes([i])
|
|
|
|
|
|
+ def _get_node(self, nodeid):
|
|
|
+ if not nodeid.isdigit():
|
|
|
+ print("print accepts only a single ID ...")
|
|
|
+ return
|
|
|
+
|
|
|
+ nodes = self._db.getnodes([nodeid])
|
|
|
+ if not nodes: # pragma: no cover
|
|
|
+ print("Node not found ...")
|
|
|
+ return
|
|
|
+
|
|
|
+ node = self._db_entries_to_nodes(nodes)[0]
|
|
|
+ return node
|
|
|
+
|
|
|
|
|
|
class BaseCommands(HelpUIMixin, AliasesMixin, BaseUtilsMixin):
|
|
|
|
|
@@ -461,16 +474,16 @@ class BaseCommands(HelpUIMixin, AliasesMixin, BaseUtilsMixin):
|
|
|
# should call _do_* method which is testable
|
|
|
self._do_new(args)
|
|
|
|
|
|
+ def do_pp(self, args):
|
|
|
+
|
|
|
+ node = self._get_node(args)
|
|
|
+
|
|
|
+ print(node.password)
|
|
|
+
|
|
|
def do_print(self, args):
|
|
|
- if not args.isdigit():
|
|
|
- print("print accepts only a single ID ...")
|
|
|
- return
|
|
|
- nodes = self._db.getnodes([args])
|
|
|
- if not nodes: # pragma: no cover
|
|
|
- print("Node not found ...")
|
|
|
- return
|
|
|
|
|
|
- node = self._db_entries_to_nodes(nodes)[0]
|
|
|
+ node = self._get_node(args)
|
|
|
+
|
|
|
print(node)
|
|
|
flushtimeout = self.config.get_value('Global', 'cls_timeout')
|
|
|
flushtimeout = int(flushtimeout) if flushtimeout else 10
|