swarmctl: agent watch follows an agent's terminal rows
Reads GET /api/agents/{name}/term/stream over the controller socket or the
gateway and prints one line per row. The gateway path uses a client without
the total-request timeout so the stream isn't cut after 30 seconds.
Closes #6160
This commit is contained in:
parent
aa227a95c1
commit
9e0c51052b
1 changed files with 482 additions and 7 deletions
|
|
@ -286,7 +286,7 @@ async fn over_socket(
|
|||
/// throw it away. Falls back through `title` to the raw body so a response
|
||||
/// from something that is *not* the controller is still shown rather than
|
||||
/// reduced to a bare number.
|
||||
fn describe_error(status: hyper::StatusCode, body: &[u8]) -> String {
|
||||
pub(crate) fn describe_error(status: hyper::StatusCode, body: &[u8]) -> String {
|
||||
let text = String::from_utf8_lossy(body);
|
||||
let text = text.trim();
|
||||
let field = |v: &serde_json::Value, k: &str| {
|
||||
|
|
@ -313,7 +313,7 @@ fn describe_error(status: hyper::StatusCode, body: &[u8]) -> String {
|
|||
/// none of them: the daemon is off, it binds elsewhere, or this host is
|
||||
/// not the one running it at all. No group-membership case to mention
|
||||
/// here — `swarmctl` already runs as root.
|
||||
fn connect_hint(socket: &Path) -> String {
|
||||
pub(crate) fn connect_hint(socket: &Path) -> String {
|
||||
format!(
|
||||
"could not connect to swarm-controller at {} — is it running on this host? \
|
||||
(`systemctl status swarm-controller`). The path comes from \
|
||||
|
|
|
|||
Loading…
Reference in a new issue