bug fixes

This commit is contained in:
Federico Luzzi 2023-12-01 15:31:17 -03:00
parent d6880d5956
commit 137524b176
3 changed files with 10 additions and 10 deletions

View File

@ -1,2 +1,2 @@
__version__ = "3.6.4" __version__ = "3.6.5"

View File

@ -203,8 +203,8 @@ class node:
''' '''
connect = self._connect(debug = debug) connect = self._connect(debug = debug)
if connect == True: if connect == True:
# size = re.search('columns=([0-9]+).*lines=([0-9]+)',str(os.get_terminal_size())) size = re.search('columns=([0-9]+).*lines=([0-9]+)',str(os.get_terminal_size()))
# self.child.setwinsize(int(size.group(2)),int(size.group(1))) self.child.setwinsize(int(size.group(2)),int(size.group(1)))
print("Connected to " + self.unique + " at " + self.host + (":" if self.port != '' else '') + self.port + " via: " + self.protocol) print("Connected to " + self.unique + " at " + self.host + (":" if self.port != '' else '') + self.port + " via: " + self.protocol)
if 'logfile' in dir(self): if 'logfile' in dir(self):
# Initialize self.mylog # Initialize self.mylog

View File

@ -36,7 +36,7 @@
</code></pre> </code></pre>
<h3 id="usage">Usage</h3> <h3 id="usage">Usage</h3>
<pre><code>usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder] [--sftp] <pre><code>usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder] [--sftp]
conn {profile,move,mv,copy,cp,list,ls,bulk,config} ... conn {profile,move,copy,list,bulk,export,import,run,config,api,ai} ...
positional arguments: positional arguments:
node|folder node[@subfolder][@folder] node|folder node[@subfolder][@folder]
@ -271,7 +271,7 @@ Connpy is a connection manager that allows you to store nodes to connect them fa
### Usage ### Usage
``` ```
usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder] [--sftp] usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder] [--sftp]
conn {profile,move,mv,copy,cp,list,ls,bulk,config} ... conn {profile,move,copy,list,bulk,export,import,run,config,api,ai} ...
positional arguments: positional arguments:
node|folder node[@subfolder][@folder] node|folder node[@subfolder][@folder]
@ -3006,9 +3006,9 @@ Categorize the user&#39;s request based on the operation they want to perform on
def _help(self, type): def _help(self, type):
#Store text for help and other commands #Store text for help and other commands
if type == &#34;node&#34;: if type == &#34;node&#34;:
return &#34;node[@subfolder][@folder]\nConnect to specific node or show all matching nodes\n[@subfolder][@folder]\nShow all available connections globaly or in specified path&#34; return &#34;node[@subfolder][@folder]\nConnect to specific node or show all matching nodes\n[@subfolder][@folder]\nShow all available connections globally or in specified path&#34;
if type == &#34;usage&#34;: if type == &#34;usage&#34;:
return &#34;conn [-h] [--add | --del | --mod | --show | --debug] [node|folder] [--sftp]\n conn {profile,move,mv,copy,cp,list,ls,bulk,config} ...&#34; return &#34;conn [-h] [--add | --del | --mod | --show | --debug] [node|folder] [--sftp]\n conn {profile,move,copy,list,bulk,export,import,run,config,api,ai} ...&#34;
if type == &#34;end&#34;: if type == &#34;end&#34;:
return &#34;Commands:\n profile Manage profiles\n move (mv) Move node\n copy (cp) Copy node\n list (ls) List profiles, nodes or folders\n bulk Add nodes in bulk\n export Export connection folder to Yaml file\n import Import connection folder to config from Yaml file\n run Run scripts or commands on nodes\n config Manage app config\n api Start and stop connpy api\n ai Make request to an AI&#34; return &#34;Commands:\n profile Manage profiles\n move (mv) Move node\n copy (cp) Copy node\n list (ls) List profiles, nodes or folders\n bulk Add nodes in bulk\n export Export connection folder to Yaml file\n import Import connection folder to config from Yaml file\n run Run scripts or commands on nodes\n config Manage app config\n api Start and stop connpy api\n ai Make request to an AI&#34;
if type == &#34;bashcompletion&#34;: if type == &#34;bashcompletion&#34;:
@ -3797,7 +3797,7 @@ tasks:
cmd = cmd + &#34; {}&#34;.format(self.host) cmd = cmd + &#34; {}&#34;.format(self.host)
else: else:
cmd = cmd + &#34; {}&#34;.format(&#34;@&#34;.join([self.user,self.host])) cmd = cmd + &#34; {}&#34;.format(&#34;@&#34;.join([self.user,self.host]))
expects = [&#39;yes/no&#39;, &#39;refused&#39;, &#39;supported&#39;, &#39;Invalid|[u|U]sage:&#39;, &#39;ssh-keygen.*\&#34;&#39;, &#39;timeout|timed.out&#39;, &#39;unavailable&#39;, &#39;closed&#39;, &#39;[p|P]assword:|[u|U]sername:&#39;, r&#39;&gt;$|#$|\$$|&gt;.$|#.$|\$.$&#39;, &#39;suspend&#39;, pexpect.EOF, pexpect.TIMEOUT, &#34;No route to host&#34;, &#34;resolve hostname&#34;, &#34;no matching&#34;] expects = [&#39;yes/no&#39;, &#39;refused&#39;, &#39;supported&#39;, &#39;Invalid|[u|U]sage:&#39;, &#39;ssh-keygen.*\&#34;&#39;, &#39;timeout|timed.out&#39;, &#39;unavailable&#39;, &#39;closed&#39;, &#39;[p|P]assword:|[u|U]sername:&#39;, r&#39;&gt;$|#$|\$$|&gt;.$|#.$|\$.$&#39;, &#39;suspend&#39;, pexpect.EOF, pexpect.TIMEOUT, &#34;No route to host&#34;, &#34;resolve hostname&#34;, &#34;no matching&#34;, &#34;bad permissions&#34;]
elif self.protocol == &#34;telnet&#34;: elif self.protocol == &#34;telnet&#34;:
cmd = &#34;telnet &#34; + self.host cmd = &#34;telnet &#34; + self.host
if self.port != &#39;&#39;: if self.port != &#39;&#39;:
@ -3810,7 +3810,7 @@ tasks:
passwords = self._passtx(self.password) passwords = self._passtx(self.password)
else: else:
passwords = [] passwords = []
expects = [&#39;[u|U]sername:&#39;, &#39;refused&#39;, &#39;supported&#39;, &#39;cipher&#39;, &#39;ssh-keygen.*\&#34;&#39;, &#39;timeout|timed.out&#39;, &#39;unavailable&#39;, &#39;closed&#39;, &#39;[p|P]assword:&#39;, r&#39;&gt;$|#$|\$$|&gt;.$|#.$|\$.$&#39;, &#39;suspend&#39;, pexpect.EOF, pexpect.TIMEOUT, &#34;No route to host&#34;, &#34;resolve hostname&#34;, &#34;no matching&#34;] expects = [&#39;[u|U]sername:&#39;, &#39;refused&#39;, &#39;supported&#39;, &#39;cipher&#39;, &#39;ssh-keygen.*\&#34;&#39;, &#39;timeout|timed.out&#39;, &#39;unavailable&#39;, &#39;closed&#39;, &#39;[p|P]assword:&#39;, r&#39;&gt;$|#$|\$$|&gt;.$|#.$|\$.$&#39;, &#39;suspend&#39;, pexpect.EOF, pexpect.TIMEOUT, &#34;No route to host&#34;, &#34;resolve hostname&#34;, &#34;no matching&#34;, &#34;bad permissions&#34;]
else: else:
raise ValueError(&#34;Invalid protocol: &#34; + self.protocol) raise ValueError(&#34;Invalid protocol: &#34; + self.protocol)
attempts = 1 attempts = 1
@ -3837,7 +3837,7 @@ tasks:
else: else:
self.missingtext = True self.missingtext = True
break break
if results in [1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15]: if results in [1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 16]:
child.terminate() child.terminate()
if results == 12 and attempts != max_attempts: if results == 12 and attempts != max_attempts:
attempts += 1 attempts += 1