Have the stdout channel for the just issued "cmd" command wait on
readiness, so at least Windows boxes get to read something (if they
are able to respond fast enough, but the timeout is very
generous). Linux ones will possibly (seen on older systems) never be
ready with that command, but at least we don't hang trying to read
something.
Previously, it must provide credential for each remote node. With this
change, remote node can use credential in platform. So if nodes use the
same credentials, it doesn't need to specify one by one.
Changes,
1. Remove `with_connection_info` in schema and RemoteNode. The
conneciton info won't be validated when loading schema. It's delayed
to `set_connection_info`.
2. Add `set_connection_info_by_runbook` with default values. It allows
platform to fill default values.
3. Fill in connection information of remote nodes in platform. It can
fill default value for remote nodes.
create a virtual tool VmGeneration in Azure. The lsvmbus depends on it.
These tools are shared between Azure and Hyper-V, will be moved to some
shared folder, when Hyper-V implements.
Also skip empty lines that may result from that or other SSH command
gibberish--empty lines in logs is no good for us.
Coming from SSH calls, there could be anything in them. Delete chars,
clear all the screen, change colors, whatever. These belong in the
original SSH sessions only, not on our logs.
The regex in question seems to address our needs well (7-bit ANSI C1
escape
sequences--https://en.wikipedia.org/wiki/C0_and_C1_control_codes). Ready-made
packages have been tried, like strip_ansi, and have proven to be
inferior in what they catch.
On e831ee037c we have removed all traces
of initial buffering of stdout in that function. Let's see if this
middle ground, in which we advance the file pointer by one byte (and
thus pull in some cache/extra meat to be consumed on stdout), but only
one byte, is enough not to hang on those crazy, different scenarios.
This fixes pristine Windows boxes detection again.
I don't know why there is support on WindowsShellType, but it sure
does not work on Windows SSH sessions. Some crazy ANSI escape codes
can come in from what it expects to be an integer, in some invocation
as simple as "cmd /c curl <...>":
```(Failed to parse line 'b'\x1b[2J\x1b[?25l\x1b[m\x1b[H'' as integer)```
The user deserves to know which host was unreachable, at least, not
just the port:
```2021-04-19 23:54:54.453 INFO LISA.lisa 'customized_0' attached to test case 'ATest.a_test': [Errno -2] Name or service not known```
was not telling anything
Originally, the runbook is unmarsharled with right type, and the code
needs to use `self._runbook` in `__init__`. After this change, the
runbook argument can be used directly.
With this change, the code structure is more clear. The node is extendable
now, but it's not recommended to extend node with new schema. Because
the node is the isolate components, it should be the abstract SUT, so
that LISA features can run well with it. If the node schema is extended,
it means a node must be defined in runbook, not be managed by platform.
In this situation, the resource of node is fixed, not be able to reused
in other environments dynamically.
Co-authored-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
With this change, the schema structure is clear. The following changes
will update node classes.
Co-authored-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
With consistent=True (default), copying over the same file on a
Windows machine would fail horrendously like:
```OSError('Failed to change the permissions and ownership of the
remote temporary path <FILE_NAME>.<SOME_UUID>.tmp: Failure')```
We couldn't care less about that behavior on those machines, we just
want overwrites to work :)
This makes sure we get content from those, by:
1) forcing newline on command's end
2) flushing stdin
3) giving time to command execute (by expecting status code)
Finally able to see 'Microsoft Windows [Version 10.0.17763.1879]\r\n'
on it after this fix.