fix: get logs with non-root user
This commit is contained in:
parent
139e258664
commit
fe22dfc531
1 changed files with 24 additions and 4 deletions
|
|
@ -91,15 +91,35 @@ public function getLogs($refresh = false)
|
||||||
if ($this->container) {
|
if ($this->container) {
|
||||||
if ($this->showTimeStamps) {
|
if ($this->showTimeStamps) {
|
||||||
if ($this->server->isSwarm()) {
|
if ($this->server->isSwarm()) {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker service logs -n {$this->numberOfLines} -t {$this->container}");
|
$command = "docker service logs -n {$this->numberOfLines} -t {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
} else {
|
} else {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}");
|
$command = "docker logs -n {$this->numberOfLines} -t {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($this->server->isSwarm()) {
|
if ($this->server->isSwarm()) {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker service logs -n {$this->numberOfLines} {$this->container}");
|
$command = "docker service logs -n {$this->numberOfLines} {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
} else {
|
} else {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} {$this->container}");
|
$command = "docker logs -n {$this->numberOfLines} {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($refresh) {
|
if ($refresh) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue